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