From 866a3b6e40952193d5bcd812ec7079cf7434e600 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 15 Nov 2006 17:34:20 +0000 Subject: r19725: sync samba3's ldb with samba4 metze (This used to be commit 207643e9c9c75546f38a09f12ea0b574b08086c5) --- source3/lib/ldb/common/ldb_modules.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source3/lib/ldb/common/ldb_modules.c') diff --git a/source3/lib/ldb/common/ldb_modules.c b/source3/lib/ldb/common/ldb_modules.c index 8bcafa36a8b..a6997b324a1 100644 --- a/source3/lib/ldb/common/ldb_modules.c +++ b/source3/lib/ldb/common/ldb_modules.c @@ -159,6 +159,7 @@ static const struct ldb_module_ops *ldb_find_module_ops(const char *name) ldb_objectclass_init, \ ldb_paged_results_init, \ ldb_sort_init, \ + ldb_asq_init, \ NULL \ } #endif @@ -205,17 +206,26 @@ int ldb_try_load_dso(struct ldb_context *ldb, const char *name) char *path; void *handle; int (*init_fn) (void); + char *modulesdir; #ifdef HAVE_DLOPEN + if (getenv("LD_LDB_MODULE_PATH") != NULL) { + modulesdir = talloc_strdup(ldb, getenv("LD_LDB_MODULE_PATH")); + } else { #ifdef _SAMBA_BUILD_ - path = talloc_asprintf(ldb, "%s/ldb/%s.%s", dyn_MODULESDIR, name, dyn_SHLIBEXT); + modulesdir = talloc_asprintf(ldb, "%s/ldb", dyn_MODULESDIR); #else - path = talloc_asprintf(ldb, "%s/%s.%s", MODULESDIR, name, SHLIBEXT); + modulesdir = talloc_strdup(ldb, MODULESDIR); #endif + } + + path = talloc_asprintf(ldb, "%s/%s.%s", modulesdir, name, SHLIBEXT); + + talloc_free(modulesdir); ldb_debug(ldb, LDB_DEBUG_TRACE, "trying to load %s from %s\n", name, path); - handle = dlopen(path, 0); + handle = dlopen(path, RTLD_NOW); if (handle == NULL) { ldb_debug(ldb, LDB_DEBUG_WARNING, "unable to load %s from %s: %s\n", name, path, dlerror()); return -1; -- cgit