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

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