summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-07-14 21:37:36 +1000
committerDamien Miller <djm@mindrot.org>2008-07-14 21:37:36 +1000
commitc4657ef1818c67e91115389a69ef783412fd54b7 (patch)
treef86bf4b3212b32010f473baa414a5321a0f99aee
parent1fc231cbb50f899a1aa6c919c4d7750876b01f2e (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
-rw-r--r--ChangeLog5
-rw-r--r--openbsd-compat/fake-rfc2553.c7
-rw-r--r--openbsd-compat/fake-rfc2553.h5
3 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d60f16c9a..b72d47203 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,9 @@
42 [scp.1] 42 [scp.1]
43 better description for -i flag: 43 better description for -i flag:
44 s/RSA authentication/public key authentication/ 44 s/RSA authentication/public key authentication/
45 - (djm) [openbsd-compat/fake-rfc2553.c openbsd-compat/fake-rfc2553.h]
46 return EAI_FAMILY when trying to lookup unsupported address family;
47 from vinschen AT redhat.com
45 48
4620080711 4920080711
47 - (djm) OpenBSD CVS Sync 50 - (djm) OpenBSD CVS Sync
@@ -4667,4 +4670,4 @@
4667 OpenServer 6 and add osr5bigcrypt support so when someone migrates 4670 OpenServer 6 and add osr5bigcrypt support so when someone migrates
4668 passwords between UnixWare and OpenServer they will still work. OK dtucker@ 4671 passwords between UnixWare and OpenServer they will still work. OK dtucker@
4669 4672
4670$Id: ChangeLog,v 1.5083 2008/07/14 02:12:52 djm Exp $ 4673$Id: ChangeLog,v 1.5084 2008/07/14 11:37:36 djm Exp $
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
diff --git a/openbsd-compat/fake-rfc2553.h b/openbsd-compat/fake-rfc2553.h
index 13240970f..3e9090fc8 100644
--- a/openbsd-compat/fake-rfc2553.h
+++ b/openbsd-compat/fake-rfc2553.h
@@ -1,4 +1,4 @@
1/* $Id: fake-rfc2553.h,v 1.15 2008/06/10 13:52:51 dtucker Exp $ */ 1/* $Id: fake-rfc2553.h,v 1.16 2008/07/14 11:37:37 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 2000-2003 Damien Miller. All rights reserved. 4 * Copyright (C) 2000-2003 Damien Miller. All rights reserved.
@@ -129,6 +129,9 @@ struct sockaddr_in6 {
129#ifndef EAI_SYSTEM 129#ifndef EAI_SYSTEM
130# define EAI_SYSTEM (INT_MAX - 4) 130# define EAI_SYSTEM (INT_MAX - 4)
131#endif 131#endif
132#ifndef EAI_FAMILY
133# define EAI_FAMILY (INT_MAX - 5)
134#endif
132 135
133#ifndef HAVE_STRUCT_ADDRINFO 136#ifndef HAVE_STRUCT_ADDRINFO
134struct addrinfo { 137struct addrinfo {