Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jul 2006 17:14:16 GMT
From:      Michael Bushkov <bushman@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 100641 for review
Message-ID:  <200607051714.k65HEGKU032373@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100641

Change 100641 by bushman@bushman_nss_ldap_cached on 2006/07/05 17:13:38

	Minor fix in testuil.h; gethostby***() test finished. It was extended to support the getipnode**() functions testing, IPv4, IPv6 and IPv4-to-IPv6 mapped requests.

Affected files ...

.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/Makefile#6 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/mach#1 add
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getgr.c#4 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getgr.t#2 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-gethostby.c#3 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-gethostby.t#3 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getpw.c#4 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getpw.t#2 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getserv.c#6 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getserv.t#5 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/testutil.h#7 edit

Differences ...

==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/Makefile#6 (text+ko) ====


==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getgr.c#4 (text+ko) ====


==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getgr.t#2 (text+ko) ====


==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-gethostby.c#3 (text+ko) ====

@@ -35,6 +35,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <netdb.h>
+#include <resolv.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -50,9 +51,13 @@
 	TEST_GETHOSTBYNAME2,
 	TEST_GETHOSTBYADDR,
 	TEST_GETHOSTBYNAME2_GETADDRINFO,
-	TEST_BUILD_SNAPSHOT
+	TEST_GETHOSTBYADDR_GETNAMEINFO,
+	TEST_BUILD_SNAPSHOT,
+	TEST_BUILD_ADDR_SNAPSHOT
 };
 
+static int use_ipnode_functions = 0;
+static int use_ipv6_mapping = 0;
 static int debug = 0;
 static int af_type = AF_INET;
 static enum test_methods method = TEST_BUILD_SNAPSHOT;
@@ -62,6 +67,12 @@
 DECLARE_1PASS_TEST(hostent)
 DECLARE_2PASS_TEST(hostent)
 
+/* These stubs will use gethostby***() or getipnodeby***() functions,
+ * depending on the use_ipnode_functions global variable value */
+static struct hostent *__gethostbyname2(const char *, int);
+static struct hostent *__gethostbyaddr(const void *, socklen_t, int);
+static void __freehostent(struct hostent *);
+
 static void clone_hostent(struct hostent *, struct hostent const *);
 static int compare_hostent(struct hostent *, struct hostent *, void *);
 static void dump_hostent(struct hostent *);
@@ -74,11 +85,10 @@
 static int hostent_read_snapshot_addr(char *, unsigned char *, size_t);
 static int hostent_read_snapshot_func(struct hostent *, char *);
 
-static int hostent_fill_gethostbyname2_data(char const *,
-	struct hostent_test_data *);
 static int hostent_test_correctness(struct hostent *, void *);
 static int hostent_test_gethostbyaddr(struct hostent *, void *);
 static int hostent_test_getaddrinfo_eq(struct hostent *, void *);
+static int hostent_test_getnameinfo_eq(struct hostent *, void *);
 	
 static void usage(void)  __attribute__((__noreturn__));
 
@@ -87,6 +97,62 @@
 IMPLEMENT_1PASS_TEST(hostent)
 IMPLEMENT_2PASS_TEST(hostent)
 
+static struct hostent *
+__gethostbyname2(const char *name, int af)
+{
+	struct hostent *he;
+	int error;
+	
+	if (use_ipnode_functions == 0) {
+		if (use_ipv6_mapping != 0)
+			af = AF_INET;
+		
+		he = gethostbyname2(name, af);
+	} else {
+		error = 0;
+		if (use_ipv6_mapping != 0)
+			af = AF_INET6;
+		he = getipnodebyname(name, af, use_ipv6_mapping == 0 ? AI_ALL :
+			AI_ALL | AI_V4MAPPED, &error);
+		if (he == NULL);
+			errno = error;
+	}
+	
+	return (he);
+}
+
+static struct hostent *
+__gethostbyaddr(const void *addr, socklen_t len, int af)
+{
+	struct hostent *he;
+	int error;
+	
+	if (use_ipnode_functions == 0) {
+		if (use_ipv6_mapping != 0)
+			af = AF_INET;
+
+		he = gethostbyaddr(addr, len, af);
+	} else {
+		error = 0;
+		if (use_ipv6_mapping != 0)
+			af = AF_INET6;
+		he = getipnodebyaddr(addr, len, use_ipv6_mapping == 0 ? AI_ALL :
+			AI_ALL | AI_V4MAPPED, &error);
+		if (he == NULL)
+			errno = error;
+	}
+	
+	return (he);		
+}
+
+static void
+__freehostent(struct hostent *he)
+{
+	/* NOTE: checking for he != NULL - just in case */
+	if ((use_ipnode_functions != 0) && (he != NULL))
+		freehostent(he);
+}
+
 static void
 clone_hostent(struct hostent *dest, struct hostent const *src)
 {
@@ -179,6 +245,9 @@
         
 	if ((ht1 == NULL) || (ht2 == NULL))
 		goto errfin;
+	
+	if ((ht1->h_name == NULL) || (ht2->h_name == NULL))
+		goto errfin;
         
 	if ((ht1->h_addrtype != ht2->h_addrtype) ||
 		(ht1->h_length != ht2->h_length) || 
@@ -248,24 +317,10 @@
 {
 	struct addrinfo *ai2;
 	
-/*	char buffer[100];
-	memset(buffer, 0, sizeof(buffer));
-	
-	char *res = inet_ntop(af, addr, buffer,
-			sizeof(buffer));
-	if (res != NULL)
-		printf("===he %s %s\n", buffer, ai->ai_canonname);
-	
-*/	
 	for (ai2 = ai; ai2 != NULL; ai2 = ai2->ai_next) {
 		if (af != ai2->ai_family)
 			continue;
-		
-/*		res = inet_ntop(ai2->ai_family, (void *)&((struct sockaddr_in *)ai2->ai_addr)->sin_addr, buffer,
-			sizeof(buffer));
-		if (res != NULL)
-			printf("===ai %s\n", buffer);*/
-		
+				
 		switch (af) {
 			case AF_INET:
 				if (memcmp(addr, 
@@ -290,7 +345,6 @@
 static int 
 is_hostent_equal(struct hostent *he, struct addrinfo *ai)
 {
-	struct addrinfo *ai2;
 	char **cp;
 	int rv;
 	
@@ -305,17 +359,6 @@
 		return (rv);
 	}
 
-	/* getaddrinfo doesn't provide the aliases information */
-/*	for (cp = he->h_aliases; *cp; ++cp) {
-		rv = check_addrinfo_for_name(ai, *cp);
-		if (rv != 0) {
-			if (debug)
-				printf("not equal - one of he->h_aliases couldn't be found\n");
-			
-			return (rv);
-		}
-	}*/
-	
 	for (cp = he->h_addr_list; *cp; ++cp) {
 		rv = check_addrinfo_for_addr(ai, *cp, he->h_length,
 			he->h_addrtype);
@@ -395,6 +438,14 @@
 				if (buflen == 0)
 					return;
 			    }
+			    
+			    if (*(cp + 1) ) {
+				written = snprintf(buffer, buflen, " ");
+				buffer += written;
+				if (written > buflen)
+				    return;
+				buflen -= written;						    
+			    }
 			}
 		} else {
 			written = snprintf(buffer, buflen, " noaddrs");
@@ -420,16 +471,19 @@
 	
 	if (debug)
 		printf("resolving %s: ", line);
-	result = gethostbyname2(line, af_type);
+	result = __gethostbyname2(line, af_type);
 	if (result != NULL) {
 		if (debug)
 			printf("found\n");
 				
 		rv = hostent_test_correctness(result, NULL);
-		if (rv != 0)
+		if (rv != 0) {
+			__freehostent(result);
 			return (rv);
+		}
 	
 		clone_hostent(he, result);
+		__freehostent(result);
 	} else {
 		if (debug)
 			printf("not found\n");
@@ -458,8 +512,10 @@
 
 		--len;
 	}
-	
-	return (0);
+	if (len != 0)
+		return (-1);
+	else
+		return (0);
 }
 
 static int
@@ -607,8 +663,8 @@
 	if (!((ht->h_addrtype >= 0) && (ht->h_addrtype < AF_MAX)))
 		goto errfin;
 	
-	/* NOTE: i hope this check is correct */
-	if ((ht->h_length != 4) && (ht->h_length != 6))
+	if ((ht->h_length != sizeof(struct in_addr)) && 
+		(ht->h_length != sizeof(struct in6_addr)))
 		goto errfin;
 	
 	if (ht->h_aliases == NULL)
@@ -616,7 +672,7 @@
 	
 	if (ht->h_addr_list == NULL)
 		goto errfin;
-	
+		
 	if (debug)
 		printf("correct\n");
 	
@@ -628,14 +684,6 @@
 	return (-1);
 }
 
-static int 
-hostent_fill_gethostbyname2_data(char const *filename,
-	struct hostent_test_data *td)
-{
-	return (TEST_SNAPSHOT_FILE_READ(hostent, filename, td,
-		hostent_read_hostlist_func));
-}
-	
 static int
 hostent_test_gethostbyaddr(struct hostent *he, void *mdata)
 {
@@ -652,7 +700,7 @@
 			if (debug)
 			    printf("doing reverse lookup for %s\n", he->h_name);
 			
-			result = gethostbyaddr(cp, he->h_length,
+			result = __gethostbyaddr(*cp, he->h_length,
 			    he->h_addrtype);
 			if (result == NULL) {
 				if (debug)
@@ -661,11 +709,15 @@
 				continue;
 			}
 			rv = hostent_test_correctness(result, NULL);
-			if (rv != 0)
+			if (rv != 0) {
+			    __freehostent(result);
 			    return (rv);
+			}
 			
 			if (addr_test_data != NULL)
 			    TEST_DATA_APPEND(hostent, addr_test_data, result);
+			
+			__freehostent(result);
 		}
 	}
 	
@@ -715,11 +767,109 @@
 	return (0);
 }
 
+static int 
+hostent_test_getnameinfo_eq(struct hostent *he, void *mdata)
+{
+	char buffer[NI_MAXHOST];
+	struct sockaddr_in sin;
+	struct sockaddr_in6 sin6;
+	struct sockaddr *saddr;
+	struct hostent *result;
+	int rv;
+	
+	if (he->h_addr_list != NULL) {
+		char **cp;
+		for (cp = he->h_addr_list; *cp; ++cp) {
+			if (debug)
+			    printf("doing reverse lookup for %s\n", he->h_name);
+			
+			result = __gethostbyaddr(*cp, he->h_length,
+			    he->h_addrtype);
+			if (result != NULL) {
+				rv = hostent_test_correctness(result, NULL);
+				if (rv != 0) {
+				    __freehostent(result);
+				    return (rv);
+				}
+			} else {
+				if (debug)
+				    printf("reverse lookup failed\n");				
+			}
+			
+			switch (he->h_addrtype) {
+			case AF_INET:
+				memset(&sin, 0, sizeof(struct sockaddr_in));
+				sin.sin_len = sizeof(struct sockaddr_in);
+				sin.sin_family = AF_INET;
+				memcpy(&sin.sin_addr, *cp, he->h_length);
+				
+				saddr = (struct sockaddr *)&sin;
+				break;
+			case AF_INET6:
+				memset(&sin6, 0, sizeof(struct sockaddr_in6));
+				sin6.sin6_len = sizeof(struct sockaddr_in6);
+				sin6.sin6_family = AF_INET6;
+				memcpy(&sin6.sin6_addr, *cp, he->h_length);
+				
+				saddr = (struct sockaddr *)&sin6;
+				break;
+			default:
+				if (debug)
+					printf("warning: %d family is unsupported\n",
+						he->h_addrtype);
+				continue;
+			}
+			
+			assert(saddr != NULL);
+			rv = getnameinfo(saddr, saddr->sa_len, buffer, 
+				sizeof(buffer), NULL, 0, NI_NAMEREQD);
+			
+			if ((rv != 0) && (result != NULL)) {
+				if (debug)
+					printf("not ok - getnameinfo() didn't make the reverse lookup, when it should have (%s)\n",
+						gai_strerror(rv));
+				return (rv);
+			}
+			
+			if ((rv == 0) && (result == NULL)) {
+				if (debug)
+					printf("not ok - getnameinfo() made the reverse lookup, when it shouldn't have\n");					
+				return (rv);
+			}
+			
+			if ((rv != 0) && (result == NULL)) {
+				if (debug)
+					printf("ok - both getnameinfo() and ***byaddr() failed\n");
+				
+				continue;
+			}
+			
+			if (debug)
+				printf("comparing %s with %s\n", result->h_name,
+					buffer);			
+			
+			rv = strcmp(result->h_name, buffer);
+			__freehostent(result);
+			
+			if (rv != 0) {
+				if (debug)
+					printf("not ok - getnameinfo() and ***byaddr() results are not equal\n");
+				return (rv);
+			} else {
+				if (debug)
+					printf("ok - getnameinfo() and ***byaddr() results are equal\n");
+			}
+		}		
+	}
+	
+	return (0);	
+}
+
 static void
 usage(void)
 {
 	(void)fprintf(stderr,
-	    "Usage: %s [-dna2] [-s <file>] -f <file>\n",
+	    "Usage: %s [-na2i] [-d] [-46] [-s <file>] -f <file>\n",
 	    getprogname());
 	exit(1);
 }
@@ -727,8 +877,9 @@
 int
 main(int argc, char **argv)
 {
-	struct hostent_test_data td, td_snap;
+	struct hostent_test_data td, td_addr, td_snap;
 	char *snapshot_file, *hostlist_file;
+	res_state statp;	
 	int rv;
 	int c;
 	
@@ -737,10 +888,45 @@
 		
 	snapshot_file = NULL;
 	hostlist_file = NULL;
-	while ((c = getopt(argc, argv, "na2ds:f:")) != -1)
+	while ((c = getopt(argc, argv, "m46na2idos:f:")) != -1)
 		switch (c) {
+		case '4':
+		case '6':
+		case 'm':
+			statp = __res_state();
+			if ((statp == NULL) ||
+				((statp->options & RES_INIT) == 0 && 
+				res_ninit(statp) == -1)) {
+				if (debug)
+				    printf("error: can't init res_state\n");
+				
+				free(snapshot_file);
+				free(hostlist_file);
+				return (-1);
+			}
+		
+			switch (c) {
+			case '4':
+				af_type = AF_INET;
+				statp->options &= ~RES_USE_INET6;
+				break;
+			case '6':
+				af_type = AF_INET6;
+				statp->options &= ~RES_USE_INET6;
+				break;
+			case 'm':
+				statp->options |= RES_USE_INET6;
+				use_ipv6_mapping = 1;
+				break;
+			default:
+				break;
+			};
+			break;
+		case 'o':
+			use_ipnode_functions = 1;
+			break;
 		case 'd':
-			debug++;
+			debug = 1;
 			break;
 		case 'n':
 			method = TEST_GETHOSTBYNAME2;
@@ -751,6 +937,9 @@
 		case '2':
 			method = TEST_GETHOSTBYNAME2_GETADDRINFO;
 			break;
+		case 'i':
+			method = TEST_GETHOSTBYADDR_GETNAMEINFO;
+			break;
 		case 's':
 			snapshot_file = strdup(optarg);
 			break;
@@ -762,6 +951,7 @@
 		}
 	
 	TEST_DATA_INIT(hostent, &td, clone_hostent, free_hostent);
+	TEST_DATA_INIT(hostent, &td_addr, clone_hostent, free_hostent);
 	TEST_DATA_INIT(hostent, &td_snap, clone_hostent, free_hostent);
 			
 	if (hostlist_file == NULL)
@@ -777,16 +967,20 @@
 	
 	if (debug)
 		printf("building host lists from %s\n", hostlist_file);
+
 	rv = TEST_SNAPSHOT_FILE_READ(hostent, hostlist_file, &td,
 		hostent_read_hostlist_func);
 	if (rv != 0)
-		goto fin;	
-		
+		goto fin;
+	
 	if (snapshot_file != NULL) {
 		if (access(snapshot_file, W_OK | R_OK) != 0) {		
-			if (errno == ENOENT)
-				method = TEST_BUILD_SNAPSHOT;
-			else {
+			if (errno == ENOENT) {
+				if (method != TEST_GETHOSTBYADDR)
+					method = TEST_BUILD_SNAPSHOT;
+				else
+					method = TEST_BUILD_ADDR_SNAPSHOT;
+			} else {
 				if (debug)
 				    printf("can't access the snapshot file %s\n",
 				    snapshot_file);
@@ -795,13 +989,13 @@
 				goto fin;
 			}
 		} else {
-			if (method == TEST_BUILD_SNAPSHOT) {
-				rv = 0;
+			rv = TEST_SNAPSHOT_FILE_READ(hostent, snapshot_file,
+				&td_snap, hostent_read_snapshot_func);
+			if (rv != 0) {
+				if (debug)
+					printf("error reading snapshot file\n");
 				goto fin;
 			}
-			
-			TEST_SNAPSHOT_FILE_READ(hostent, snapshot_file,
-				&td_snap, hostent_read_snapshot_func);
 		}
 	}
 		
@@ -812,25 +1006,35 @@
 				compare_hostent, NULL);
 		break;
 	case TEST_GETHOSTBYADDR:
-		if (snapshot_file == NULL)
-			rv = DO_1PASS_TEST(hostent, &td,
-				hostent_test_gethostbyaddr, (void *)&td);
-		else
-			rv = DO_1PASS_TEST(hostent, &td_snap, 
-				hostent_test_gethostbyaddr, (void *)&td_snap);
+		rv = DO_1PASS_TEST(hostent, &td,
+			hostent_test_gethostbyaddr, (void *)&td_addr);
+
+		if (snapshot_file != NULL)
+			rv = DO_2PASS_TEST(hostent, &td_addr, &td_snap, 
+				compare_hostent, NULL);
 		break;
 	case TEST_GETHOSTBYNAME2_GETADDRINFO:
-		if (snapshot_file == NULL)
-			rv = DO_1PASS_TEST(hostent, &td,
-				hostent_test_getaddrinfo_eq, (void *)&td);
-		else
-			rv = DO_1PASS_TEST(hostent, &td_snap,
-				hostent_test_getaddrinfo_eq, (void *)&td);
+		rv = DO_1PASS_TEST(hostent, &td,
+			hostent_test_getaddrinfo_eq, NULL);
+		break;
+	case TEST_GETHOSTBYADDR_GETNAMEINFO:
+		rv = DO_1PASS_TEST(hostent, &td,
+			hostent_test_getnameinfo_eq, NULL);
 		break;
 	case TEST_BUILD_SNAPSHOT:
-		if (snapshot_file != NULL)
+		if (snapshot_file != NULL) {
 		    rv = TEST_SNAPSHOT_FILE_WRITE(hostent, snapshot_file, &td, 
 			sdump_hostent);
+		}
+		break;
+	case TEST_BUILD_ADDR_SNAPSHOT:
+		if (snapshot_file != NULL) {
+			rv = DO_1PASS_TEST(hostent, &td,
+				hostent_test_gethostbyaddr, (void *)&td_addr);
+			
+		    rv = TEST_SNAPSHOT_FILE_WRITE(hostent, snapshot_file, 
+			&td_addr, sdump_hostent);
+		}
 		break;
 	default:
 		rv = 0;
@@ -839,40 +1043,9 @@
 
 fin:
 	TEST_DATA_DESTROY(hostent, &td_snap);
+	TEST_DATA_DESTROY(hostent, &td_addr);
 	TEST_DATA_DESTROY(hostent, &td);
 	free(hostlist_file);
 	free(snapshot_file);
 	return (rv);
 }
-
-
-/*int
-main(int argc, char **argv)
-{
-	struct hostent_test_data td;
-	debug = 1;
-		
-	TEST_DATA_INIT(hostent, &td, clone_hostent, free_hostent);
-	hostent_fill_gethostbyname2_data("../resolv/mach", &td);
-	TEST_DATA_DESTROY(hostent, &td);
-	return (0);
-}*/
-
-/*int
-main(int argc, char **argv)
-{
-	char buffer[1024];
-	
-	struct hostent *he = gethostbyname("yandex.ru");
-	sdump_hostent(he, buffer, sizeof(buffer));
-	dump_hostent(he);
-	
-	struct hostent he2;
-	int rv = hostent_read_snapshot_func(&he2, buffer);
-	printf("rv %d\n", rv);
-	dump_hostent(&he2);
-	rv = compare_hostent(he, &he2, NULL);
-	printf("compare %d\n", rv);
-	
-	return (0);
-}*/

==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-gethostby.t#3 (text+ko) ====

@@ -18,12 +18,61 @@
 
 make $executable 2>&1 > /dev/null
 
-echo 1..8
-do_test 1 'gethostbyname2()'        '-n -f ../resolv/mach'
-do_test 2 'gethostbyaddr()'        '-a -f ../resolv/mach'
-do_test 3 'gethostbyname()-getaddrinfo()'  '-2 -f ../resolv/mach'
-do_test 5 'building snapshot, if needed' '-s snapshot_ht -f ../resolv/mach'
-do_test 6 'gethostbyname2() snapshot'     '-n -s snapshot_serv -f ../resolv/mach'
-do_test 7 'gethostbyaddr() snapshot'     '-a -s snapshot_serv -f ../resolv/mach'
-do_test 8 'gethostbyname2()-getaddrinfo snapshot'\
-	'-2 -s snapshot_serv -f ../resolv/mach'
+echo 1..32
+#Tests for gethostby***() functions
+#IPv4-driven testing
+do_test 1 'gethostbyname2() (IPv4)' '-4 -n -f mach'
+do_test 2 'gethostbyaddr() (IPv4)' '-4 -a -f mach'
+do_test 3 'gethostbyname2()-getaddrinfo() (IPv4)' '-4 -2 -f mach'
+do_test 4 'gethostbyaddr()-getnameinfo() (IPv4)' '-4 -i -f mach'
+do_test 5 'gethostbyname2() snapshot (IPv4)'\
+	'-4 -n -s snapshot_htname4 -f mach'
+do_test 6 'gethostbyaddr() snapshot (IPv4)'\
+	'-4 -a -s snapshot_htaddr4 -f mach'
+
+#IPv6-driven testing
+do_test 7 'gethostbyname2() (IPv6)' '-6 -n -f mach'
+do_test 8 'gethostbyaddr() (IPv6)' '-6 -a -f mach'
+do_test 9 'gethostbyname2()-getaddrinfo() (IPv6)' '-6 -2 -f mach'
+do_test 10 'gethostbyaddr()-getnameinfo() (IPv6)' '-6 -i -f mach'
+do_test 11 'gethostbyname2() snapshot (IPv6)'\
+	'-6 -n -s snapshot_htname6 -f mach'
+do_test 12 'gethostbyaddr() snapshot (IPv6)'\
+	'-6 -a -s snapshot_htaddr6 -f mach'
+	
+#Mapped IPv6-driven testing (getaddrinfo() equality test is useless here)
+do_test 13 'gethostbyname2() (IPv6 mapped)' '-m -n -f mach'
+do_test 14 'gethostbyaddr() (IPv6 mapped)' '-m -a -f mach'
+do_test 15 'gethostbyname2() snapshot (IPv6 mapped)'\
+	'-m -n -s snapshot_htname6map -f mach'
+do_test 16 'gethostbyaddr() snapshot (IPv6 mapped)'\
+	'-m -a -s snapshot_htaddr6map -f mach'
+
+#Tests for getipnodeby***() functions
+#IPv4-driven testing
+do_test 17 'getipnodebyname() (IPv4)' '-o -4 -n -f mach'
+do_test 18 'getipnodebyaddr() (IPv4)' '-o -4 -a -f mach'
+do_test 19 'getipnodebyname()-getaddrinfo() (IPv4)' '-o -4 -2 -f mach'
+do_test 20 'getipnodebyaddr()-getnameinfo() (IPv4)' '-o -4 -i -f mach'
+do_test 21 'getipnodebyname() snapshot (IPv4)'\
+	'-o -4 -n -s snapshot_ipnodename4 -f mach'
+do_test 22 'getipnodebyname() snapshot (IPv4)'\
+	'-o -4 -a -s snapshot_ipnodeaddr4 -f mach'
+
+#IPv6-driven testing
+do_test 23 'getipnodebyname() (IPv6)' '-o -6 -n -f mach'
+do_test 24 'getipnodebyaddr() (IPv6)' '-o -6 -a -f mach'
+do_test 25 'getipnodebyname()-getaddrinfo() (IPv6)' '-o -6 -2 -f mach'
+do_test 26 'getipnodebyaddr()-getnameinfo() (IPv6)' '-o -6 -i -f mach'
+do_test 27 'getipnodebyname() snapshot (IPv6)'\
+	'-o -6 -n -s snapshot_ipnodename6 -f mach'
+do_test 28 'getipnodebyaddr() snapshot (IPv6)'\
+	'-o -6 -a -s snapshot_ipnodeaddr6 -f mach'
+
+#Mapped IPv6-driven testing (getaddrinfo() equality test is useless here)
+do_test 29 'getipnodebyname() (IPv6)' '-o -m -n -f mach'
+do_test 30 'getipnodebyaddr() (IPv6)' '-o -m -a -f mach'
+do_test 31 'getipnodebyname() snapshot (IPv6)'\
+	'-o -m -n -s snapshot_ipnodename6map -f mach'
+do_test 32 'getipnodebyaddr() snapshot (IPv6)'\
+	'-o -m -a -s snapshot_ipnodeaddr6map -f mach'

==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getpw.c#4 (text+ko) ====


==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getpw.t#2 (text+ko) ====


==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getserv.c#6 (text+ko) ====


==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/test-getserv.t#5 (text+ko) ====


==== //depot/projects/soc2006/nss_ldap_cached/src/tools/regression/lib/libc/nss/testutil.h#7 (text+ko) ====

@@ -267,6 +267,7 @@
 	if (fi == NULL)							\
 		return (-1);						\
 									\
+	rv = 0;								\
 	memset(buffer, 0, sizeof(buffer));				\
 	while (!feof(fi)) {						\
 		s = fgets(buffer, sizeof(buffer), fi);			\
@@ -281,13 +282,14 @@
 			if (rv == 0) {					\
 				__##ent##_test_data_append(td, &data);	\
 				td->free_func(&data);			\
-			}						\
+			} else 						\
+				goto fin;				\
 		}							\
 	}								\
 									\
+fin:									\
 	fclose(fi);							\
-									\
-	return (0);							\
+	return (rv);							\
 }
 
 #define DECLARE_1PASS_TEST(ent)						\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607051714.k65HEGKU032373>