[SCM] NSS Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Thu Mar 13 06:43:47 MDT 2014


The branch, master has been updated
       via  b928fe9 tests: Add test_gethostent.
       via  64c082a src: Fix segfault in 'getent hosts' without aliases.
      from  3d58327 Bump version to 1.0.1.

http://gitweb.samba.org/?p=nss_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b928fe9ff92a237ee4cffadfa517d76a4e07d80c
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Mar 13 10:35:47 2014 +0100

    tests: Add test_gethostent.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 64c082a393013e3fc9a0cce0afa5e426f55b5ccd
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Mar 13 10:20:46 2014 +0100

    src: Fix segfault in 'getent hosts' without aliases.
    
    The glibc's 'getent' always dereferences he->h_aliases[i], so we need
    to allocate it.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 src/nss_wrapper.c    |    7 ++++++-
 tests/CMakeLists.txt |    2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c
index 5685fc6..94df6ac 100644
--- a/src/nss_wrapper.c
+++ b/src/nss_wrapper.c
@@ -1950,7 +1950,12 @@ static bool nwrap_he_parse_line(struct nwrap_cache *nwrap, char *line)
 
 	ed->ht.h_name = n;
 
-	ed->ht.h_aliases = NULL;
+	/* glib's getent always dereferences he->h_aliases */
+	ed->ht.h_aliases = malloc(sizeof(char *));
+	if (ed->ht.h_aliases == NULL) {
+		return false;
+	}
+	ed->ht.h_aliases[0] = NULL;
 
 	/*
 	 * Aliases
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 3b84829..5aab29e 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -23,7 +23,7 @@ list(APPEND TEST_ENVIRONMENT NSS_WRAPPER_HOSTS=${CMAKE_CURRENT_BINARY_DIR}/hosts
 list(APPEND TEST_ENVIRONMENT NSS_WRAPPER_MODULE_SO_PATH=${CMAKE_CURRENT_BINARY_DIR}/libnss_nwrap.so)
 list(APPEND TEST_ENVIRONMENT NSS_WRAPPER_MODULE_FN_PREFIX=nwrap)
 
-set(NWRAP_TESTS testsuite test_getaddrinfo test_getnameinfo test_gethostby_name_addr)
+set(NWRAP_TESTS testsuite test_getaddrinfo test_getnameinfo test_gethostby_name_addr test_gethostent)
 
 foreach(_NWRAP_TEST ${NWRAP_TESTS})
     add_cmocka_test(${_NWRAP_TEST} ${_NWRAP_TEST}.c ${TESTSUITE_LIBRARIES})


-- 
NSS Wrapper Repository


More information about the samba-cvs mailing list