summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2009-03-24 17:47:24 +0000
committerume <ume@FreeBSD.org>2009-03-24 17:47:24 +0000
commit9572ca2bf0394e29842c57382b178f4506c4113b (patch)
treebe70ffc5609653ce1d308653b5d5d3cb06d22d76
parent31a3addbde899055e0182eaa6828dcf2d808f971 (diff)
downloadFreeBSD-src-9572ca2bf0394e29842c57382b178f4506c4113b.zip
FreeBSD-src-9572ca2bf0394e29842c57382b178f4506c4113b.tar.gz
getaddrinfo(3) should accept numeric when ai_socktype is not
specified in hint or hints is NULL. PR: bin/51827 Submitted by: Mark Andrews <marka__at__isc.org> MFC after: 1 week
-rw-r--r--lib/libc/net/getaddrinfo.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index 941c315..21ba70e 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -1347,7 +1347,17 @@ get_port(struct addrinfo *ai, const char *servname, int matchonly)
allownumeric = 1;
break;
case ANY:
- allownumeric = 0;
+ switch (ai->ai_family) {
+ case AF_INET:
+#ifdef AF_INET6
+ case AF_INET6:
+#endif
+ allownumeric = 1;
+ break;
+ default:
+ allownumeric = 0;
+ break;
+ }
break;
default:
return EAI_SOCKTYPE;
OpenPOWER on IntegriCloud