FreeBSD Bugzilla – Attachment 213042 Details for
Bug 245339
databases/ruby-bdb: suppress deprecate warning with Ruby 2.7
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
exclude the useless codes which treat deprecated safe levels
ruby-bdb-ruby27.diff (text/plain), 23.53 KB, created by
Hajimu UMEMOTO
on 2020-04-04 01:43:18 UTC
(
hide
)
Description:
exclude the useless codes which treat deprecated safe levels
Filename:
MIME Type:
Creator:
Hajimu UMEMOTO
Created:
2020-04-04 01:43:18 UTC
Size:
23.53 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (revision 530461) >+++ Makefile (working copy) >@@ -3,7 +3,7 @@ > > PORTNAME= bdb > PORTVERSION= 0.6.6 >-PORTREVISION= 7 >+PORTREVISION= 8 > CATEGORIES= databases ruby > MASTER_SITES= ftp://ftp.idaemons.org/pub/distfiles/ruby/ \ > http://idaemons.org/distfiles/ruby/ \ >Index: files/patch-bdbxml1__bdbxml.cc >=================================================================== >--- files/patch-bdbxml1__bdbxml.cc (revision 530461) >+++ files/patch-bdbxml1__bdbxml.cc (working copy) >@@ -1,6 +1,88 @@ > --- bdbxml1/bdbxml.cc.orig 2011-04-06 19:35:39 UTC > +++ bdbxml1/bdbxml.cc >-@@ -2340,18 +2340,16 @@ >+@@ -1148,15 +1148,19 @@ xb_con_init(int argc, VALUE *argv, VALUE obj) >+ flags = NUM2INT(b); >+ } >+ } >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ if (flags & DB_TRUNCATE) { >+ rb_secure(2); >+ } >++#endif >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if (flags & DB_CREATE) { >+ rb_secure(4); >+ } >+ if (rb_safe_level() >= 4) { >+ flags |= DB_RDONLY; >+ } >++#endif >+ if (!txn && con->env_val) { >+ bdb_ENV *envst = NULL; >+ GetEnvDBErr(con->env_val, envst, id_current_env, xb_eFatal); >+@@ -1179,9 +1183,11 @@ xb_con_close(int argc, VALUE *argv, VALUE obj) >+ xcon *con; >+ int flags = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4) { >+ rb_raise(rb_eSecurityError, "Insecure: can't close the container"); >+ } >++#endif >+ Data_Get_Struct(obj, xcon, con); >+ if (!con->closed && con->con) { >+ if (rb_scan_args(argc, argv, "01", &a)) { >+@@ -1516,7 +1522,9 @@ xb_int_update(int argc, VALUE *argv, VALUE obj, XmlUpd >+ DbTxn *txn; >+ VALUE a; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ GetConTxn(obj, con, txn); >+ if (rb_scan_args(argc, argv, "10", &a) != 1) { >+ rb_raise(rb_eArgError, "invalid number of arguments (%d for 1)", argc); >+@@ -1545,7 +1553,9 @@ xb_int_push(int argc, VALUE *argv, VALUE obj, XmlUpdat >+ VALUE a, b; >+ int flags = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ GetConTxn(obj, con, txn); >+ if (rb_scan_args(argc, argv, "11", &a, &b) == 2) { >+ flags = NUM2INT(b); >+@@ -1775,7 +1785,9 @@ xb_int_delete(int argc, VALUE *argv, VALUE obj, XmlUpd >+ VALUE a, b; >+ int flags = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ GetConTxn(obj, con, txn); >+ if (rb_scan_args(argc, argv, "11", &a, &b) == 2) { >+ flags = NUM2INT(b); >+@@ -1824,7 +1836,9 @@ xb_con_remove(int argc, VALUE *argv, VALUE obj) >+ xcon *con; >+ DbTxn *txn = NULL; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ if (rb_scan_args(argc, argv, "11", &a, &b) == 2) { >+ flags = NUM2INT(b); >+ } >+@@ -1844,7 +1858,9 @@ xb_con_rename(int argc, VALUE *argv, VALUE obj) >+ char *str; >+ DbTxn *txn = NULL; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ if (rb_scan_args(argc, argv, "21", &a, &b, &c) == 3) { >+ flags = NUM2INT(c); >+ } >+@@ -2340,18 +2356,16 @@ extern "C" { > major = NUM2INT(rb_const_get(xb_mDb, rb_intern("VERSION_MAJOR"))); > minor = NUM2INT(rb_const_get(xb_mDb, rb_intern("VERSION_MINOR"))); > patch = NUM2INT(rb_const_get(xb_mDb, rb_intern("VERSION_PATCH"))); >Index: files/patch-bdbxml2__bdbxml.cc >=================================================================== >--- files/patch-bdbxml2__bdbxml.cc (revision 530461) >+++ files/patch-bdbxml2__bdbxml.cc (working copy) >@@ -1,6 +1,170 @@ > --- bdbxml2/bdbxml.cc.orig 2011-04-06 19:35:39 UTC > +++ bdbxml2/bdbxml.cc >-@@ -5536,18 +5536,16 @@ >+@@ -392,9 +392,11 @@ xb_env_free(bdb_ENV *envst) >+ static VALUE >+ xb_env_close(VALUE obj) >+ { >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4) { >+ rb_raise(rb_eSecurityError, "Insecure: can't close the environnement"); >+ } >++#endif >+ bdb_ENV *envst; >+ GetEnvDBErr(obj, envst, id_current_env, xb_eFatal); >+ xb_final(envst); >+@@ -743,7 +745,9 @@ xb_man_type_set(VALUE obj, VALUE a) >+ static VALUE >+ xb_man_rename(VALUE obj, VALUE a, VALUE b) >+ { >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ XmlTransaction *xmltxn = get_txn(obj); >+ xman *man = get_man_txn(obj); >+ char *oldname = StringValuePtr(a); >+@@ -760,7 +764,9 @@ xb_man_rename(VALUE obj, VALUE a, VALUE b) >+ static VALUE >+ xb_man_remove(VALUE obj, VALUE a) >+ { >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ XmlTransaction *xmltxn = get_txn(obj); >+ xman *man = get_man_txn(obj); >+ char *name = StringValuePtr(a); >+@@ -843,7 +849,9 @@ xb_man_verify(int argc, VALUE *argv, VALUE obj) >+ VALUE a, b, c, d; >+ int flags = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ switch (rb_scan_args(argc, argv, "12", &a, &b, &c, &d)) { >+ case 4: >+ flags = NUM2INT(d); >+@@ -885,7 +893,9 @@ xb_man_load_con(int argc, VALUE *argv, VALUE obj) >+ unsigned long lineno = 0; >+ bool freeupd = true; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ xman *man = get_man(obj); >+ switch (rb_scan_args(argc, argv, "22", &a, &b, &c, &d)) { >+ case 4: >+@@ -1028,7 +1038,9 @@ xb_man_reindex(int argc, VALUE *argv, VALUE obj) >+ bool freeupd = true; >+ int flags = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ XmlTransaction *xmltxn = get_txn(obj); >+ xman *man = get_man_txn(obj); >+ switch (rb_scan_args(argc, argv, "12", &a, &b, &c)) { >+@@ -1125,7 +1137,9 @@ xb_man_compact_con(int argc, VALUE *argv, VALUE obj) >+ bool freeupd = true; >+ int flags = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ XmlTransaction *xmltxn = get_txn(obj); >+ xman *man = get_man_txn(obj); >+ switch (rb_scan_args(argc, argv, "11", &a, &b)) { >+@@ -1168,7 +1182,9 @@ xb_man_truncate_con(int argc, VALUE *argv, VALUE obj) >+ bool freeupd = true; >+ int flags = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ XmlTransaction *xmltxn = get_txn(obj); >+ xman *man = get_man_txn(obj); >+ switch (rb_scan_args(argc, argv, "11", &a, &b)) { >+@@ -1274,9 +1290,11 @@ xb_int_open_con(int argc, VALUE *argv, VALUE obj, VALU >+ if (rb_scan_args(argc, argv, "11", &a, &b) == 2) { >+ flags = NUM2INT(b); >+ } >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if (flags && DB_CREATE) { >+ rb_secure(4); >+ } >++#endif >+ char *name = StringValuePtr(a); >+ xman *man = get_man_txn(obj); >+ XmlTransaction *xmltxn = get_txn(obj); >+@@ -1315,7 +1333,9 @@ xb_int_create_con(int argc, VALUE *argv, VALUE obj, VA >+ XmlContainer *xmlcon; >+ xcon *con; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ xman *man = get_man_txn(obj); >+ XmlTransaction *xmltxn = get_txn(obj); >+ if (argc == 1) { >+@@ -1965,7 +1985,9 @@ xb_con_add(int argc, VALUE *argv, VALUE obj) >+ bool freeupd = true; >+ int flags = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ xcon *con = get_con(obj); >+ XmlTransaction *xmltxn = get_con_txn(con); >+ rb_scan_args(argc, argv, "13", &a, &b, &c, &d); >+@@ -2062,7 +2084,9 @@ xb_con_update(int argc, VALUE *argv, VALUE obj) >+ XmlUpdateContext *xmlupd = 0; >+ bool freeupd = true; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ xcon *con = get_con(obj); >+ XmlTransaction *xmltxn = get_con_txn(con); >+ if (rb_scan_args(argc, argv, "11", &a, &b) == 2) { >+@@ -2098,7 +2122,9 @@ xb_con_delete(int argc, VALUE *argv, VALUE obj) >+ XmlUpdateContext *xmlupd = 0; >+ bool freeupd = true; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ xcon *con = get_con(obj); >+ XmlTransaction *xmltxn = get_con_txn(con); >+ if (rb_scan_args(argc, argv, "11", &a, &b) == 2) { >+@@ -2554,7 +2580,9 @@ xb_con_index_set(int argc, VALUE *argv, VALUE obj) >+ bool freeupd = true; >+ VALUE a, b; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ xcon *con = get_con(obj); >+ XmlTransaction *xmltxn = get_con_txn(con); >+ if (rb_scan_args(argc, argv, "11", &a, &b) == 2) { >+@@ -3176,7 +3204,9 @@ xb_man_create_look(int argc, VALUE *argv, VALUE obj) >+ XmlIndexLookup::Operation xmlop = XmlIndexLookup::EQ; >+ VALUE a, b, c, d, e, f, res; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ xman *man = get_man_txn(obj); >+ switch(rb_scan_args(argc, argv, "42", &a, &b, &c, &d, &e, &f)) { >+ case 6: >+@@ -4392,7 +4422,9 @@ xb_mod_execute(int argc, VALUE *argv, VALUE obj) >+ bool freeupd = true, freecxt = true; >+ VALUE a, b, c; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ switch (rb_scan_args(argc, argv, "12", &a, &b, &c)) { >+ case 3: >+ { >+@@ -5536,18 +5568,16 @@ extern "C" { > major = NUM2INT(rb_const_get(xb_mDb, rb_intern("VERSION_MAJOR"))); > minor = NUM2INT(rb_const_get(xb_mDb, rb_intern("VERSION_MINOR"))); > patch = NUM2INT(rb_const_get(xb_mDb, rb_intern("VERSION_PATCH"))); >Index: files/patch-src-common.c >=================================================================== >--- files/patch-src-common.c (revision 530461) >+++ files/patch-src-common.c (working copy) >@@ -1,6 +1,18 @@ > --- src/common.c.orig 2011-04-06 19:35:39 UTC > +++ src/common.c >-@@ -1229,7 +1229,7 @@ bdb_s_new(int argc, VALUE *argv, VALUE o >+@@ -1080,9 +1080,11 @@ bdb_close(int argc, VALUE *argv, VALUE obj) >+ bdb_DB *dbst; >+ int flags = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4) { >+ rb_raise(rb_eSecurityError, "Insecure: can't close the database"); >+ } >++#endif >+ Data_Get_Struct(obj, bdb_DB, dbst); >+ if (dbst->dbp != NULL) { >+ if (rb_scan_args(argc, argv, "01", &opt)) { >+@@ -1229,7 +1231,7 @@ bdb_s_new(int argc, VALUE *argv, VALUE obj) > if (argc && TYPE(argv[argc - 1]) == T_HASH) { > VALUE v, f = argv[argc - 1]; > >@@ -9,7 +21,7 @@ > if (!rb_obj_is_kind_of(v, bdb_cTxn)) { > rb_raise(bdb_eFatal, "argument of txn must be a transaction"); > } >-@@ -1241,7 +1241,7 @@ bdb_s_new(int argc, VALUE *argv, VALUE o >+@@ -1241,7 +1243,7 @@ bdb_s_new(int argc, VALUE *argv, VALUE obj) > dbst->options |= envst->options & BDB_NO_THREAD; > dbst->marshal = txnst->marshal; > } >@@ -18,7 +30,7 @@ > if (!rb_obj_is_kind_of(v, bdb_cEnv)) { > rb_raise(bdb_eFatal, "argument of env must be an environnement"); > } >-@@ -1254,11 +1254,11 @@ bdb_s_new(int argc, VALUE *argv, VALUE o >+@@ -1254,11 +1256,11 @@ bdb_s_new(int argc, VALUE *argv, VALUE obj) > #if HAVE_CONST_DB_ENCRYPT > if (envst && (envst->options & BDB_ENV_ENCRYPT)) { > VALUE tmp = rb_str_new2("set_flags"); >@@ -32,8 +44,28 @@ > rb_hash_aset(f, tmp, INT2NUM(NUM2INT(v) | DB_ENCRYPT)); > } > else { >-@@ -1570,10 +1570,10 @@ bdb_init(int argc, VALUE *argv, VALUE ob >+@@ -1431,15 +1433,19 @@ bdb_init(int argc, VALUE *argv, VALUE obj) >+ dbst->options |= BDB_FEEDBACK; >+ } > #endif >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ if (flags & DB_TRUNCATE) { >+ rb_secure(2); >+ } >++#endif >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if (flags & DB_CREATE) { >+ rb_secure(4); >+ } >+ if (rb_safe_level() >= 4) { >+ flags |= DB_RDONLY; >+ } >++#endif >+ #if HAVE_CONST_DB_DUPSORT >+ if (dbst->options & BDB_DUP_COMPARE) { >+ #if HAVE_TYPE_DB_INFO >+@@ -1570,10 +1576,10 @@ bdb_init(int argc, VALUE *argv, VALUE obj) >+ #endif > switch(dbst->type) { > case DB_BTREE: > - RBASIC(obj)->klass = bdb_cBtree; >@@ -45,7 +77,7 @@ > break; > case DB_RECNO: > { >-@@ -1581,17 +1581,17 @@ bdb_init(int argc, VALUE *argv, VALUE ob >+@@ -1581,17 +1587,17 @@ bdb_init(int argc, VALUE *argv, VALUE obj) > > rb_warning("It's hard to distinguish Recnum with Recno for all versions of Berkeley DB"); > if ((count = bdb_is_recnum(dbst->dbp)) != -1) { >@@ -66,7 +98,7 @@ > break; > #endif > default: >-@@ -1635,29 +1635,29 @@ bdb_s_alloc(obj) >+@@ -1635,29 +1641,29 @@ bdb_s_alloc(obj) > dbst->options = BDB_NOT_OPEN; > cl = obj; > while (cl) { >@@ -102,8 +134,48 @@ > dbst->type = DB_UNKNOWN; > break; > } >-@@ -3004,8 +3004,8 @@ bdb_each_kvc(argc, argv, obj, sens, repl >+@@ -1802,7 +1808,9 @@ bdb_append_internal(argc, argv, obj, flag, retval) >+ VALUE *a, ary = Qnil; >+ volatile VALUE res = Qnil; > >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ if (argc < 1) >+ return obj; >+ INIT_TXN(txnid, obj, dbst); >+@@ -1885,7 +1893,9 @@ bdb_put(int argc, VALUE *argv, VALUE obj) >+ int ret, flags; >+ db_recno_t recno; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ INIT_TXN(txnid, obj, dbst); >+ flags = 0; >+ a = b = c = Qnil; >+@@ -2374,7 +2384,9 @@ bdb_consume(obj) >+ int ret; >+ db_recno_t recno; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ INIT_TXN(txnid, obj, dbst); >+ MEMZERO(&key, DBT, 1); >+ MEMZERO(&data, DBT, 1); >+@@ -2551,7 +2563,9 @@ bdb_del(obj, a) >+ db_recno_t recno; >+ volatile VALUE b = Qnil; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ INIT_TXN(txnid, obj, dbst); >+ #if HAVE_CONST_DB_AUTO_COMMIT >+ if (txnid == NULL && (dbst->options & BDB_AUTO_COMMIT)) { >+@@ -3004,8 +3018,8 @@ bdb_each_kvc(argc, argv, obj, sens, replace, type) >+ > if (argc && TYPE(argv[argc - 1]) == T_HASH) { > VALUE g, f = argv[argc - 1]; > - if ((g = rb_hash_aref(f, rb_intern("flags"))) != RHASH(f)->ifnone || >@@ -113,7 +185,29 @@ > flags = NUM2INT(g); > } > argc--; >-@@ -3323,8 +3323,8 @@ bdb_clear(int argc, VALUE *argv, VALUE o >+@@ -3053,9 +3067,11 @@ bdb_each_kvc(argc, argv, obj, sens, replace, type) >+ } >+ #endif >+ type &= ~BDB_ST_ONE; >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if ((type & ~BDB_ST_PREFIX) == BDB_ST_DELETE) { >+ rb_secure(4); >+ } >++#endif >+ INIT_TXN(txnid, obj, dbst); >+ #if HAVE_DB_CURSOR_4 >+ bdb_test_error(dbst->dbp->cursor(dbst->dbp, txnid, &dbcp, flags)); >+@@ -3309,7 +3325,9 @@ bdb_clear(int argc, VALUE *argv, VALUE obj) >+ #endif >+ int flags = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ #if HAVE_ST_DB_TRUNCATE >+ INIT_TXN(txnid, obj, dbst); >+ #if HAVE_CONST_DB_AUTO_COMMIT >+@@ -3323,8 +3341,8 @@ bdb_clear(int argc, VALUE *argv, VALUE obj) > flags = 0; > if (argc && TYPE(argv[argc - 1]) == T_HASH) { > VALUE g, f = argv[argc - 1]; >@@ -124,7 +218,7 @@ > flags = NUM2INT(g); > } > argc--; >-@@ -3348,8 +3348,8 @@ bdb_replace(int argc, VALUE *argv, VALUE >+@@ -3348,8 +3366,8 @@ bdb_replace(int argc, VALUE *argv, VALUE obj) > flags = 0; > if (TYPE(argv[argc - 1]) == T_HASH) { > VALUE f = argv[argc - 1]; >@@ -135,3 +229,54 @@ > flags = NUM2INT(g); > } > argc--; >+@@ -3557,8 +3575,10 @@ bdb_sync(obj) >+ { >+ bdb_DB *dbst; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4) >+ rb_raise(rb_eSecurityError, "Insecure: can't sync the database"); >++#endif >+ GetDB(obj, dbst); >+ bdb_test_error(dbst->dbp->sync(dbst->dbp, 0)); >+ return Qtrue; >+@@ -3884,7 +3904,9 @@ bdb_s_upgrade(int argc, VALUE *argv, VALUE obj) >+ int flags; >+ VALUE val; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ flags = 0; >+ if (rb_scan_args(argc, argv, "11", &a, &b) == 2) { >+ flags = NUM2INT(b); >+@@ -3908,7 +3930,9 @@ bdb_s_remove(int argc, VALUE *argv, VALUE obj) >+ VALUE a, b, c; >+ char *name, *subname; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ c = bdb_i_create(obj); >+ GetDB(c, dbst); >+ name = subname = NULL; >+@@ -3936,7 +3960,9 @@ bdb_s_rename(int argc, VALUE *argv, VALUE obj) >+ VALUE a, b, c; >+ char *name, *subname, *newname; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ c = bdb_i_create(obj); >+ GetDB(c, dbst); >+ name = subname = NULL; >+@@ -4222,7 +4248,9 @@ bdb_verify(int argc, VALUE *argv, VALUE obj) >+ #endif >+ FILE *io = NULL; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ file = database = NULL; >+ switch(rb_scan_args(argc, argv, "02", &iov, &flagv)) { >+ case 2: >Index: files/patch-src-cursor.c >=================================================================== >--- files/patch-src-cursor.c (revision 530461) >+++ files/patch-src-cursor.c (working copy) >@@ -1,6 +1,6 @@ > --- src/cursor.c.orig 2011-04-06 19:35:39 UTC > +++ src/cursor.c >-@@ -29,8 +29,8 @@ bdb_cursor(int argc, VALUE *argv, VALUE >+@@ -29,8 +29,8 @@ bdb_cursor(int argc, VALUE *argv, VALUE obj) > flags = 0; > if (argc && TYPE(argv[argc - 1]) == T_HASH) { > VALUE g, f = argv[argc - 1]; >@@ -11,3 +11,34 @@ > flags = NUM2INT(g); > } > argc--; >+@@ -67,8 +67,10 @@ bdb_cursor_close(VALUE obj) >+ bdb_DBC *dbcst; >+ bdb_DB *dbst; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4) >+ rb_raise(rb_eSecurityError, "Insecure: can't close the cursor"); >++#endif >+ GetCursorDB(obj, dbcst, dbst); >+ bdb_test_error(dbcst->dbc->c_close(dbcst->dbc)); >+ dbcst->dbc = NULL; >+@@ -82,7 +84,9 @@ bdb_cursor_del(VALUE obj) >+ bdb_DBC *dbcst; >+ bdb_DB *dbst; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ GetCursorDB(obj, dbcst, dbst); >+ bdb_test_error(dbcst->dbc->c_del(dbcst->dbc, flags)); >+ return Qtrue; >+@@ -353,7 +357,9 @@ bdb_cursor_put(int argc, VALUE *argv, VALUE obj) >+ db_recno_t recno; >+ int ret; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ MEMZERO(&key, DBT, 1); >+ MEMZERO(&data, DBT, 1); >+ cnt = rb_scan_args(argc, argv, "21", &a, &b, &c); >Index: files/patch-src-recnum.c >=================================================================== >--- files/patch-src-recnum.c (revision 530461) >+++ files/patch-src-recnum.c (working copy) >@@ -1,6 +1,6 @@ > --- src/recnum.c.orig 2011-04-06 19:35:39 UTC > +++ src/recnum.c >-@@ -17,7 +17,7 @@ bdb_recnum_init(int argc, VALUE *argv, V >+@@ -17,7 +17,7 @@ bdb_recnum_init(int argc, VALUE *argv, VALUE obj) > argc++; > } > rb_hash_aset(argv[argc - 1], array, INT2FIX(0)); >@@ -9,8 +9,18 @@ > rb_hash_aset(argv[argc - 1], sarray, INT2FIX(0)); > } > rb_hash_aset(argv[argc - 1], rb_str_new2("set_flags"), INT2FIX(DB_RENUMBER)); >-@@ -697,8 +697,8 @@ bdb_sary_clear(int argc, VALUE *argv, VA >+@@ -112,7 +112,9 @@ bdb_intern_shift_pop(VALUE obj, int depart, int len) >+ db_recno_t recno; >+ VALUE res; > >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ INIT_TXN(txnid, obj, dbst); >+ #if HAVE_DB_CURSOR_4 >+ bdb_test_error(dbst->dbp->cursor(dbst->dbp, txnid, &dbcp, 0)); >+@@ -697,8 +699,8 @@ bdb_sary_clear(int argc, VALUE *argv, VALUE obj) >+ > if (argc && TYPE(argv[argc - 1]) == T_HASH) { > VALUE f = argv[argc - 1]; > - if ((g = rb_hash_aref(f, rb_intern("flags"))) != RHASH(f)->ifnone || >Index: files/patch-src__env.c >=================================================================== >--- files/patch-src__env.c (nonexistent) >+++ files/patch-src__env.c (working copy) >@@ -0,0 +1,41 @@ >+--- src/env.c.orig 2011-04-06 19:35:39 UTC >++++ src/env.c >+@@ -1121,9 +1121,11 @@ bdb_env_close(VALUE obj) >+ { >+ bdb_ENV *envst; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4) { >+ rb_raise(rb_eSecurityError, "Insecure: can't close the environnement"); >+ } >++#endif >+ GetEnvDB(obj, envst); >+ bdb_final(envst); >+ RDATA(obj)->dfree = free; >+@@ -1517,12 +1519,16 @@ bdb_env_init(int argc, VALUE *argv, VALUE obj) >+ flags = NUM2INT(c); >+ break; >+ } >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ if (flags & DB_CREATE) { >+ rb_secure(4); >+ } >++#endif >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 1 >+ if (flags & DB_USE_ENVIRON) { >+ rb_secure(1); >+ } >++#endif >+ #ifndef BDB_NO_THREAD_COMPILE >+ if (!(envst->options & BDB_NO_THREAD)) { >+ bdb_set_func(envst); >+@@ -1658,7 +1664,9 @@ bdb_env_s_remove(int argc, VALUE *argv, VALUE obj) >+ char *db_home; >+ int flag = 0; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ if (rb_scan_args(argc, argv, "11", &a, &b) == 2) { >+ flag = NUM2INT(b); >+ } > >Property changes on: files/patch-src__env.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-src__transaction.c >=================================================================== >--- files/patch-src__transaction.c (nonexistent) >+++ files/patch-src__transaction.c (working copy) >@@ -0,0 +1,52 @@ >+--- src/transaction.c.orig 2011-04-06 19:35:39 UTC >++++ src/transaction.c >+@@ -139,7 +139,9 @@ bdb_txn_commit(int argc, VALUE *argv, VALUE obj) >+ VALUE a; >+ int flags; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ flags = 0; >+ if (rb_scan_args(argc, argv, "01", &a) == 1) { >+ flags = NUM2INT(a); >+@@ -552,7 +554,9 @@ bdb_env_recover(VALUE obj) >+ if (!rb_block_given_p()) { >+ rb_raise(bdb_eFatal, "call out of an iterator"); >+ } >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ GetEnvDB(obj, envst); >+ txnv = Data_Make_Struct(bdb_cTxn, bdb_TXN, bdb_txn_mark, bdb_txn_free, txnst); >+ txnst->env = obj; >+@@ -584,7 +588,9 @@ bdb_txn_discard(VALUE obj) >+ bdb_TXN *txnst; >+ int flags; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 4 >+ rb_secure(4); >++#endif >+ flags = 0; >+ GetTxnDB(obj, txnst); >+ #if HAVE_ST_DB_TXN_DISCARD >+@@ -761,7 +767,9 @@ bdb_env_dbremove(int argc, VALUE *argv, VALUE obj) >+ bdb_TXN *txnst; >+ DB_TXN *txnid; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ a = b = c = Qnil; >+ file = database = NULL; >+ flags = 0; >+@@ -810,7 +818,9 @@ bdb_env_dbrename(int argc, VALUE *argv, VALUE obj) >+ bdb_TXN *txnst; >+ DB_TXN *txnid; >+ >++#if defined(RUBY_SAFE_LEVEL_MAX) && RUBY_SAFE_LEVEL_MAX >= 2 >+ rb_secure(2); >++#endif >+ a = b = c = Qnil; >+ file = database = newname = NULL; >+ flags = 0; > >Property changes on: files/patch-src__transaction.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 245339
: 213042