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

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