summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-12-08 09:41:25 +1100
committerAndrew Tridgell <tridge@samba.org>2010-12-08 05:26:05 +0100
commitcba73975c2868bb657962229c0c5e77009c0197d (patch)
tree241844b77b8a7014dca36f12ae8ed123173db592 /source4
parent591e18a12c2b6641351f22579c76aee34f2ceb12 (diff)
downloadsamba-cba73975c2868bb657962229c0c5e77009c0197d.tar.gz
samba-cba73975c2868bb657962229c0c5e77009c0197d.tar.bz2
samba-cba73975c2868bb657962229c0c5e77009c0197d.zip
s4-ldb: use RTLD_DEEPBIND if available for ldb modules
this allows us to avoid issues with ldb using heimdal while an application using ldb using MIT kerberos Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/common/ldb_modules.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index e330137140..b382a91ec8 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -858,6 +858,7 @@ static int ldb_modules_load_path(const char *path, const char *version)
dev_t st_dev;
} *loaded;
struct loaded *le;
+ int dlopen_flags;
ret = stat(path, &st);
if (ret != 0) {
@@ -889,7 +890,18 @@ static int ldb_modules_load_path(const char *path, const char *version)
return ldb_modules_load_dir(path, version);
}
- handle = dlopen(path, RTLD_NOW);
+ dlopen_flags = RTLD_NOW;
+#ifdef RTLD_DEEPBIND
+ /* use deepbind if possible, to avoid issues with different
+ system library varients, for example ldb modules may be linked
+ against Heimdal while the application may use MIT kerberos
+
+ See the dlopen manpage for details
+ */
+ dlopen_flags |= RTLD_DEEPBIND;
+#endif
+
+ handle = dlopen(path, dlopen_flags);
if (handle == NULL) {
fprintf(stderr, "ldb: unable to dlopen %s : %s\n", path, dlerror());
return LDB_SUCCESS;