1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/nsswitch/libwbclient/wscript
Ralph Boehme 642a4452ce nsswitch: leverage TLS if available in favour over global locking
The global locking can lead to deadlocks when using nscd: when processing the
first request in winbind, when we know we call into code that will recurse into
winbind we call winbind_off() which sets an environment variable which is later
checked here in the nsswitch module.

But with nscd in the stack, we don't see the env variable in nsswitch, so when
we try to acquire the global lock again, it is already locked and we deadlock.

By using a thread specific winbindd_context, plus a few other thread local global
variables, we don't need a global lock anymore.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-01-05 11:33:37 +00:00

62 lines
2.3 KiB
Python

#!/usr/bin/env python
from waflib import Options, Logs
# Remember to also update wbclient.h
VERSION="0.16"
# It may be useful at some point to allow Samba to build against a
# system libwbclient, such as the one provided by Likewise. To to
# this, not only must the check below be activated but this must only
# be activated with an off-by-default option to disable the internal
# build of both winbindd implementations, and all the internal
# references to libwbclient.h will need to be fixed to point at the
# system libwbclient. Finally, as a system libwbclient would probably
# not use the same version scheme as Samba, so this would need to
# reference Likewise version numbers instead.
#
#def configure(conf):
# if conf.CHECK_BUNDLED_SYSTEM_PKG('wbclient', minversion=VERSION):
# conf.define('USING_SYSTEM_LIBWBCLIENT', 1)
#
def build(bld):
# if bld.CONFIG_SET('USING_SYSTEM_LIBWBCLIENT'):
# Logs.info("\tSelected system libwbclient build")
# return
#
# Logs.info("\tSelected embedded libwbclient build")
wbclient_internal_deps = 'replace'
if bld.CONFIG_SET('HAVE_PTHREAD'):
wbclient_internal_deps += ' pthread'
bld.SAMBA_SUBSYSTEM('wbclient-internal',
source='../wb_common.c',
deps=wbclient_internal_deps,
cflags='-DWINBINDD_SOCKET_DIR=\"%s\"' % bld.env.WINBINDD_SOCKET_DIR,
hide_symbols=True,
provide_builtin_linking=True,
builtin_cflags='-DWINBINDD_SOCKET_DIR=\"%s\"' % bld.env.WINBINDD_SOCKET_DIR,
)
abi_match = 'wbc*'
bld.SAMBA_LIBRARY('wbclient',
source='''
wbc_guid.c
wbc_idmap.c
wbclient.c
wbc_pam.c
wbc_pwd.c
wbc_sid.c
wbc_util.c''',
hide_symbols=True,
deps='wbclient-internal smb_strtox',
require_builtin_deps=True,
provide_builtin_linking=True,
pc_files='wbclient.pc',
public_headers='wbclient.h',
abi_directory='ABI',
abi_match=abi_match,
vnum=VERSION)