1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-22 05:57:43 +03:00

third_party: Update nss_wrapper to version 1.1.7

This adds missing support for Address Sanitzer.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Nov 14 23:50:06 UTC 2019 on sn-devel-184
This commit is contained in:
Andreas Schneider 2019-11-13 15:41:47 +01:00 committed by Jeremy Allison
parent 4320196977
commit 8e8313b2b5
3 changed files with 59 additions and 36 deletions

View File

@ -29,7 +29,7 @@ Build.BuildContext.CHECK_SOCKET_WRAPPER = CHECK_SOCKET_WRAPPER
@conf
def CHECK_NSS_WRAPPER(conf):
return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.6')
return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.7')
Build.BuildContext.CHECK_NSS_WRAPPER = CHECK_NSS_WRAPPER
@conf

View File

@ -243,9 +243,18 @@ enum nwrap_dbglvl_e {
NWRAP_LOG_TRACE
};
#ifdef NDEBUG
# define NWRAP_LOG(...)
#ifndef HAVE_GETPROGNAME
static const char *getprogname(void)
{
#if defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME)
return program_invocation_short_name;
#elif defined(HAVE_GETEXECNAME)
return getexecname();
#else
return NULL;
#endif /* HAVE_PROGRAM_INVOCATION_SHORT_NAME */
}
#endif /* HAVE_GETPROGNAME */
static void nwrap_log(enum nwrap_dbglvl_e dbglvl, const char *func, const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
# define NWRAP_LOG(dbglvl, ...) nwrap_log((dbglvl), __func__, __VA_ARGS__)
@ -258,43 +267,49 @@ static void nwrap_log(enum nwrap_dbglvl_e dbglvl,
va_list va;
const char *d;
unsigned int lvl = 0;
int pid = getpid();
const char *prefix = "NWRAP";
const char *progname = getprogname();
d = getenv("NSS_WRAPPER_DEBUGLEVEL");
if (d != NULL) {
lvl = atoi(d);
}
if (lvl < dbglvl) {
return;
}
va_start(va, format);
vsnprintf(buffer, sizeof(buffer), format, va);
va_end(va);
if (lvl >= dbglvl) {
switch (dbglvl) {
case NWRAP_LOG_ERROR:
fprintf(stderr,
"NWRAP_ERROR(%d) - %s: %s\n",
pid, func, buffer);
break;
case NWRAP_LOG_WARN:
fprintf(stderr,
"NWRAP_WARN(%d) - %s: %s\n",
pid, func, buffer);
break;
case NWRAP_LOG_DEBUG:
fprintf(stderr,
"NWRAP_DEBUG(%d) - %s: %s\n",
pid, func, buffer);
break;
case NWRAP_LOG_TRACE:
fprintf(stderr,
"NWRAP_TRACE(%d) - %s: %s\n",
pid, func, buffer);
break;
}
switch (dbglvl) {
case NWRAP_LOG_ERROR:
prefix = "NWRAP_ERROR";
break;
case NWRAP_LOG_WARN:
prefix = "NWRAP_WARN";
break;
case NWRAP_LOG_DEBUG:
prefix = "NWRAP_DEBUG";
break;
case NWRAP_LOG_TRACE:
prefix = "NWRAP_TRACE";
break;
}
if (progname == NULL) {
progname = "<unknown>";
}
fprintf(stderr,
"%s[%s (%u)] - %s: %s\n",
prefix,
progname,
(unsigned int)getpid(),
func,
buffer);
}
#endif /* NDEBUG NWRAP_LOG */
struct nwrap_libc_fns {
struct passwd *(*_libc_getpwnam)(const char *name);
@ -824,7 +839,6 @@ enum nwrap_lib {
NWRAP_LIBSOCKET,
};
#ifndef NDEBUG
static const char *nwrap_str_lib(enum nwrap_lib lib)
{
switch (lib) {
@ -839,7 +853,6 @@ static const char *nwrap_str_lib(enum nwrap_lib lib)
/* Compiler would warn us about unhandled enum value if we get here */
return "unknown";
}
#endif
static void *nwrap_load_lib_handle(enum nwrap_lib lib)
{
@ -848,15 +861,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) {

View File

@ -2,7 +2,7 @@
import os
VERSION="1.1.6"
VERSION="1.1.7"
def configure(conf):
if conf.CHECK_NSS_WRAPPER():