aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-11-28 09:20:58 +0100
committerAndreas Schneider <asn@samba.org>2019-02-12 16:54:18 +0100
commite7c9380faf0f0557c202119f960026f8700667ee (patch)
tree92bb44566c67d98056f8437a24608ec6d0d5da48 /src
parentcf436b6d3e1d2c85d47e76e19519e36672ac93b8 (diff)
downloadsocket_wrapper-e7c9380faf0f0557c202119f960026f8700667ee.tar.gz
socket_wrapper-e7c9380faf0f0557c202119f960026f8700667ee.tar.xz
socket_wrapper-e7c9380faf0f0557c202119f960026f8700667ee.zip
swrap: Add env variable to disable deep binding
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'src')
-rw-r--r--src/socket_wrapper.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index ca0a833..f9993a2 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -587,15 +587,25 @@ static void *swrap_load_lib_handle(enum swrap_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("SOCKET_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) {