diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/util_tdb.c | 17 | ||||
-rw-r--r-- | source3/libsmb/smb_share_modes.c | 10 | ||||
-rw-r--r-- | source3/printing/tests/vlp.c | 5 | ||||
-rw-r--r-- | source3/smbd/mangle_hash.c | 5 | ||||
-rw-r--r-- | source3/torture/mangle_test.c | 2 |
5 files changed, 26 insertions, 13 deletions
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index 92c43d8605..2d49b9e2ec 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -372,6 +372,14 @@ int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...) Log tdb messages via DEBUG(). ****************************************************************************/ +#ifdef BUILD_TDB2 +static void tdb_log(TDB_CONTEXT *tdb, enum tdb_log_level level, + const char *message, void *unused) +{ + DEBUG((int)level, ("tdb(%s): %s", + tdb_name(tdb) ? tdb_name(tdb) : "unnamed", message)); +} +#else static void tdb_log(TDB_CONTEXT *tdb, enum tdb_debug_level level, const char *format, ...) { va_list ap; @@ -388,6 +396,7 @@ static void tdb_log(TDB_CONTEXT *tdb, enum tdb_debug_level level, const char *fo DEBUG((int)level, ("tdb(%s): %s", tdb_name(tdb) ? tdb_name(tdb) : "unnamed", ptr)); SAFE_FREE(ptr); } +#endif /* TDB1 */ /**************************************************************************** Like tdb_open() but also setup a logging function that redirects to @@ -398,14 +407,10 @@ TDB_CONTEXT *tdb_open_log(const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode) { TDB_CONTEXT *tdb; - struct tdb_logging_context log_ctx; if (!lp_use_mmap()) tdb_flags |= TDB_NOMMAP; - log_ctx.log_fn = tdb_log; - log_ctx.log_private = NULL; - if ((hash_size == 0) && (name != NULL)) { const char *base = strrchr_m(name, '/'); if (base != NULL) { @@ -417,8 +422,8 @@ TDB_CONTEXT *tdb_open_log(const char *name, int hash_size, int tdb_flags, hash_size = lp_parm_int(-1, "tdb_hashsize", base, 0); } - tdb = tdb_open_ex(name, hash_size, tdb_flags, - open_flags, mode, &log_ctx, NULL); + tdb = tdb_open_compat(name, hash_size, tdb_flags, + open_flags, mode, tdb_log, NULL); if (!tdb) return NULL; diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c index a4a54972c9..7c0a6d2a4e 100644 --- a/source3/libsmb/smb_share_modes.c +++ b/source3/libsmb/smb_share_modes.c @@ -69,10 +69,12 @@ struct smbdb_ctx *smb_share_mode_db_open(const char *db_path) memset(smb_db, '\0', sizeof(struct smbdb_ctx)); - smb_db->smb_tdb = tdb_open(db_path, - 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, - O_RDWR|O_CREAT, - 0644); + /* FIXME: We should *never* open a tdb without logging! */ + smb_db->smb_tdb = tdb_open_compat(db_path, + 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, + O_RDWR|O_CREAT, + 0644, + NULL, NULL); if (!smb_db->smb_tdb) { free(smb_db); diff --git a/source3/printing/tests/vlp.c b/source3/printing/tests/vlp.c index 927224cb2e..66860e5ada 100644 --- a/source3/printing/tests/vlp.c +++ b/source3/printing/tests/vlp.c @@ -392,8 +392,9 @@ int main(int argc, char **argv) return 1; } - if (!(tdb = tdb_open(printdb_path, 0, 0, O_RDWR | O_CREAT, - 0666))) { + /* FIXME: We should *never* open a tdb without logging! */ + if (!(tdb = tdb_open_compat(printdb_path, 0, 0, O_RDWR | O_CREAT, + 0666, NULL, NULL))) { printf("%s: unable to open %s\n", argv[0], printdb_path); return 1; } diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index 988251e878..c196a13ed0 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -773,8 +773,13 @@ const struct mangle_fns *mangle_hash_init(void) mangle_reset(); /* Create the in-memory tdb using our custom hash function. */ +#ifndef BUILD_TDB2 tdb_mangled_cache = tdb_open_ex("mangled_cache", 1031, TDB_INTERNAL, (O_RDWR|O_CREAT), 0644, NULL, fast_string_hash); +#else + /* FIXME: We should *never* open a tdb without logging! */ + tdb_mangled_cache = tdb_open("mangled_cache", TDB_INTERNAL, 0, 0, NULL); +#endif return &mangle_hash_fns; } diff --git a/source3/torture/mangle_test.c b/source3/torture/mangle_test.c index b9e3f6a8cf..4fc91dc4b3 100644 --- a/source3/torture/mangle_test.c +++ b/source3/torture/mangle_test.c @@ -181,7 +181,7 @@ bool torture_mangle(int dummy) } /* we will use an internal tdb to store the names we have used */ - tdb = tdb_open(NULL, 100000, TDB_INTERNAL, 0, 0); + tdb = tdb_open_compat(NULL, 100000, TDB_INTERNAL, 0, 0, NULL, NULL); if (!tdb) { printf("ERROR: Failed to open tdb\n"); return False; |