components/samba/patches/ldap-libs.patch
author Jiri Sasek <Jiri.Sasek@Oracle.COM>
Tue, 26 Jul 2016 07:41:05 -0700
changeset 6477 346bfca0ae26
parent 6096 d24ce417bac1
permissions -rw-r--r--
24354183 Samba: Update to 4.4.5 24302327 problem in UTILITY/SAMBA

Source: in-house
Up-stream Acceptability: Patch is fixing the names of "ldap" and "lber" libs
   which are "hard-wired" to "libldap.so" and "liblber.so" in upstream.
   Patch will be promoted to community.

--- a/source3/wscript	2016-03-22 02:00:33.000000000 -0700
+++ samba-4.4.0/source3/wscript	2016-03-23 12:43:02.236160369 -0700
@@ -36,6 +36,16 @@
                          "--with-shared-modules"),
                    action="store", dest='shared_modules', default=None)
 
+
+    opt.add_option('--with-libldap',
+                   help=("Name of the libldap for -l<libname> format."),
+                   action="store", dest='libldap_name', default='ldap')
+
+    # mozldap has lber-calls part of the libldap so it should be also set on ldap60 to avoid link of lber from OpenLDAP
+    opt.add_option('--with-liblber',
+                   help=("Name of the liblber for -l<libname> format."),
+                   action="store", dest='liblber_name', default='lber')
+
     opt.SAMBA3_ADD_OPTION('winbind')
     opt.SAMBA3_ADD_OPTION('ads')
     opt.SAMBA3_ADD_OPTION('ldap')
@@ -664,7 +673,7 @@
     if Options.options.with_ldap:
         conf.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
         conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
-        conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
+        conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', Options.options.liblber_name )
         conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
 
         # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
@@ -672,8 +681,8 @@
         conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
                             define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
 
-        conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
-        conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
+        conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', Options.options.libldap_name )
+        conf.CHECK_FUNCS_IN('ldap_add_result_entry', Options.options.libldap_name )
 
         # Check if ldap_set_rebind_proc() takes three arguments
         if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
@@ -694,6 +703,25 @@
             if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
                     conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
                 conf.DEFINE('HAVE_LDAP_SASL_WRAPPING', '1')
+            # fix the conf.TARGET_TYPE and conf.LIB_... items
+            if 'ldap' != Options.options.libldap_name:
+                conf.SET_TARGET_TYPE('ldap', 'SYSLIB')
+                #conf.SET_TARGET_TYPE(Options.options.libldap_name, 'EMPTY')
+                conf.define('HAVE_LIBLDAP', 1)
+                conf.undefine('HAVE_LIB%s' % Options.options.libldap_name.upper().replace('-','_'))
+                conf.define('LIB_LDAP', Options.options.libldap_name)
+                conf.undefine('LIB_%s' % Options.options.libldap_name.upper().replace('-','_'))
+                #conf.define('LIB_ldap', [ Options.options.libldap_name ] )
+                #conf.undefine('LIB_%s' % Options.options.libldap_name.replace('-','_'))
+            if 'lber' != Options.options.liblber_name:
+                conf.SET_TARGET_TYPE('lber', 'SYSLIB')
+                #conf.SET_TARGET_TYPE(Options.options.liblber_name, 'EMPTY')
+                conf.define('HAVE_LIBLBER', 1)
+                conf.undefine('HAVE_LIB%s' % Options.options.liblber_name.upper().replace('-','_'))
+                conf.define('LIB_LBER', Options.options.liblber_name)
+                conf.undefine('LIB_%s' % Options.options.liblber_name.upper().replace('-','_'))
+                #conf.define('LIB_lber', [ Options.options.liblber_name ] )
+                #conf.undefine('LIB_%s' % Options.options.liblber_name.replace('-','_'))
         else:
             conf.fatal("LDAP support not found. "
                        "Try installing libldap2-dev or openldap-devel. "