From ed2a1c718ae4fb56fdfe73da6f63ddb7fb15d9fd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 11 Sep 2007 15:42:19 +0000 Subject: r25081: Add modules_dir member to ldb_context that is used rather than a global modulesdir setting. Samba always sets this to lp_modulesdir()/ldb (This used to be commit e672380d2156cf0421108a9c34f04f096c2afeed) --- source4/lib/ldb/common/ldb.c | 1 + source4/lib/ldb/common/ldb_modules.c | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'source4/lib/ldb/common') diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index f8085d213a..eb8ff62a0d 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -51,6 +51,7 @@ struct ldb_context *ldb_init(void *mem_ctx) ldb_set_utf8_default(ldb); ldb_set_create_perms(ldb, 0666); + ldb_set_modules_dir(ldb, LDB_MODULESDIR); return ldb; } diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 2c9fba590a..b279af98f6 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -42,6 +42,12 @@ #define LDB_MODULE_PREFIX "modules:" #define LDB_MODULE_PREFIX_LEN 8 +void ldb_set_modules_dir(struct ldb_context *ldb, const char *path) +{ + talloc_free(ldb->modules_dir); + ldb->modules_dir = talloc_strdup(ldb, path); +} + static char *ldb_modules_strdup_no_spaces(TALLOC_CTX *mem_ctx, const char *string) { int i, len; @@ -203,21 +209,12 @@ int ldb_try_load_dso(struct ldb_context *ldb, const char *name) char *path; void *handle; int (*init_fn) (void); - char *modulesdir; - if (getenv("LD_LDB_MODULE_PATH") != NULL) { - modulesdir = talloc_strdup(ldb, getenv("LD_LDB_MODULE_PATH")); - } else { -#ifdef _SAMBA_BUILD_ - modulesdir = talloc_asprintf(ldb, "%s/ldb", dyn_MODULESDIR); -#else - modulesdir = talloc_strdup(ldb, MODULESDIR); -#endif - } - - path = talloc_asprintf(ldb, "%s/%s.%s", modulesdir, name, SHLIBEXT); + if (ldb->modules_dir == NULL) + return -1; - talloc_free(modulesdir); + path = talloc_asprintf(ldb, "%s/%s.%s", ldb->modules_dir, name, + SHLIBEXT); ldb_debug(ldb, LDB_DEBUG_TRACE, "trying to load %s from %s\n", name, path); -- cgit