[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-272-g4519eae

Stefan Metzmacher metze at samba.org
Fri Jan 30 21:34:21 GMT 2009


The branch, master has been updated
       via  4519eae158e7821dcd2f818eea830cfcdd4a0105 (commit)
       via  03bd9b2683ab7abf967118b5970f6a59c101782a (commit)
      from  f6d08849e11775eb2530f04ecb055269ea445539 (commit)

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


- Log -----------------------------------------------------------------
commit 4519eae158e7821dcd2f818eea830cfcdd4a0105
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jan 30 22:19:50 2009 +0100

    s4:lib/socket: don't use gethostbyname2()
    
    metze

commit 03bd9b2683ab7abf967118b5970f6a59c101782a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jan 30 22:19:10 2009 +0100

    s4:heimdal_build: heimdal requires u_int32_t and u_char
    
    metze

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

Summary of changes:
 source4/heimdal_build/internal.m4 |    3 +++
 source4/lib/socket/config.m4      |    1 -
 source4/lib/socket/socket_ip.c    |   33 +++++++++++++++++++++++++--------
 3 files changed, 28 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/heimdal_build/internal.m4 b/source4/heimdal_build/internal.m4
index 06e798c..b2f64a6 100644
--- a/source4/heimdal_build/internal.m4
+++ b/source4/heimdal_build/internal.m4
@@ -33,6 +33,9 @@ esac
 
 ])
 
+AC_CHECK_TYPE(u_char, uint8_t)
+AC_CHECK_TYPE(u_int32_t, uint32_t)
+
 dnl Not all systems have err.h, so we provide a replacement. Heimdal
 dnl unconditionally #includes <err.h>, so we need to create an err.h,
 dnl but we can't just have a static one because we don't want to use
diff --git a/source4/lib/socket/config.m4 b/source4/lib/socket/config.m4
index 9c0072d..fa987a1 100644
--- a/source4/lib/socket/config.m4
+++ b/source4/lib/socket/config.m4
@@ -1,6 +1,5 @@
 AC_CHECK_FUNCS(writev)
 AC_CHECK_FUNCS(readv)
-AC_CHECK_FUNCS(gethostbyname2)
 
 ############################################
 # check for unix domain sockets
diff --git a/source4/lib/socket/socket_ip.c b/source4/lib/socket/socket_ip.c
index bca0aab..cdb75fe 100644
--- a/source4/lib/socket/socket_ip.c
+++ b/source4/lib/socket/socket_ip.c
@@ -549,19 +549,36 @@ _PUBLIC_ const struct socket_ops *socket_ipv4_ops(enum socket_type type)
 
 static struct in6_addr interpret_addr6(const char *name)
 {
-	struct hostent *he;
-	
-	if (name == NULL) return in6addr_any;
+	char addr[INET6_ADDRSTRLEN];
+	struct in6_addr dest6;
+	const char *sp = name;
+	char *p = strchr_m(sp, '%');
+	int ret;
+
+	if (sp == NULL) return in6addr_any;
 
-	if (strcasecmp(name, "localhost") == 0) {
-		name = "::1";
+	if (strcasecmp(sp, "localhost") == 0) {
+		sp = "::1";
 	}
 
-	he = gethostbyname2(name, PF_INET6);
+	/*
+	 * Cope with link-local.
+	 * This is IP:v6:addr%ifname.
+	 */
+
+	if (p && (p > sp) && (if_nametoindex(p+1) != 0)) {
+		strlcpy(addr, sp,
+			MIN(PTR_DIFF(p,sp)+1,
+				sizeof(addr)));
+		sp = addr;
+	}
 
-	if (he == NULL) return in6addr_any;
+	ret = inet_pton(AF_INET6, sp, &dest6);
+	if (ret > 0) {
+		return dest6;
+	}
 
-	return *((struct in6_addr *)he->h_addr);
+	return in6addr_any;
 }
 
 static NTSTATUS ipv6_init(struct socket_context *sock)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list