The branch, master has been updated via 2c754bf Update TODO via f767c52 doc: Add description for NSS_WRAPPER_DISABLE_DEEPBIND via abaae7a nwrap: Add NSS_WRAPPER_DISABLE_DEEPBIND env variable from c18484e Bump version to 1.1.6
https://git.samba.org/?p=nss_wrapper.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 2c754bf4e36a6d6ea4670dc587be8ba92c50d2fd Author: Andreas Schneider <a...@samba.org> Date: Thu Jun 13 17:09:15 2019 +0200 Update TODO Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit f767c52eec4f6121763b30d1bf2f39c6466acafb Author: Andreas Schneider <a...@samba.org> Date: Tue May 21 08:29:12 2019 +0200 doc: Add description for NSS_WRAPPER_DISABLE_DEEPBIND Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit abaae7a89c215c6c88e81b9b2251a9284e629b4b Author: Andreas Schneider <a...@samba.org> Date: Tue May 21 08:30:53 2019 +0200 nwrap: Add NSS_WRAPPER_DISABLE_DEEPBIND env variable Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> ----------------------------------------------------------------------- Summary of changes: TODO | 2 +- doc/nss_wrapper.1 | 19 +++++++++++++++---- doc/nss_wrapper.1.txt | 8 +++++++- src/nss_wrapper.c | 20 +++++++++++++++----- 4 files changed, 38 insertions(+), 11 deletions(-) Changeset truncated at 500 lines: diff --git a/TODO b/TODO index a83f850..f0a31ab 100644 --- a/TODO +++ b/TODO @@ -3,7 +3,7 @@ TODO Library -------- -* None at the moment. +* Replace hcreate() as it messes with applications also using it. Testing -------- diff --git a/doc/nss_wrapper.1 b/doc/nss_wrapper.1 index 940438d..3ef5a89 100644 --- a/doc/nss_wrapper.1 +++ b/doc/nss_wrapper.1 @@ -1,13 +1,13 @@ '\" t .\" Title: nss_wrapper -.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] -.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> -.\" Date: 2015-09-12 +.\" Author: Samba Team +.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> +.\" Date: 2019-05-21 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "NSS_WRAPPER" "1" "2015\-09\-12" "\ \&" "\ \&" +.TH "NSS_WRAPPER" "1" "2019\-05\-21" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -162,6 +162,11 @@ If you need to see what is going on in nss_wrapper itself or try to find a bug, 3 = TRACE .RE .RE +.PP +\fBNSS_WRAPPER_DISABLE_DEEPBIND\fR +.RS 4 +This allows you to disable deep binding in nss_wrapper\&. This is useful for running valgrind tools or sanitizers like (address, undefined, thread)\&. +.RE .SH "EXAMPLE" .sp .if n \{\ @@ -181,3 +186,9 @@ test\&.example\&.org .if n \{\ .RE .\} +.SH "AUTHOR" +.PP +\fBSamba Team\fR +.RS 4 +Author. +.RE diff --git a/doc/nss_wrapper.1.txt b/doc/nss_wrapper.1.txt index d541e31..4811dde 100644 --- a/doc/nss_wrapper.1.txt +++ b/doc/nss_wrapper.1.txt @@ -1,6 +1,7 @@ nss_wrapper(1) ============== -:revdate: 2015-09-12 +:revdate: 2019-05-21 +:author: Samba Team NAME ---- @@ -90,6 +91,11 @@ debug symbols. - 2 = DEBUG - 3 = TRACE +*NSS_WRAPPER_DISABLE_DEEPBIND*:: + +This allows you to disable deep binding in nss_wrapper. This is useful for +running valgrind tools or sanitizers like (address, undefined, thread). + EXAMPLE ------- 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) { -- NSS Wrapper Repository