mrc0mmand / rpms / openldap

Forked from rpms/openldap 3 years ago
Clone

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

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