dbwrap: Avoid passing lp_ctx to tdb_wrap_open in db_open_tdb
authorVolker Lendecke <vl@samba.org>
Wed, 26 Mar 2014 14:26:24 +0000 (14:26 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 31 Mar 2014 20:52:13 +0000 (22:52 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/dbwrap/dbwrap_tdb.c

index 1b061e3fdf456440f8a73e698588e58c1134e96f..82a9916e2f9c665516acfa5c373210da86f664e7 100644 (file)
@@ -25,6 +25,7 @@
 #include "lib/util/util_tdb.h"
 #include "system/filesys.h"
 #include "ccan/str/str.h"
+#include "lib/param/param.h"
 
 struct db_tdb_ctx {
        struct tdb_wrap *wtdb;
@@ -427,8 +428,13 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
        }
        result->lock_order = lock_order;
 
-       db_tdb->wtdb = tdb_wrap_open(db_tdb, name, hash_size, tdb_flags,
-                                    open_flags, mode, lp_ctx);
+       if (hash_size == 0) {
+               hash_size = lpcfg_tdb_hash_size(lp_ctx, name);
+       }
+
+       db_tdb->wtdb = tdb_wrap_open_(db_tdb, name, hash_size,
+                                     lpcfg_tdb_flags(lp_ctx, tdb_flags),
+                                     open_flags, mode);
        if (db_tdb->wtdb == NULL) {
                DEBUG(3, ("Could not open tdb: %s\n", strerror(errno)));
                goto fail;