Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-integ / recipes-support / openldap / files / 0011-openldap-switch-to-t_dlopenadvise-to-get-RTLD_GLOBAL.patch
1 From b0b00385bf7564fa39f711f958b90512559f7f70 Mon Sep 17 00:00:00 2001
2 From: babak sarashki <babak.sarashki@windriver.com>
3 Date: Sun, 3 Nov 2019 14:45:27 -0800
4 Subject: [PATCH 11/20] openldap switch to t_dlopenadvise to get RTLD_GLOBAL
5  set
6
7 From-stx-1901: openldap-switch-to-t_dlopenadvise-to-get-RTLD_GLOBAL-set.patch
8
9 From: Jan-Marek Glogowski <jan-marek.glogowski@muenchen.de>
10 Date: Tue, 18 May 2010 17:47:05 +0200
11 Subject: [PATCH] Switch to lt_dlopenadvise() to get RTLD_GLOBAL set.
12
13 Proof of concept for fixing http://bugs.debian.org/327585
14 (patch ported from freeradius bug http://bugs.debian.org/416266)
15
16 Resolves: #960048
17 ---
18  servers/slapd/module.c | 16 +++++++++++++++-
19  1 file changed, 15 insertions(+), 1 deletion(-)
20
21 diff --git a/servers/slapd/module.c b/servers/slapd/module.c
22 index 2a8aa0a..994b885 100644
23 --- a/servers/slapd/module.c
24 +++ b/servers/slapd/module.c
25 @@ -117,6 +117,20 @@ int module_unload( const char *file_name )
26         return -1;      /* not found */
27  }
28  
29 +static lt_dlhandle slapd_lt_dlopenext_global( const char *filename )
30 +{
31 +       lt_dlhandle handle = 0;
32 +       lt_dladvise advise;
33 +
34 +       if (!lt_dladvise_init (&advise) && !lt_dladvise_ext (&advise)
35 +                       && !lt_dladvise_global (&advise))
36 +               handle = lt_dlopenadvise (filename, advise);
37 +
38 +       lt_dladvise_destroy (&advise);
39 +
40 +       return handle;
41 +}
42 +
43  int module_load(const char* file_name, int argc, char *argv[])
44  {
45         module_loaded_t *module;
46 @@ -180,7 +194,7 @@ int module_load(const char* file_name, int argc, char *argv[])
47          * to calling Debug. This is because Debug is a macro that expands
48          * into multiple function calls.
49          */
50 -       if ((module->lib = lt_dlopenext(file)) == NULL) {
51 +       if ((module->lib = slapd_lt_dlopenext_global(file)) == NULL) {
52                 error = lt_dlerror();
53  #ifdef HAVE_EBCDIC
54                 strcpy( ebuf, error );
55 -- 
56 2.17.1
57