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
d0db73
---
d0db73
--- openldap/servers/slapd/module.c.orig	2010-05-18 17:42:04.000000000 +0200
d0db73
+++ openldap/servers/slapd/module.c	2010-05-18 17:45:46.000000000 +0200
d0db73
@@ -117,6 +117,20 @@
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;
d0db73
@@ -180,7 +194,7 @@
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 );