aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2019-05-21 08:30:53 +0200
committerAndreas Schneider <asn@samba.org>2019-07-11 22:13:06 +0200
commitabaae7a89c215c6c88e81b9b2251a9284e629b4b (patch)
treebc2b19ea00e0621bccccb5cfc1181da529f3f262
parentc18484ec4f20da846a7673a415a1b4db8bc144e8 (diff)
downloadnss_wrapper-abaae7a89c215c6c88e81b9b2251a9284e629b4b.tar.gz
nss_wrapper-abaae7a89c215c6c88e81b9b2251a9284e629b4b.tar.xz
nss_wrapper-abaae7a89c215c6c88e81b9b2251a9284e629b4b.zip
nwrap: Add NSS_WRAPPER_DISABLE_DEEPBIND env variable
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r--src/nss_wrapper.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c
index 62c7af1..33b610b 100644
--- a/src/nss_wrapper.c
+++ b/src/nss_wrapper.c
@@ -848,15 +848,25 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
int i;
#ifdef RTLD_DEEPBIND
- const char *env = getenv("LD_PRELOAD");
+ const char *env_preload = getenv("LD_PRELOAD");
+ const char *env_deepbind = getenv("NSS_WRAPPER_DISABLE_DEEPBIND");
+ bool enable_deepbind = true;
/* Don't do a deepbind if we run with libasan */
- if (env != NULL && strlen(env) < 1024) {
- const char *p = strstr(env, "libasan.so");
- if (p == NULL) {
- flags |= RTLD_DEEPBIND;
+ if (env_preload != NULL && strlen(env_preload) < 1024) {
+ const char *p = strstr(env_preload, "libasan.so");
+ if (p != NULL) {
+ enable_deepbind = false;
}
}
+
+ if (env_deepbind != NULL && strlen(env_deepbind) >= 1) {
+ enable_deepbind = false;
+ }
+
+ if (enable_deepbind) {
+ flags |= RTLD_DEEPBIND;
+ }
#endif
switch (lib) {