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

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