Hello community, here is the log from the commit of package nss_wrapper for openSUSE:Factory checked in at 2016-01-26 10:15:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nss_wrapper (Old) and /work/SRC/openSUSE:Factory/.nss_wrapper.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nss_wrapper" Changes: -------- --- /work/SRC/openSUSE:Factory/nss_wrapper/nss_wrapper.changes 2015-11-22 11:02:57.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.nss_wrapper.new/nss_wrapper.changes 2016-01-26 10:15:21.000000000 +0100 @@ -1,0 +2,9 @@ +Thu Jan 14 08:34:11 UTC 2016 - [email protected] + +- Update to version 1.1.2 + * Fixed segfault while reloading hosts file + * Fixed issue where are not fault tolerant if an alias has already + been added + * Fixed nss_wrapper build on Solaris + +------------------------------------------------------------------- Old: ---- nss_wrapper-1.1.0.tar.gz New: ---- nss_wrapper-1.1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nss_wrapper.spec ++++++ --- /var/tmp/diff_new_pack.rkxFqn/_old 2016-01-26 10:15:22.000000000 +0100 +++ /var/tmp/diff_new_pack.rkxFqn/_new 2016-01-26 10:15:22.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package nss_wrapper # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ ############################# NOTE ################################## Name: nss_wrapper -Version: 1.1.0 +Version: 1.1.2 Release: 0 Summary: A wrapper for the user, group and hosts NSS API ++++++ nss_wrapper-1.1.0.tar.gz -> nss_wrapper-1.1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nss_wrapper-1.1.0/CMakeLists.txt new/nss_wrapper-1.1.2/CMakeLists.txt --- old/nss_wrapper-1.1.0/CMakeLists.txt 2015-11-20 12:14:16.000000000 +0100 +++ new/nss_wrapper-1.1.2/CMakeLists.txt 2015-12-17 08:57:54.000000000 +0100 @@ -8,7 +8,7 @@ set(APPLICATION_VERSION_MAJOR "1") set(APPLICATION_VERSION_MINOR "1") -set(APPLICATION_VERSION_PATCH "0") +set(APPLICATION_VERSION_PATCH "2") set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}") @@ -19,7 +19,7 @@ # 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.0") +set(LIBRARY_VERSION "0.2.2") set(LIBRARY_SOVERSION "0") # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nss_wrapper-1.1.0/ChangeLog new/nss_wrapper-1.1.2/ChangeLog --- old/nss_wrapper-1.1.0/ChangeLog 2015-11-20 12:14:16.000000000 +0100 +++ new/nss_wrapper-1.1.2/ChangeLog 2015-12-17 09:00:25.000000000 +0100 @@ -1,6 +1,14 @@ ChangeLog ========== +version 1.1.2 (released 2015-12-17) + * Fixed segfault while reloading hosts file + * Fixed issue where are not fault tolerant if an alias has already + been added + +version 1.1.1 (released 2015-11-23) + * Fixed nss_wrapper build on Solaris + version 1.1.0 (released 2015-11-20) * Added support for initgroups() * Added support for shadow files (getspnam(), etc.) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nss_wrapper-1.1.0/src/nss_wrapper.c new/nss_wrapper-1.1.2/src/nss_wrapper.c --- old/nss_wrapper-1.1.0/src/nss_wrapper.c 2015-11-20 10:00:56.000000000 +0100 +++ new/nss_wrapper-1.1.2/src/nss_wrapper.c 2015-12-17 09:14:13.000000000 +0100 @@ -2622,12 +2622,14 @@ for (cursor = el; cursor->next != NULL; cursor = cursor->next) { if (cursor->ed == ed) { - return false; + /* The entry already exists in this list. */ + return true; } } if (cursor->ed == ed) { - return false; + /* The entry already exists in this list. */ + return true; } el_new = nwrap_entlist_init(ed); @@ -2888,6 +2890,7 @@ struct nwrap_entdata *ed; struct nwrap_entlist *el; size_t i; + int rc; nwrap_vector_foreach (ed, nwrap_he->entries, i) { @@ -2913,6 +2916,18 @@ nwrap_he->num = 0; nwrap_he->idx = 0; + + /* + * If we unload the file, the pointers in the hash table point to + * invalid memory. So we need to destroy the hash table and recreate + * it. + */ + hdestroy(); + rc = hcreate(max_hostents); + if (rc == 0) { + NWRAP_LOG(NWRAP_LOG_ERROR, "Failed to initialize hash table"); + exit(-1); + } } @@ -5578,7 +5593,9 @@ } free(user_addrlist.items); +#ifdef HAVE_GETHOSTBYNAME2 free(user_addrlist2.items); +#endif hdestroy(); NWRAP_UNLOCK_ALL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nss_wrapper-1.1.0/tests/hosts.in new/nss_wrapper-1.1.2/tests/hosts.in --- old/nss_wrapper-1.1.0/tests/hosts.in 2015-11-13 13:17:02.000000000 +0100 +++ new/nss_wrapper-1.1.2/tests/hosts.in 2015-12-17 08:30:50.000000000 +0100 @@ -5,7 +5,7 @@ ::13 beteigeuze.galaxy.site beteigeuze mail 127.0.0.14 krikkit.galaxy.site ::14 krikkit.galaxy.site -127.1.1.1 pumpkin.bunny.net +127.1.1.1 pumpkin.bunny.net pumpkin.bunny.net 127.0.0.66 pumpkin.bunny.net 2666::22 pumpkin.bunny.net DEAD:BEEF:1:2:3::4 pumpkin.bunny.net diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nss_wrapper-1.1.0/tests/test_getaddrinfo.c new/nss_wrapper-1.1.2/tests/test_getaddrinfo.c --- old/nss_wrapper-1.1.0/tests/test_getaddrinfo.c 2015-11-19 09:39:46.000000000 +0100 +++ new/nss_wrapper-1.1.2/tests/test_getaddrinfo.c 2015-12-17 09:14:14.000000000 +0100 @@ -5,8 +5,10 @@ #include <setjmp.h> #include <cmocka.h> +#include <errno.h> #include <stdio.h> #include <string.h> +#include <stdlib.h> #include <unistd.h> #include <sys/socket.h> @@ -83,6 +85,54 @@ freeaddrinfo(res); } +/* + * The purpose of this test is to verify that reloading of the hosts + * file (triggered by a timestamp change) correctly frees and re-creates + * the internal data structures, so we do not end up using invalid memory. + */ +static void test_nwrap_getaddrinfo_reload(void **state) +{ + struct addrinfo hints; + struct addrinfo *res = NULL; + const char *env; + char touch_cmd[1024]; + int rc; + + (void) state; /* unused */ + + /* IPv4 */ + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ + hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */ + hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ + hints.ai_protocol = 0; /* Any protocol */ + hints.ai_canonname = NULL; + hints.ai_addr = NULL; + hints.ai_next = NULL; + + rc = getaddrinfo("127.0.0.11", NULL, &hints, &res); + assert_int_equal(rc, 0); + assert_non_null(res); + + freeaddrinfo(res); + res = NULL; + + env = getenv("NSS_WRAPPER_HOSTS"); + assert_non_null(env); + + snprintf(touch_cmd, sizeof(touch_cmd), "touch %s", env); + + rc = system(touch_cmd); + assert_return_code(rc, errno); + + rc = getaddrinfo("127.0.0.11", NULL, &hints, &res); + assert_int_equal(rc, 0); + assert_non_null(res); + + + freeaddrinfo(res); +} + static void test_nwrap_getaddrinfo_samba(void **state) { struct addrinfo hints; @@ -661,6 +711,7 @@ const struct CMUnitTest tests[] = { cmocka_unit_test(test_nwrap_getaddrinfo), + cmocka_unit_test(test_nwrap_getaddrinfo_reload), cmocka_unit_test(test_nwrap_getaddrinfo_any), cmocka_unit_test(test_nwrap_getaddrinfo_local), cmocka_unit_test(test_nwrap_getaddrinfo_name),
