openldap-switch-to-lt_dlopenadvise-to-get-RTLD_GLOBAL-set.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From: Jan-Marek Glogowski <jan-marek.glogowski@muenchen.de>
  2. Date: Tue, 18 May 2010 17:47:05 +0200
  3. Subject: [PATCH] Switch to lt_dlopenadvise() to get RTLD_GLOBAL set.
  4. Proof of concept for fixing http://bugs.debian.org/327585
  5. (patch ported from freeradius bug http://bugs.debian.org/416266)
  6. Resolves: #960048
  7. ---
  8. --- openldap/servers/slapd/module.c.orig 2010-05-18 17:42:04.000000000 +0200
  9. +++ openldap/servers/slapd/module.c 2010-05-18 17:45:46.000000000 +0200
  10. @@ -117,6 +117,20 @@
  11. return -1; /* not found */
  12. }
  13. +static lt_dlhandle slapd_lt_dlopenext_global( const char *filename )
  14. +{
  15. + lt_dlhandle handle = 0;
  16. + lt_dladvise advise;
  17. +
  18. + if (!lt_dladvise_init (&advise) && !lt_dladvise_ext (&advise)
  19. + && !lt_dladvise_global (&advise))
  20. + handle = lt_dlopenadvise (filename, advise);
  21. +
  22. + lt_dladvise_destroy (&advise);
  23. +
  24. + return handle;
  25. +}
  26. +
  27. int module_load(const char* file_name, int argc, char *argv[])
  28. {
  29. module_loaded_t *module;
  30. @@ -180,7 +194,7 @@
  31. * to calling Debug. This is because Debug is a macro that expands
  32. * into multiple function calls.
  33. */
  34. - if ((module->lib = lt_dlopenext(file)) == NULL) {
  35. + if ((module->lib = slapd_lt_dlopenext_global(file)) == NULL) {
  36. error = lt_dlerror();
  37. #ifdef HAVE_EBCDIC
  38. strcpy( ebuf, error );