Switch to lt_dlopenadvise() so back_perl can be opened with RTLD_GLOBAL. Open all...
authorJan-Marek Glogowski <jan-marek.glogowski@muenchen.de>
Tue, 18 May 2010 15:47:05 +0000 (17:47 +0200)
committerRyan Tandy <ryan@nardis.ca>
Sat, 14 Jan 2023 00:29:59 +0000 (00:29 +0000)
Bug-Debian: http://bugs.debian.org/327585

Gbp-Pq: Name switch-to-lt_dlopenadvise-to-get-RTLD_GLOBAL-set.diff

servers/slapd/module.c

index 048ce8d3fcfc68f4d72f5cb7d840ae2b8f77af46..81e010acba182a5e186bb2ad53a7936512a65569 100644 (file)
@@ -117,6 +117,20 @@ int module_unload( const char *file_name )
        return -1;      /* not found */
 }
 
+static lt_dlhandle slapd_lt_dlopenext_global( const char *filename )
+{
+       lt_dlhandle handle = 0;
+       lt_dladvise advise;
+
+       if (!lt_dladvise_init (&advise) && !lt_dladvise_ext (&advise)
+                       && !lt_dladvise_global (&advise))
+               handle = lt_dlopenadvise (filename, advise);
+
+       lt_dladvise_destroy (&advise);
+
+       return handle;
+}
+
 int module_load(const char* file_name, int argc, char *argv[])
 {
        module_loaded_t *module;
@@ -179,7 +193,7 @@ int module_load(const char* file_name, int argc, char *argv[])
         * to calling Debug. This is because Debug is a macro that expands
         * into multiple function calls.
         */
-       if ((module->lib = lt_dlopenext(file)) == NULL) {
+       if ((module->lib = slapd_lt_dlopenext_global(file)) == NULL) {
                error = lt_dlerror();
 #ifdef HAVE_EBCDIC
                strcpy( ebuf, error );