]> git.ipfire.org Git - thirdparty/samba.git/commit
nsswitch: leverage TLS if available in favour over global locking
authorRalph Boehme <slow@samba.org>
Sun, 6 Nov 2022 15:57:27 +0000 (16:57 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 5 Jan 2023 11:33:37 +0000 (11:33 +0000)
commit642a4452ce5b3333c50e41e54bc6ca779686ecc3
tree7830e79b07a4ae367d3a53f5fa37a3585ae6c1f8
parentae4a06f4b087c6b247f55716a4b3f59aaa333379
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>
nsswitch/libwbclient/wscript
nsswitch/wb_common.c