[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-79-g620785d

Jeremy Allison jra at samba.org
Fri Oct 19 20:11:29 GMT 2007


The branch, v3-2-test has been updated
       via  620785df4e57b72471ff0315e22e0d2f28a2b1a5 (commit)
       via  641d0968da73dca24a3ddaf93451de1200d3c09b (commit)
       via  bafcede2c29813f8719fc3b54f94612e72c48043 (commit)
      from  793a9d24a163cb6cf5a3a0aa5ae30e9f8cf4744a (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 620785df4e57b72471ff0315e22e0d2f28a2b1a5
Author: Gerald (Jerry) Carter <jerry at samba.org>
Date:   Fri Oct 19 08:14:12 2007 -0500

    Add test for "struct in6_addr" to the HAVE_IPV6 configure test.
    Also make use of "if defined(HAVE_IPV6)" rather than testing for
    AF_INET6 since this is not sufficient on HP-UX 11.11 to ensure
    a working IPv6 implementation.

commit 641d0968da73dca24a3ddaf93451de1200d3c09b
Author: Gerald (Jerry) Carter <jerry at samba.org>
Date:   Fri Oct 19 09:06:14 2007 -0500

    Move the test for the AIX specific interface code to the end.
    This tests goes into an infinite loop on OS X so avoid it.
    Probably should also be only conditionaly be run on AIX in the
    first place.

commit bafcede2c29813f8719fc3b54f94612e72c48043
Author: Gerald (Jerry) Carter <jerry at samba.org>
Date:   Fri Oct 19 14:36:34 2007 -0500

    Fix a crash in resolve_hosts() caused by an out-of-bounds array reference.

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

Summary of changes:
 source/configure.in       |   37 +++++++++++++++++++------------------
 source/lib/interface.c    |    4 ++--
 source/lib/interfaces.c   |    4 ++--
 source/lib/util_sock.c    |   16 ++++++++--------
 source/libsmb/namequery.c |    3 ++-
 source/smbd/utmp.c        |    2 +-
 6 files changed, 34 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/configure.in b/source/configure.in
index 22989db..a96e2d9 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -2962,23 +2962,6 @@ fi
 ##################
 # look for a method of finding the list of network interfaces
 iface=no;
-AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
-AC_TRY_RUN([
-#define NO_CONFIG_H 1
-#define HAVE_IFACE_AIX 1
-#define AUTOCONF_TEST 1
-#undef _XOPEN_SOURCE_EXTENDED
-#include "${srcdir-.}/lib/replace/replace.c"
-#include "${srcdir-.}/lib/interfaces.c"],
-           samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
-CPPFLAGS="$SAVE_CPPFLAGS"
-if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
-    iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
-fi
-
-if test $iface = no; then
 AC_CACHE_CHECK([for iface getifaddrs],samba_cv_HAVE_IFACE_GETIFADDRS,[
 SAVE_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
@@ -2993,7 +2976,6 @@ CPPFLAGS="$SAVE_CPPFLAGS"
 if test x"$samba_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then
     iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available])
 fi
-fi
 
 if test $iface = no; then
 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
@@ -3029,6 +3011,24 @@ if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
 fi
 fi
 
+if test $iface = no; then
+AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
+SAVE_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
+AC_TRY_RUN([
+#define NO_CONFIG_H 1
+#define HAVE_IFACE_AIX 1
+#define AUTOCONF_TEST 1
+#undef _XOPEN_SOURCE_EXTENDED
+#include "${srcdir-.}/lib/replace/replace.c"
+#include "${srcdir-.}/lib/interfaces.c"],
+           samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
+CPPFLAGS="$SAVE_CPPFLAGS"
+if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
+    iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
+fi
+fi
+
 dnl test for ipv6
 AC_CACHE_CHECK([for ipv6 support],samba_cv_HAVE_IPV6,[
 AC_TRY_COMPILE([
@@ -3038,6 +3038,7 @@ AC_TRY_COMPILE([
 [
 struct sockaddr_storage sa_store;
 struct addrinfo *ai = NULL;
+struct in6_addr in6addr;
 int s = socket(AF_INET6, SOCK_STREAM, 0);
 int ret = getaddrinfo(NULL, NULL, NULL, &ai);
 if (ret != 0) {
diff --git a/source/lib/interface.c b/source/lib/interface.c
index 4892ec1..0696329 100644
--- a/source/lib/interface.c
+++ b/source/lib/interface.c
@@ -339,7 +339,7 @@ bool make_netmask(struct sockaddr_storage *pss_out,
 {
 	*pss_out = *pss_in;
 	/* Now apply masklen bits of mask. */
-#if defined(AF_INET6)
+#if defined(HAVE_IPV6)
 	if (pss_in->ss_family == AF_INET6) {
 		char *p = (char *)&((struct sockaddr_in6 *)pss_out)->sin6_addr;
 		unsigned int i;
@@ -386,7 +386,7 @@ static void make_bcast_or_net(struct sockaddr_storage *pss_out,
 	*pss_out = *pss_in;
 
 	/* Set all zero netmask bits to 1. */
-#if defined(AF_INET6)
+#if defined(HAVE_IPV6)
 	if (pss_in->ss_family == AF_INET6) {
 		p = (char *)&((struct sockaddr_in6 *)pss_out)->sin6_addr;
 		pmask = (char *)&((struct sockaddr_in6 *)nmask)->sin6_addr;
diff --git a/source/lib/interfaces.c b/source/lib/interfaces.c
index 2b93a5b..3b15e3e 100644
--- a/source/lib/interfaces.c
+++ b/source/lib/interfaces.c
@@ -128,7 +128,7 @@ static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces)
 			continue;
 		}
 
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
 		if (ifptr->ifa_addr->sa_family == AF_INET6) {
 			copy_size = sizeof(struct sockaddr_in6);
 		}
@@ -496,7 +496,7 @@ static int iface_comp(struct iface_struct *i1, struct iface_struct *i2)
 {
 	int r;
 
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
 	/*
 	 * If we have IPv6 - sort these interfaces lower
 	 * than any IPv4 ones.
diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c
index eb3b353..c6b1311 100644
--- a/source/lib/util_sock.c
+++ b/source/lib/util_sock.c
@@ -52,7 +52,7 @@ bool is_ipaddress(const char *str)
 {
 	int ret = -1;
 
-#if defined(AF_INET6)
+#if defined(HAVE_IPV6)
 	struct in6_addr dest6;
 
 	ret = inet_pton(AF_INET6, str, &dest6);
@@ -212,7 +212,7 @@ bool is_loopback_ip_v4(struct in_addr ip)
 
 bool is_loopback_addr(const struct sockaddr_storage *pss)
 {
-#if defined(AF_INET6)
+#if defined(HAVE_IPV6)
 	if (pss->ss_family == AF_INET) {
 		struct in6_addr *pin6 =
 			&((struct sockaddr_in6 *)pss)->sin6_addr;
@@ -243,7 +243,7 @@ bool is_zero_ip_v4(struct in_addr ip)
 
 bool is_zero_addr(const struct sockaddr_storage *pss)
 {
-#if defined(AF_INET6)
+#if defined(HAVE_IPV6)
 	if (pss->ss_family == AF_INET) {
 		struct in6_addr *pin6 =
 			&((struct sockaddr_in6 *)pss)->sin6_addr;
@@ -302,7 +302,7 @@ void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
 	sa->sin_addr = ip;
 }
 
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
 /*******************************************************************
  Convert an IPv6 struct in_addr to a struct sockaddr_storage.
 ********************************************************************/
@@ -330,7 +330,7 @@ bool same_net(const struct sockaddr_storage *ip1,
 		return false;
 	}
 
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
 	if (ip1->ss_family == AF_INET6) {
 		struct sockaddr_in6 ip1_6 = *(struct sockaddr_in6 *)ip1;
 		struct sockaddr_in6 ip2_6 = *(struct sockaddr_in6 *)ip2;
@@ -370,7 +370,7 @@ bool addr_equal(const struct sockaddr_storage *ip1,
 		return false;
 	}
 
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
 	if (ip1->ss_family == AF_INET6) {
 		return (memcmp(&((const struct sockaddr_in6 *)ip1)->sin6_addr,
 				&((const struct sockaddr_in6 *)ip2)->sin6_addr,
@@ -392,7 +392,7 @@ bool addr_equal(const struct sockaddr_storage *ip1,
 
 bool is_address_any(const struct sockaddr_storage *psa)
 {
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
 	if (psa->ss_family == AF_INET6) {
 		struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)psa;
 		if (memcmp(&in6addr_any,
@@ -494,7 +494,7 @@ static int get_socket_port(int fd)
 		return -1;
 	}
 
-#ifdef AF_INET6
+#if defined(HAVE_IPV6)
 	if (sa.ss_family == AF_INET6) {
 		return ntohs(((struct sockaddr_in6 *)&sa)->sin6_port);
 	}
diff --git a/source/libsmb/namequery.c b/source/libsmb/namequery.c
index 12e0d01..6585fd7 100644
--- a/source/libsmb/namequery.c
+++ b/source/libsmb/namequery.c
@@ -1074,7 +1074,6 @@ static NTSTATUS resolve_hosts(const char *name, int name_type,
 			&((struct sockaddr_in *)res->ai_addr)->sin_addr);
 
 		*return_count += 1;
-		i++;
 
 		*return_iplist = SMB_REALLOC_ARRAY(*return_iplist,
 						struct ip_service,
@@ -1086,6 +1085,8 @@ static NTSTATUS resolve_hosts(const char *name, int name_type,
 		}
 		(*return_iplist)[i].ip   = return_ip;
 		(*return_iplist)[i].port = PORT_NONE;
+
+		i++;
 	}
 	if (ailist) {
 		freeaddrinfo(ailist);
diff --git a/source/smbd/utmp.c b/source/smbd/utmp.c
index e36e2aa..c2908e3 100644
--- a/source/smbd/utmp.c
+++ b/source/smbd/utmp.c
@@ -525,7 +525,7 @@ static bool sys_utmp_fill(struct utmp *u,
 #if defined(HAVE_UT_UT_HOST)
 	utmp_strcpy(u->ut_host, hostname, sizeof(u->ut_host));
 #endif
-#if defined(AF_INET6) && defined(HAVE_UT_UT_ADDR_V6)
+#if defined(HAVE_IPV6) && defined(HAVE_UT_UT_ADDR_V6)
 	memset(&u->ut_addr_v6, '\0', sizeof(u->ut_addr_v6));
 	if (ip_addr_str) {
 		struct in6_addr addr;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list