diff options
author | Damien Miller <djm@mindrot.org> | 2008-07-14 21:37:36 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2008-07-14 21:37:36 +1000 |
commit | c4657ef1818c67e91115389a69ef783412fd54b7 (patch) | |
tree | f86bf4b3212b32010f473baa414a5321a0f99aee /openbsd-compat/fake-rfc2553.c | |
parent | 1fc231cbb50f899a1aa6c919c4d7750876b01f2e (diff) |
- (djm) [openbsd-compat/fake-rfc2553.c openbsd-compat/fake-rfc2553.h]
return EAI_FAMILY when trying to lookup unsupported address family;
from vinschen AT redhat.com
Diffstat (limited to 'openbsd-compat/fake-rfc2553.c')
-rw-r--r-- | openbsd-compat/fake-rfc2553.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/openbsd-compat/fake-rfc2553.c b/openbsd-compat/fake-rfc2553.c index b6ea3d21e..096d9e092 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, | |||
51 | struct hostent *hp; | 51 | struct hostent *hp; |
52 | char tmpserv[16]; | 52 | char tmpserv[16]; |
53 | 53 | ||
54 | if (sa->sa_family != AF_UNSPEC && sa->sa_family != AF_INET) | ||
55 | return (EAI_FAMILY); | ||
54 | if (serv != NULL) { | 56 | if (serv != NULL) { |
55 | snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin->sin_port)); | 57 | snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin->sin_port)); |
56 | if (strlcpy(serv, tmpserv, servlen) >= servlen) | 58 | if (strlcpy(serv, tmpserv, servlen) >= servlen) |
@@ -95,6 +97,8 @@ gai_strerror(int err) | |||
95 | return ("memory allocation failure."); | 97 | return ("memory allocation failure."); |
96 | case EAI_NONAME: | 98 | case EAI_NONAME: |
97 | return ("nodename nor servname provided, or not known"); | 99 | return ("nodename nor servname provided, or not known"); |
100 | case EAI_FAMILY: | ||
101 | return ("ai_family not supported"); | ||
98 | default: | 102 | default: |
99 | return ("unknown/invalid error."); | 103 | return ("unknown/invalid error."); |
100 | } | 104 | } |
@@ -159,6 +163,9 @@ getaddrinfo(const char *hostname, const char *servname, | |||
159 | u_long addr; | 163 | u_long addr; |
160 | 164 | ||
161 | port = 0; | 165 | port = 0; |
166 | if (hints && hints->ai_family != AF_UNSPEC && | ||
167 | hints->ai_family != AF_INET) | ||
168 | return (EAI_FAMILY); | ||
162 | if (servname != NULL) { | 169 | if (servname != NULL) { |
163 | char *cp; | 170 | char *cp; |
164 | 171 | ||