[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Thu Oct 9 06:48:03 MDT 2014


The branch, master has been updated
       via  678b75d nwrap: Bump version of nss_wrapper to 1.0.3.
       via  c298542 nwrap: Make sure addr is initialized.
       via  2bbd403 nwrap: Use DNS_NAME_MAX cause it is not available on BSD.
       via  895b32b nwrap: Don't overflow the in_addr if convert IPv6.
       via  94c87d1 nwrap: Fix resolving hostnames with a trailing dot.
       via  6979082 nwrap: Fall back to RTLD_NEXT if we can't find libc.
      from  1b27b73 s3-net: display full value of "msDS-SupportedEncryptionTypes".

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


- Log -----------------------------------------------------------------
commit 678b75d9c7e3a14f292f224a19df5f66ba2d74f0
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Oct 9 09:17:37 2014 +0200

    nwrap: Bump version of nss_wrapper to 1.0.3.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Thu Oct  9 14:47:16 CEST 2014 on sn-devel-104

commit c298542fe29c6b38c353417b22dc56c9c8722f6a
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Oct 9 09:17:07 2014 +0200

    nwrap: Make sure addr is initialized.
    
    CID #72755
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 2bbd403f39eb5bc6025014fe1514751dd5872207
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Oct 9 09:16:33 2014 +0200

    nwrap: Use DNS_NAME_MAX cause it is not available on BSD.
    
    Also HOST_NAME_MAX is only for the value returned by gethostname(). It
    is normally limited to 64 chars on Linux.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 895b32b2e39417072bc40afeb21293a08181399f
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Oct 9 09:15:59 2014 +0200

    nwrap: Don't overflow the in_addr if convert IPv6.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 94c87d134723a432d2d4e908d3c5d44b39fde1ae
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Oct 9 09:14:57 2014 +0200

    nwrap: Fix resolving hostnames with a trailing dot.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 697908277951dc7fb9570e17f2662d8734aab986
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Oct 9 09:13:48 2014 +0200

    nwrap: Fall back to RTLD_NEXT if we can't find libc.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 lib/nss_wrapper/nss_wrapper.c |   79 ++++++++++++++++++++++------------------
 lib/nss_wrapper/wscript       |    2 +-
 2 files changed, 44 insertions(+), 37 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/nss_wrapper/nss_wrapper.c b/lib/nss_wrapper/nss_wrapper.c
index a012cbd..a41de9e 100644
--- a/lib/nss_wrapper/nss_wrapper.c
+++ b/lib/nss_wrapper/nss_wrapper.c
@@ -121,6 +121,10 @@ typedef nss_status_t NSS_STATUS;
 #define __location__ __FILE__ ":" __LINESTR__
 #endif
 
+#ifndef DNS_NAME_MAX
+#define DNS_NAME_MAX 255
+#endif
+
 /* GCC have printf type attribute check. */
 #ifdef HAVE_ATTRIBUTE_PRINTF_FORMAT
 #define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
@@ -562,10 +566,6 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
 	void *handle = NULL;
 	int i;
 
-#ifdef HAVE_APPLE
-	return RTLD_NEXT;
-#endif
-
 #ifdef RTLD_DEEPBIND
 	flags |= RTLD_DEEPBIND;
 #endif
@@ -619,10 +619,17 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
 	}
 
 	if (handle == NULL) {
+#ifdef RTLD_NEXT
+		handle = nwrap_main_global->libc->handle
+		       = nwrap_main_global->libc->sock_handle
+		       = nwrap_main_global->libc->nsl_handle
+		       = RTLD_NEXT;
+#else
 		NWRAP_LOG(NWRAP_LOG_ERROR,
 			  "Failed to dlopen library: %s\n",
 			  dlerror());
 		exit(-1);
+#endif
 	}
 
 	return handle;
@@ -2348,10 +2355,18 @@ static void nwrap_files_endgrent(struct nwrap_backend *b)
 static struct hostent *nwrap_files_gethostbyname(const char *name, int af)
 {
 	struct hostent *he;
+	char canon_name[DNS_NAME_MAX] = { 0 };
+	size_t name_len;
 	int i;
 
 	nwrap_files_cache_reload(nwrap_he_global.cache);
 
+	name_len = strlen(name);
+	if (name_len < sizeof(canon_name) && name[name_len - 1] == '.') {
+		strncpy(canon_name, name, name_len - 1);
+		name = canon_name;
+	}
+
 	for (i = 0; i < nwrap_he_global.num; i++) {
 		int j;
 
@@ -3842,13 +3857,20 @@ static int nwrap_getaddrinfo(const char *node,
 	struct addrinfo *p = NULL;
 	unsigned short port = 0;
 	struct hostent *he;
-	struct in_addr in;
-	bool is_addr_ipv4 = false;
-	bool is_addr_ipv6 = false;
+	struct {
+		int family;
+		union {
+			struct in_addr v4;
+#ifdef HAVE_IPV6
+			struct in6_addr v6;
+		} in;
+#endif
+	} addr = {
+		.family = AF_UNSPEC,
+	};
 	int eai = EAI_SYSTEM;
 	int ret;
 	int rc;
-	int af;
 
 	if (node == NULL && service == NULL) {
 		return EAI_NONAME;
@@ -3900,32 +3922,25 @@ static int nwrap_getaddrinfo(const char *node,
 		}
 	}
 
-	af = hints->ai_family;
-	if (af == AF_UNSPEC) {
-		af = AF_INET;
+	rc = 0;
+	if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET) {
+		rc = inet_pton(AF_INET, node, &addr.in.v4);
 	}
-
-	rc = inet_pton(af, node, &in);
 	if (rc == 1) {
-		is_addr_ipv4 = true;
-		if (af == AF_UNSPEC) {
-			af = AF_INET;
-		}
+		addr.family = AF_INET;
 #ifdef HAVE_IPV6
 	} else {
-		struct in6_addr in6;
-
-		af = AF_INET6;
-
-		rc = inet_pton(af, node, &in6);
+		rc = inet_pton(AF_INET6, node, &addr.in.v6);
 		if (rc == 1) {
-			is_addr_ipv6 = true;
+			addr.family = AF_INET6;
 		}
 #endif
 	}
 
-	if (is_addr_ipv4) {
-		he = nwrap_files_gethostbyaddr(&in, sizeof(struct in_addr), af);
+	if (addr.family == AF_INET) {
+		he = nwrap_files_gethostbyaddr(&addr.in.v4,
+					       sizeof(struct in_addr),
+					       addr.family);
 		if (he != NULL) {
 			rc = nwrap_convert_he_ai(he, port, hints, &ai);
 		} else {
@@ -3933,18 +3948,10 @@ static int nwrap_getaddrinfo(const char *node,
 			rc = -1;
 		}
 #ifdef HAVE_IPV6
-	} else if (is_addr_ipv6) {
-		struct in6_addr in6;
-
-		rc =  inet_pton(af, node, &in6);
-		if (rc <= 0) {
-			eai = EAI_ADDRFAMILY;
-			return ret == 0 ? 0 : eai;
-		}
-
-		he = nwrap_files_gethostbyaddr(&in6,
+	} else if (addr.family == AF_INET6) {
+		he = nwrap_files_gethostbyaddr(&addr.in.v6,
 					       sizeof(struct in6_addr),
-					       af);
+					       addr.family);
 		if (he != NULL) {
 			rc = nwrap_convert_he_ai(he, port, hints, &ai);
 			eai = rc;
diff --git a/lib/nss_wrapper/wscript b/lib/nss_wrapper/wscript
index 34026c0..94d23d5 100644
--- a/lib/nss_wrapper/wscript
+++ b/lib/nss_wrapper/wscript
@@ -2,7 +2,7 @@
 
 import os
 
-VERSION="1.0.2"
+VERSION="1.0.3"
 
 def configure(conf):
     if conf.CHECK_BUNDLED_SYSTEM('nss_wrapper', minversion=VERSION, set_target=False):


-- 
Samba Shared Repository


More information about the samba-cvs mailing list