summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/dbwrap/dbwrap.c10
-rw-r--r--source4/lib/dbwrap/dbwrap.h5
-rw-r--r--source4/lib/dbwrap/dbwrap_tdb.c5
-rw-r--r--source4/lib/gencache/gencache.c4
-rw-r--r--source4/lib/ldb/tools/cmdline.c4
5 files changed, 17 insertions, 11 deletions
diff --git a/source4/lib/dbwrap/dbwrap.c b/source4/lib/dbwrap/dbwrap.c
index 9e893b1243..791d0adee6 100644
--- a/source4/lib/dbwrap/dbwrap.c
+++ b/source4/lib/dbwrap/dbwrap.c
@@ -25,15 +25,15 @@
#include "lib/dbwrap/dbwrap.h"
#include "param/param.h"
-/*
+/**
open a temporary database
*/
-struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags)
+struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *name, int tdb_flags)
{
- if (lp_parm_bool(global_loadparm, NULL, "ctdb", "enable", false) &&
- lp_parm_bool(global_loadparm, NULL, "ctdb", name, true)) {
+ if (lp_parm_bool(lp_ctx, NULL, "ctdb", "enable", false) &&
+ lp_parm_bool(lp_ctx, NULL, "ctdb", name, true)) {
return db_tmp_open_ctdb(mem_ctx, name, tdb_flags);
}
- return db_tmp_open_tdb(mem_ctx, name, tdb_flags);
+ return db_tmp_open_tdb(mem_ctx, lp_ctx, name, tdb_flags);
}
diff --git a/source4/lib/dbwrap/dbwrap.h b/source4/lib/dbwrap/dbwrap.h
index b4267d802d..fc1f123e23 100644
--- a/source4/lib/dbwrap/dbwrap.h
+++ b/source4/lib/dbwrap/dbwrap.h
@@ -45,9 +45,10 @@ struct db_context {
void *private_data;
};
-struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags);
+struct loadparm_context;
+struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *name, int tdb_flags);
/* backends */
-struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags);
+struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *name, int tdb_flags);
struct db_context *db_tmp_open_ctdb(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags);
diff --git a/source4/lib/dbwrap/dbwrap_tdb.c b/source4/lib/dbwrap/dbwrap_tdb.c
index 621b19532d..fae73a1db8 100644
--- a/source4/lib/dbwrap/dbwrap_tdb.c
+++ b/source4/lib/dbwrap/dbwrap_tdb.c
@@ -225,7 +225,8 @@ static int db_tdb_get_seqnum(struct db_context *db)
/*
open a temporary database
*/
-struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags)
+struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+ const char *name, int tdb_flags)
{
struct db_context *result;
struct db_tdb_ctx *db_tdb;
@@ -241,7 +242,7 @@ struct db_context *db_tmp_open_tdb(TALLOC_CTX *mem_ctx, const char *name, int td
/* the name passed in should not be a full path, it should be
just be the db name */
- path = smbd_tmp_path(result, global_loadparm, name);
+ path = smbd_tmp_path(result, lp_ctx, name);
db_tdb->wtdb = tdb_wrap_open(db_tdb, path, 0, tdb_flags,
O_CREAT|O_RDWR, 0666);
diff --git a/source4/lib/gencache/gencache.c b/source4/lib/gencache/gencache.c
index ea80a93624..aaaa40eea8 100644
--- a/source4/lib/gencache/gencache.c
+++ b/source4/lib/gencache/gencache.c
@@ -47,7 +47,7 @@ static struct tdb_wrap *cache;
* false on failure
**/
-bool gencache_init(void)
+bool gencache_init(struct loadparm_context *lp_ctx)
{
char* cache_fname = NULL;
TALLOC_CTX *mem_ctx = talloc_autofree_context();
@@ -55,7 +55,7 @@ bool gencache_init(void)
/* skip file open if it's already opened */
if (cache) return true;
- cache_fname = lock_path(mem_ctx, global_loadparm, "gencache.tdb");
+ cache_fname = lock_path(mem_ctx, lp_ctx, "gencache.tdb");
if (cache_fname != NULL) {
DEBUG(5, ("Opening cache file at %s\n", cache_fname));
} else {
diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c
index 5e3013600a..1f8c7ce684 100644
--- a/source4/lib/ldb/tools/cmdline.c
+++ b/source4/lib/ldb/tools/cmdline.c
@@ -217,6 +217,10 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
if (ldb_set_opaque(ldb, "credentials", cmdline_credentials)) {
goto failed;
}
+ if (ldb_set_opaque(ldb, "loadparm", global_loadparm)) {
+ goto failed;
+ }
+
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
#endif