in-house
promoted into the community:
################################################################################
From 06092e4728f53c90c7ead56f289d004c80c85f5d Mon Sep 17 00:00:00 2001
From: Jiri Sasek <Jiri.Sasek@Oracle.COM>
Date: Mon, 8 Aug 2016 14:32:02 +0200
Subject: [PATCH] Bug 12124
This is a small configuration change to allow to choose which LDAP C-SDK will be used
note: in case of the API do not reside in standard paths the appropriate "SYSLIB target"
should be added into the deps= of the target to ensure the appropriate "-I<alt.path>" or
"-L<alt.path>" flags will be available when compile/link.
In case of no pkg-config info is found libldap.so and liblber.so libs are searched in
standard library path.
Motivation:
On Solaris 11 there are 2 LDAP APIs:
- "legacy" DS 5 C-SDK represented by:
...mozldap has no lber lib. distiguished from ldap lib.
- new OpenLDAP C-SDK represented by:
...so the default one found by waf is the "wrong one".
---
lib/ldb/wscript | 2 +-
source3/auth/wscript_build | 2 +-
source3/librpc/wscript_build | 2 +-
source3/winbindd/wscript_build | 10 +++++-----
source3/wscript | 24 ++++++++++++++++--------
source3/wscript_build | 5 +++--
7 files changed, 29 insertions(+), 19 deletions(-)
index 5f35d77..ed3af9d 100644
@@ -454,7 +454,7 @@ def CHECK_CODE(conf, code, define,
@conf
def CHECK_STRUCTURE_MEMBER(conf, structname, member,
- always=False, define=None, headers=None):
+ always=False, define=None, headers=None, lib=None):
'''check for a structure member'''
if define is None:
define = 'HAVE_%s' % member.upper()
@@ -466,6 +466,7 @@ def CHECK_STRUCTURE_MEMBER(conf, structname, member,
always=always,
headers=headers,
local_include=False,
+ lib=lib,
msg="Checking for member %s in %s" % (member, structname))
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index 13f1d93..ce1eae0 100755
@@ -68,7 +68,7 @@ def configure(conf):
# we need this for the ldap backend
- if conf.CHECK_FUNCS_IN('ber_flush ldap_open ldap_initialize', 'lber ldap', headers='lber.h ldap.h'):
conf.env.ENABLE_LDAP_BACKEND = True
# we don't want any libraries or modules to rely on runtime
index e7a6051..ff170e9 100644
@@ -57,7 +57,7 @@ bld.SAMBA3_MODULE('auth_wbc',
bld.SAMBA3_MODULE('auth_domain',
subsystem='auth',
source='auth_domain.c',
- deps='RPC_CLIENT_SCHANNEL trusts_util',
+ deps='RPC_CLIENT_SCHANNEL trusts_util ldap',
init_function='',
internal_module=True)
index 2445859..9ed3407 100644
@@ -7,7 +7,7 @@ bld.SAMBA3_SUBSYSTEM('NDR_LIBNETAPI',
bld.SAMBA3_SUBSYSTEM('NDR_LIBNET_JOIN',
source='gen_ndr/ndr_libnet_join.c',
- public_deps='ndr krb5samba'
+ public_deps='ndr ldap krb5samba'
)
bld.SAMBA3_SUBSYSTEM('NDR_OPEN_FILES',
index 1a2c497..1f6de4c 100644
@@ -8,7 +8,7 @@ bld.SAMBA3_LIBRARY('idmap',
bld.SAMBA3_SUBSYSTEM('IDMAP_RW',
source='idmap_rw.c',
- deps='samba-util')
+ deps='samba-util ldap')
bld.SAMBA3_SUBSYSTEM('IDMAP_TDB_COMMON',
source='idmap_tdb_common.c',
@@ -16,7 +16,7 @@ bld.SAMBA3_SUBSYSTEM('IDMAP_TDB_COMMON',
bld.SAMBA3_SUBSYSTEM('IDMAP_HASH',
source='idmap_hash/idmap_hash.c idmap_hash/mapfile.c',
- deps='samba-util krb5samba',
+ deps='samba-util krb5samba ldap',
enabled=bld.SAMBA3_IS_ENABLED_MODULE('idmap_hash'))
bld.SAMBA3_SUBSYSTEM('IDMAP_AD',
@@ -70,7 +70,7 @@ bld.SAMBA3_MODULE('idmap_ldap',
bld.SAMBA3_MODULE('idmap_nss',
subsystem='idmap',
source='idmap_nss.c',
- deps='samba-util',
+ deps='samba-util ldap',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('idmap_nss'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('idmap_nss'))
@@ -78,7 +78,7 @@ bld.SAMBA3_MODULE('idmap_nss',
bld.SAMBA3_MODULE('idmap_tdb',
subsystem='idmap',
source='idmap_tdb.c',
- deps='samba-util tdb IDMAP_TDB_COMMON',
+ deps='samba-util tdb IDMAP_TDB_COMMON ldap',
init_function='',
allow_undefined_symbols=True,
internal_module=bld.SAMBA3_IS_STATIC_MODULE('idmap_tdb'),
@@ -122,7 +122,7 @@ bld.SAMBA3_LIBRARY('nss_info',
bld.SAMBA3_MODULE('nss_info_template',
subsystem='nss_info',
source='nss_info_template.c',
- deps='samba-util krb5samba',
+ deps='samba-util krb5samba ldap',
init_function='',
internal_module=bld.SAMBA3_IS_STATIC_MODULE('nss_info_template'),
enabled=bld.SAMBA3_IS_ENABLED_MODULE('nss_info_template'))
diff --git a/source3/wscript b/source3/wscript
index 497b673..88169be 100644
@@ -666,24 +666,32 @@ msg.msg_accrightslen = sizeof(fd);
# Check for LDAP
- conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
- conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
+ if conf.CHECK_CFG(package='ldap', args="--cflags --libs", msg='Check for ldap', uselib_store="LDAP") :
+ conf.SET_TARGET_TYPE('ldap', 'SYSLIB')
+ else :
+ conf.CHECK_LIB('ldap', shlib=True)
+ if conf.CHECK_CFG(package='lber', args="--cflags --libs", msg='Check for lber', uselib_store="LBER") :
+ conf.SET_TARGET_TYPE('lber', 'SYSLIB')
+ else :
+ conf.CHECK_LIB('lber', shlib=True)
+ conf.CHECK_FUNCS('ber_scanf ber_sockbuf_add_io', lib='ldap lber')
+ conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h', lib='ldap')
# if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
# for the samba logs
conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
- define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
+ define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h', lib='ldap lber')
- 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('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', lib='ldap')
+ conf.CHECK_FUNCS('ldap_add_result_entry', lib='ldap')
# Check if ldap_set_rebind_proc() takes three arguments
if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
'LDAP_SET_REBIND_PROC_ARGS',
msg="Checking whether ldap_set_rebind_proc takes 3 arguments",
conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
else:
conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
diff --git a/source3/wscript_build b/source3/wscript_build
index edf921c..6011f72 100755
@@ -405,6 +405,7 @@ bld.SAMBA3_LIBRARY('libsmb',
deps='''
auth_generic
CLDAP
+ ldap
LIBNMB
SPNEGO_PARSE
LIBTSOCKET
@@ -464,7 +465,7 @@ bld.SAMBA3_SUBSYSTEM('LIBADS_SERVER',
bld.SAMBA3_SUBSYSTEM('LIBADS_PRINTER',
source='libads/ldap_printer.c',
- deps='samba-util krb5samba')
+ deps='samba-util krb5samba ldap')
bld.SAMBA3_LIBRARY('smbconf',
source='''lib/smbconf/smbconf_init.c
@@ -835,7 +836,7 @@ bld.SAMBA3_SUBSYSTEM('LIBCLI_WINREG_INTERNAL',
bld.SAMBA3_SUBSYSTEM('RPC_CLIENT_SCHANNEL',
source='rpc_client/cli_pipe_schannel.c',
- deps='samba-util krb5samba')
+ deps='samba-util krb5samba ldap')
bld.SAMBA3_SUBSYSTEM('INIT_LSA',
source='rpc_client/init_lsa.c',
--
2.6.1