[SCM] NSS Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Thu Aug 9 11:06:13 UTC 2018


The branch, master has been updated
       via  2d57b2a ctest: Move to new dashboard
       via  31fa6a7 nwrap: Update header
       via  35c8ff2 Update LICENSE file
       via  fb1ef75 Rename COPYING to LICENSE
       via  c6d06bf nwrap: Print errno when hsearch() returns NULL
       via  853ae24 tests: Add musl-libc 1.1 compatibility (gethostent())
       via  54fb274 tests: Add musl-libc 1.1 compatibility (getaddrinfo(), EAI_SERVICE)
       via  8ba1653 tests: Add musl-libc 1.1 compatibility (getaddrinfo(), IP-addresses)
       via  f8bb2de cpack: Do not package build dirs in source tarball
       via  52c79f2 cmake: Replace deprecated get_target_property()
      from  4298e3f nwrap: Fix strotoul checks for NSS_WRAPPER_MAX_HOSTENTS

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


- Log -----------------------------------------------------------------
commit 2d57b2a56ddcfc229e0b6445c534c558094e336b
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jul 5 10:15:11 2018 +0200

    ctest: Move to new dashboard
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 31fa6a7c7a9453d91ef4683581814fb02c2a3a45
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jun 22 08:46:06 2018 +0200

    nwrap: Update header
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 35c8ff28450ec5dbd16d9619cac936db9e00ee3d
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jun 22 08:34:27 2018 +0200

    Update LICENSE file
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit fb1ef750dc442a561e17536b8212261841478536
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jun 22 08:32:43 2018 +0200

    Rename COPYING to LICENSE
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit c6d06bf617d25cb2b751853f5c6af0fe0e152f69
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Jan 22 17:30:33 2018 +0100

    nwrap: Print errno when hsearch() returns NULL
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 853ae24558611ee7738e60ecd0e4d805df7c6b00
Author: Dennis Schridde <dennis.schridde at uni-heidelberg.de>
Date:   Wed Jan 25 22:25:24 2017 +0100

    tests: Add musl-libc 1.1 compatibility (gethostent())
    
    musl-libc stubs gethostent() and replies with NULL in any case. Thus we have to
     check the sensibility of the function before performing tests.
    
    Tested with musl-libc 1.1.16-r13 on Alpine Linux 3.6. Also confirmed to not
     break with GNU libc 2.23-0ubuntu9 on Ubuntu 16.04.3 LTS.
    
    Signed-Off-By: Dennis Schridde <dennis.schridde at uni-heidelberg.de>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 54fb2748b2e0f720017982678d50357e90b695d9
Author: Dennis Schridde <dennis.schridde at uni-heidelberg.de>
Date:   Thu Aug 3 11:34:07 2017 +0200

    tests: Add musl-libc 1.1 compatibility (getaddrinfo(), EAI_SERVICE)
    
    The tests of getaddrinfo() had to be adapted, because musl-libc, unlike glibc
     and others, returns EAI_SERVICE if the requested service is not available for
     the requested socket type.
    
    Tested with musl-libc 1.1.16-r13 on Alpine Linux 3.6. Also confirmed to not
     break with GNU libc 2.23-0ubuntu9 on Ubuntu 16.04.3 LTS.
    
    Signed-Off-By: Dennis Schridde <dennis.schridde at uni-heidelberg.de>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 8ba16534b6f02c6337106cc17ced3c1f48b903fa
Author: Dennis Schridde <dennis.schridde at uni-heidelberg.de>
Date:   Wed Jan 25 22:25:24 2017 +0100

    tests: Add musl-libc 1.1 compatibility (getaddrinfo(), IP-addresses)
    
    The tests of getaddrinfo() had to be adapted, because musl-libc, unlike glibc
     and others, replies with the same canonical name that was used in the original
     request, if the requested "node" was an IP-address
    
    Tested with musl-libc 1.1.16-r13 on Alpine Linux 3.6. Also confirmed to not
     break with GNU libc 2.23-0ubuntu9 on Ubuntu 16.04.3 LTS.
    
    Signed-Off-By: Dennis Schridde <dennis.schridde at uni-heidelberg.de>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit f8bb2dea54ac9f4276b73befcb83fdf0d120d6ba
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jun 22 09:00:30 2018 +0200

    cpack: Do not package build dirs in source tarball
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 52c79f2e0284baa04a180280dc92875cef13f757
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Jun 22 08:55:40 2018 +0200

    cmake: Replace deprecated get_target_property()
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 CPackConfig.cmake           |  4 +--
 CTestConfig.cmake           |  6 ++--
 ConfigureChecks.cmake       | 69 +++++++++++++++++++++++++++++++++++++++++++++
 COPYING => LICENSE          |  9 ++++--
 src/CMakeLists.txt          |  7 +----
 src/nss_wrapper.c           | 13 ++++++---
 tests/test_getaddrinfo.c    | 20 +++++++++++++
 tests/test_nwrap_disabled.c | 12 ++++++++
 8 files changed, 122 insertions(+), 18 deletions(-)
 rename COPYING => LICENSE (82%)


Changeset truncated at 500 lines:

diff --git a/CPackConfig.cmake b/CPackConfig.cmake
index dc74dfa..e1b83ac 100644
--- a/CPackConfig.cmake
+++ b/CPackConfig.cmake
@@ -7,7 +7,7 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The SSH library")
 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
 set(CPACK_PACKAGE_VENDOR "The SSH Library Development Team")
 set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
 
 
 ### versions
@@ -19,7 +19,7 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO
 
 ### source generator
 set(CPACK_SOURCE_GENERATOR "TGZ")
-set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;/obj/;tags;cscope.*")
+set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build*;/obj*;tags;cscope.*")
 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
 
 if (WIN32)
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index 47a28d0..14dd8d1 100644
--- a/CTestConfig.cmake
+++ b/CTestConfig.cmake
@@ -1,9 +1,9 @@
 set(UPDATE_TYPE "true")
 
-set(CTEST_PROJECT_NAME "nsswrapper")
+set(CTEST_PROJECT_NAME "nss_wrapper")
 set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
 
 set(CTEST_DROP_METHOD "https")
-set(CTEST_DROP_SITE "mock.cryptomilk.org")
-set(CTEST_DROP_LOCATION "/submit.php?project=nsswrapper")
+set(CTEST_DROP_SITE "test.cmocka.org")
+set(CTEST_DROP_LOCATION "/submit.php?project=${CTEST_PROJECT_NAME}")
 set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 6f760e6..41029d4 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -6,6 +6,7 @@ include(CheckTypeSize)
 include(CheckStructHasMember)
 include(CheckPrototypeDefinition)
 include(TestBigEndian)
+include(CheckCSourceRuns)
 
 set(PACKAGE ${APPLICATION_NAME})
 set(VERSION ${APPLICATION_VERSION})
@@ -270,3 +271,71 @@ if (NOT WIN32)
 endif (NOT WIN32)
 
 set(NWRAP_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "nss_wrapper required system libraries")
+
+# check whether getaddrinfo() returns "node" in "ai_canonname" for IP-addresses
+check_c_source_runs("#include <stddef.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+int main(void) {
+    struct addrinfo hints;
+    struct addrinfo *res = NULL;
+
+    memset(&hints, 0, sizeof(struct addrinfo));
+    hints.ai_family = AF_INET;
+    hints.ai_socktype = SOCK_STREAM;
+    hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV;
+
+    if (getaddrinfo(\"0.0.0.0\", \"389\", &hints, &res) != 0) {
+        return 2;
+    }
+
+    if (res == NULL) {
+        return 3;
+    }
+
+    return strncmp(res->ai_canonname, \"0.0.0.0\", sizeof(\"0.0.0.0\")) != 0;
+}" HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES)
+if (HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES)
+    add_definitions(-DHAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES)
+endif (HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES)
+
+# check whether getaddrinfo() returns EAI_SERVICE when the requested service is not available for the requested socket type.
+check_c_source_runs("#include <stddef.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+int main(void) {
+    struct addrinfo hints;
+    struct addrinfo *res = NULL;
+    int rc;
+
+    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 | AI_NUMERICSERV;    /* For wildcard IP address */
+    hints.ai_protocol = 0;          /* Any protocol */
+    hints.ai_canonname = NULL;
+
+    rc = getaddrinfo(NULL, \"echo\", &hints, &res);
+    return rc != EAI_SERVICE;
+}" HAVE_GETADDRINFO_USES_EAI_SERVICE)
+if (HAVE_GETADDRINFO_USES_EAI_SERVICE)
+    add_definitions(-DHAVE_GETADDRINFO_USES_EAI_SERVICE)
+endif (HAVE_GETADDRINFO_USES_EAI_SERVICE)
+
+# check for non-NULL gethostent()
+check_c_source_runs("#include <stddef.h>
+#include <netdb.h>
+int main(void) {
+    struct hostent *hostent = NULL;
+    sethostent(0);
+    hostent = gethostent();
+    endhostent();
+    return hostent == NULL;
+}" HAVE_NONNULL_GETHOSTENT)
+if (HAVE_NONNULL_GETHOSTENT)
+    add_definitions(-DHAVE_NONNULL_GETHOSTENT)
+endif (HAVE_NONNULL_GETHOSTENT)
diff --git a/COPYING b/LICENSE
similarity index 82%
rename from COPYING
rename to LICENSE
index 0100415..be6062e 100644
--- a/COPYING
+++ b/LICENSE
@@ -1,7 +1,10 @@
-Copyright (C) Stefan Metzmacher 2007 <metze at samba.org>
-Copyright (C) Guenther Deschner 2009 <gd at samba.org>
-Copyright (C) Andreas Schneider 2013 <asn at samba.org>
+BSD 3-Clause License
 
+Copyright (c) 2007,      Stefan Metzmacher <metze at samba.org>
+Copyright (c) 2009,      Guenther Deschner <gd at samba.org>
+Copyright (c) 2014-2015, Michael Adam <obnox at samba.org>
+Copyright (c) 2015,      Robin Hack <hack.robin at gmail.com>
+Copyright (c) 2013-2018, Andreas Schneider <asn at samba.org>
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7b89866..2656e9b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -25,9 +25,4 @@ install(
   ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
 )
 
-# This needs to be at the end
-if (POLICY CMP0026)
-    cmake_policy(SET CMP0026 OLD)
-endif()
-get_target_property(NWRAP_LOCATION nss_wrapper LOCATION)
-set(NSS_WRAPPER_LOCATION ${NWRAP_LOCATION} PARENT_SCOPE)
+set(NSS_WRAPPER_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}nss_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE)
diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c
index 835bc87..dd0848a 100644
--- a/src/nss_wrapper.c
+++ b/src/nss_wrapper.c
@@ -1,8 +1,11 @@
 /*
- * Copyright (C) Stefan Metzmacher 2007 <metze at samba.org>
- * Copyright (C) Guenther Deschner 2009 <gd at samba.org>
- * Copyright (C) Andreas Schneider 2013 <asn at samba.org>
+ * BSD 3-Clause License
  *
+ * Copyright (c) 2007,      Stefan Metzmacher <metze at samba.org>
+ * Copyright (c) 2009,      Guenther Deschner <gd at samba.org>
+ * Copyright (c) 2014-2015, Michael Adam <obnox at samba.org>
+ * Copyright (c) 2015,      Robin Hack <hack.robin at gmail.com>
+ * Copyright (c) 2013-2018, Andreas Schneider <asn at samba.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -2633,7 +2636,9 @@ static bool nwrap_ed_inventarize_add_new(char *const h_name,
 
 	p = hsearch(e, ENTER);
 	if (p == NULL) {
-		NWRAP_LOG(NWRAP_LOG_ERROR, "Hash table is full!");
+		NWRAP_LOG(NWRAP_LOG_ERROR,
+			  "Hash table is full (%s)!",
+			  strerror(errno));
 		return false;
 	}
 
diff --git a/tests/test_getaddrinfo.c b/tests/test_getaddrinfo.c
index 438ea12..47eb8f2 100644
--- a/tests/test_getaddrinfo.c
+++ b/tests/test_getaddrinfo.c
@@ -207,7 +207,11 @@ static void test_nwrap_getaddrinfo_any(void **state)
 	assert_int_equal(res->ai_family, AF_INET);
 	assert_int_equal(res->ai_socktype, SOCK_STREAM);
 
+#ifdef HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES
+	assert_string_equal(res->ai_canonname, "0.0.0.0");
+#else /* HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES */
 	assert_null(res->ai_canonname);
+#endif /* HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES */
 
 	sinp = (struct sockaddr_in *)res->ai_addr;
 
@@ -233,7 +237,11 @@ static void test_nwrap_getaddrinfo_any(void **state)
 	assert_int_equal(res->ai_family, AF_INET6);
 	assert_int_equal(res->ai_socktype, SOCK_STREAM);
 
+#ifdef HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES
+	assert_string_equal(res->ai_canonname, "::");
+#else /* HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES */
 	assert_null(res->ai_canonname);
+#endif /* HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES */
 
 	sin6p = (struct sockaddr_in6 *)res->ai_addr;
 
@@ -268,7 +276,11 @@ static void test_nwrap_getaddrinfo_local(void **state)
 	assert_int_equal(res->ai_family, AF_INET);
 	assert_int_equal(res->ai_socktype, SOCK_STREAM);
 
+#ifdef HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES
+	assert_string_equal(res->ai_canonname, "127.0.0.1");
+#else /* HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES */
 	assert_null(res->ai_canonname);
+#endif /* HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES */
 
 	sinp = (struct sockaddr_in *)res->ai_addr;
 	ip = inet_ntoa(sinp->sin_addr);
@@ -581,7 +593,11 @@ static void test_nwrap_getaddrinfo_flags_ai_numericserv(void **state)
 	 */
 
 	rc = getaddrinfo(NULL, "echo", &hints, &res);
+#ifdef HAVE_GETADDRINFO_USES_EAI_SERVICE
+	assert_int_equal(rc, EAI_SERVICE);
+#else /* HAVE_GETADDRINFO_USES_EAI_SERVICE */
 	assert_int_equal(rc, EAI_NONAME);
+#endif /* HAVE_GETADDRINFO_USES_EAI_SERVICE */
 
 	rc = getaddrinfo(NULL, "80", &hints, &res);
 	assert_int_equal(rc, 0);
@@ -590,7 +606,11 @@ static void test_nwrap_getaddrinfo_flags_ai_numericserv(void **state)
 
 	/* Crippled input */
 	rc = getaddrinfo(NULL, "80a1", &hints, &res);
+#ifdef HAVE_GETADDRINFO_USES_EAI_SERVICE
+	assert_int_equal(rc, EAI_SERVICE);
+#else /* HAVE_GETADDRINFO_USES_EAI_SERVICE */
 	assert_int_equal(rc, EAI_NONAME);
+#endif /* HAVE_GETADDRINFO_USES_EAI_SERVICE */
 
 	/*
 	 * Calls with non-NULL name are handled by nwrap
diff --git a/tests/test_nwrap_disabled.c b/tests/test_nwrap_disabled.c
index 56e1589..474dda7 100644
--- a/tests/test_nwrap_disabled.c
+++ b/tests/test_nwrap_disabled.c
@@ -38,6 +38,7 @@ static void test_nwrap_passwd_group(void **state)
 /* Test libnsl */
 static void test_nwrap_hostent(void **state)
 {
+#ifdef HAVE_NONNULL_GETHOSTENT
 	struct hostent *he;
 
 	(void) state; /* unused */
@@ -48,6 +49,13 @@ static void test_nwrap_hostent(void **state)
 	assert_non_null(he);
 
 	endhostent();
+#else
+	(void) state; /* unused */
+
+	sethostent(0);
+	gethostent();
+	endhostent();
+#endif
 }
 
 static void test_nwrap_gethostname(void **state)
@@ -84,7 +92,11 @@ static void test_nwrap_getaddrinfo_local(void **state)
 	assert_int_equal(res->ai_family, AF_INET);
 	assert_int_equal(res->ai_socktype, SOCK_STREAM);
 
+#ifdef HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES
+	assert_string_equal(res->ai_canonname, "127.0.0.1");
+#else /* HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES */
 	assert_null(res->ai_canonname);
+#endif /* HAVE_GETADDRINFO_SETS_CANONNAME_FOR_IPADDRESSES */
 
 	sinp = (struct sockaddr_in *)res->ai_addr;
 


-- 
NSS Wrapper Repository



More information about the samba-cvs mailing list