summaryrefslogtreecommitdiff
path: root/openbsd-compat/fake-rfc2553.c
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2008-07-23 09:33:08 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2008-07-23 09:33:08 +0000
commit5521539314d87d3432e3c5c0e74954a673a884bd (patch)
tree8f06d9ad2f958f06e579924065ecbaf74dd734f7 /openbsd-compat/fake-rfc2553.c
parentd4033b6b6f7aa0e69be09f9613e062e0fb7a9f11 (diff)
downloadsrc-test2-5521539314d87d3432e3c5c0e74954a673a884bd.tar.gz
src-test2-5521539314d87d3432e3c5c0e74954a673a884bd.zip
Notes
Diffstat (limited to 'openbsd-compat/fake-rfc2553.c')
-rw-r--r--openbsd-compat/fake-rfc2553.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/openbsd-compat/fake-rfc2553.c b/openbsd-compat/fake-rfc2553.c
index b6ea3d21e342..096d9e092e29 100644
--- a/openbsd-compat/fake-rfc2553.c
+++ b/openbsd-compat/fake-rfc2553.c
@@ -51,6 +51,8 @@ int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
struct hostent *hp;
char tmpserv[16];
+ if (sa->sa_family != AF_UNSPEC && sa->sa_family != AF_INET)
+ return (EAI_FAMILY);
if (serv != NULL) {
snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin->sin_port));
if (strlcpy(serv, tmpserv, servlen) >= servlen)
@@ -95,6 +97,8 @@ gai_strerror(int err)
return ("memory allocation failure.");
case EAI_NONAME:
return ("nodename nor servname provided, or not known");
+ case EAI_FAMILY:
+ return ("ai_family not supported");
default:
return ("unknown/invalid error.");
}
@@ -159,6 +163,9 @@ getaddrinfo(const char *hostname, const char *servname,
u_long addr;
port = 0;
+ if (hints && hints->ai_family != AF_UNSPEC &&
+ hints->ai_family != AF_INET)
+ return (EAI_FAMILY);
if (servname != NULL) {
char *cp;