.\" Title: socket_wrapper
.\" Author: Samba Team
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 2018-06-26
+.\" Date: 2018-11-28
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "SOCKET_WRAPPER" "1" "2018\-06\-26" "\ \&" "\ \&"
+.TH "SOCKET_WRAPPER" "1" "2018\-11\-28" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
3 = TRACE
.RE
.RE
+.PP
+\fBSOCKET_WRAPPER_DISABLE_DEEPBIND\fR
+.RS 4
+This allows you to disable deep binding in socket_wrapper\&. This is useful for running valgrind tools or sanitizers like (address, undefined, thread)\&.
+.RE
.SH "EXAMPLE"
.sp
.if n \{\
socket_wrapper(1)
=================
-:revdate: 2018-06-26
+:revdate: 2018-11-28
:author: Samba Team
NAME
- 2 = DEBUG
- 3 = TRACE
+*SOCKET_WRAPPER_DISABLE_DEEPBIND*::
+
+This allows you to disable deep binding in socket_wrapper. This is useful for
+running valgrind tools or sanitizers like (address, undefined, thread).
+
EXAMPLE
-------
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) {