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

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