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

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