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

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