summaryrefslogtreecommitdiff
path: root/openbsd-compat/fake-rfc2553.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2009-12-29 21:42:53 +0000
committerColin Watson <cjwatson@debian.org>2009-12-29 21:42:53 +0000
commit87552344215a38d3a2b0d4d63dc151e05978bbe1 (patch)
tree9f4b96055e6ccaa915e8d59d9f2805e9e119371d /openbsd-compat/fake-rfc2553.c
parenta25ec0b132c44c9e341e08464ff830de06b81126 (diff)
parentef94e5613d37bcbf880f21ee6094e4b1c7683a4c (diff)
import openssh-5.1p1-gsskex-cjwatson-20080722.patch
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 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