The branch, master has been updated via 05f50d2 Bump version to 1.1.5 via 7799438 nwrap: Do not call nwrap_init() in the constructor via bab893a nwrap: Call exit() if something goes wrong during initialization via 92c1b22 nwrap: Use calloc in nwrap_libc_init() from 8963f3f Bump version to 1.1.4
https://git.samba.org/?p=nss_wrapper.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 05f50d22e0219baf6152f1540db3a3765f095950 Author: Andreas Schneider <a...@samba.org> Date: Wed Oct 31 13:23:30 2018 +0100 Bump version to 1.1.5 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 7799438252cd152fa44ea56b736862fb9bf507a6 Author: Andreas Schneider <a...@samba.org> Date: Wed Oct 31 11:11:05 2018 +0100 nwrap: Do not call nwrap_init() in the constructor Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit bab893a851c1c9291b148522c2790e887bf77bc1 Author: Andreas Schneider <a...@samba.org> Date: Wed Oct 31 11:10:37 2018 +0100 nwrap: Call exit() if something goes wrong during initialization Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 92c1b223275ac49c7af3275c6fb480164841eead Author: Andreas Schneider <a...@samba.org> Date: Wed Oct 31 11:10:08 2018 +0100 nwrap: Use calloc in nwrap_libc_init() Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> ----------------------------------------------------------------------- Summary of changes: CMakeLists.txt | 4 ++-- ChangeLog | 3 +++ src/nss_wrapper.c | 23 ++++++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-) Changeset truncated at 500 lines: diff --git a/CMakeLists.txt b/CMakeLists.txt index bbdba4c..e91c266 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME}) set(APPLICATION_VERSION_MAJOR "1") set(APPLICATION_VERSION_MINOR "1") -set(APPLICATION_VERSION_PATCH "4") +set(APPLICATION_VERSION_PATCH "5") set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}") @@ -19,7 +19,7 @@ set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINO # Increment AGE. Set REVISION to 0 # If the source code was changed, but there were no interface changes: # Increment REVISION. -set(LIBRARY_VERSION "0.2.4") +set(LIBRARY_VERSION "0.2.5") set(LIBRARY_SOVERSION "0") # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked diff --git a/ChangeLog b/ChangeLog index 46ef626..b158baf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ ChangeLog ========== +version 1.1.5 (released 2018-10-31) + * Fixed running on older distributions + version 1.1.4 (released 2018-10-31) * Fixed module getpw* functions * Fixed nss_wrapper.pl to use correct perl binary diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c index dd16fe6..81d900c 100644 --- a/src/nss_wrapper.c +++ b/src/nss_wrapper.c @@ -218,8 +218,11 @@ static pthread_mutex_t nwrap_sp_global_mutex = PTHREAD_MUTEX_INITIALIZER; NWRAP_UNLOCK(nwrap_initialized); \ } while (0); +static void nwrap_init(void); + static void nwrap_thread_prepare(void) { + nwrap_init(); NWRAP_LOCK_ALL; } @@ -806,7 +809,6 @@ static struct nwrap_he nwrap_he_global; * NWRAP PROTOTYPES *********************************************************/ -static void nwrap_init(void); static bool nwrap_gr_parse_line(struct nwrap_cache *nwrap, char *line); static void nwrap_gr_unload(struct nwrap_cache *nwrap); void nwrap_constructor(void) CONSTRUCTOR_ATTRIBUTE; @@ -1512,19 +1514,17 @@ static bool nwrap_module_init(const char *name, static void nwrap_libc_init(struct nwrap_main *r) { - r->libc = malloc(sizeof(struct nwrap_libc)); + r->libc = calloc(1, sizeof(struct nwrap_libc)); if (r->libc == NULL) { printf("Failed to allocate memory for libc"); exit(-1); } - ZERO_STRUCTP(r->libc); - r->libc->fns = malloc(sizeof(struct nwrap_libc_fns)); + r->libc->fns = calloc(1, sizeof(struct nwrap_libc_fns)); if (r->libc->fns == NULL) { printf("Failed to allocate memory for libc functions"); exit(-1); } - ZERO_STRUCTP(r->libc->fns); } static void nwrap_backend_init(struct nwrap_main *r) @@ -1565,6 +1565,7 @@ static void nwrap_init(void) const char *env; char *endptr; size_t max_hostents_tmp; + int ok; NWRAP_LOCK(nwrap_initialized); if (nwrap_initialized) { @@ -1604,10 +1605,11 @@ static void nwrap_init(void) NWRAP_LOG(NWRAP_LOG_DEBUG, "Initializing hash table of size %lu items.", (unsigned long)max_hostents); - if (hcreate(max_hostents) == 0) { + ok = hcreate(max_hostents); + if (!ok) { NWRAP_LOG(NWRAP_LOG_ERROR, "Failed to initialize hash table"); - goto done; + exit(-1); } nwrap_main_global = &__nwrap_main_global; @@ -1658,7 +1660,6 @@ static void nwrap_init(void) nwrap_he_global.cache->parse_line = nwrap_he_parse_line; nwrap_he_global.cache->unload = nwrap_he_unload; -done: /* We hold all locks here so we can use NWRAP_UNLOCK_ALL. */ NWRAP_UNLOCK_ALL; } @@ -5575,11 +5576,7 @@ void nwrap_constructor(void) &nwrap_thread_parent, &nwrap_thread_child); - /* - * Here is safe place to call nwrap_init() and initialize data - * for the main process. - */ - nwrap_init(); + /* Do not call nwrap_init() here. */ } /**************************** -- NSS Wrapper Repository