Blame SOURCES/openldap-switch-to-lt_dlopenadvise-to-get-RTLD_GLOBAL-set.patch

d0db73
From: Jan-Marek Glogowski <jan-marek.glogowski@muenchen.de>
d0db73
Date: Tue, 18 May 2010 17:47:05 +0200
d0db73
Subject: [PATCH] Switch to lt_dlopenadvise() to get RTLD_GLOBAL set.
d0db73
d0db73
Proof of concept for fixing http://bugs.debian.org/327585
d0db73
(patch ported from freeradius bug http://bugs.debian.org/416266)
d0db73
d0db73
Resolves: #960048
b11fe1
b11fe1
diff --git a/servers/slapd/module.c b/servers/slapd/module.c
b11fe1
index e616f1d..52bacff 100644
b11fe1
--- a/servers/slapd/module.c
b11fe1
+++ b/servers/slapd/module.c
b11fe1
@@ -117,6 +117,20 @@ int module_unload( const char *file_name )
d0db73
 	return -1;	/* not found */
d0db73
 }
d0db73
 
d0db73
+static lt_dlhandle slapd_lt_dlopenext_global( const char *filename )
d0db73
+{
d0db73
+	lt_dlhandle handle = 0;
d0db73
+	lt_dladvise advise;
d0db73
+
d0db73
+	if (!lt_dladvise_init (&advise) && !lt_dladvise_ext (&advise)
d0db73
+			&& !lt_dladvise_global (&advise))
d0db73
+		handle = lt_dlopenadvise (filename, advise);
d0db73
+
d0db73
+	lt_dladvise_destroy (&advise);
d0db73
+
d0db73
+	return handle;
d0db73
+}
d0db73
+
d0db73
 int module_load(const char* file_name, int argc, char *argv[])
d0db73
 {
d0db73
 	module_loaded_t *module;
b11fe1
@@ -179,7 +193,7 @@ int module_load(const char* file_name, int argc, char *argv[])
d0db73
 	 * to calling Debug. This is because Debug is a macro that expands
d0db73
 	 * into multiple function calls.
d0db73
 	 */
d0db73
-	if ((module->lib = lt_dlopenext(file)) == NULL) {
d0db73
+	if ((module->lib = slapd_lt_dlopenext_global(file)) == NULL) {
d0db73
 		error = lt_dlerror();
d0db73
 #ifdef HAVE_EBCDIC
d0db73
 		strcpy( ebuf, error );