summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--openbsd-compat/fake-getaddrinfo.c8
-rw-r--r--openbsd-compat/fake-getaddrinfo.h13
-rw-r--r--openbsd-compat/fake-getnameinfo.h8
4 files changed, 23 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 4981ecf4a..ad0724fb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
120030605
2 - (djm) Support AI_NUMERICHOST in fake-getaddrinfo.c. Needed for recent
3 canohost.c changes.
4
120030604 520030604
2 - (djm) Bug #573 - Remove unneeded Krb headers and compat goop. Patch from 6 - (djm) Bug #573 - Remove unneeded Krb headers and compat goop. Patch from
3 simon@sxw.org.uk (Also matches a change in OpenBSD a while ago) 7 simon@sxw.org.uk (Also matches a change in OpenBSD a while ago)
@@ -458,4 +462,4 @@
458 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. 462 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
459 Report from murple@murple.net, diagnosis from dtucker@zip.com.au 463 Report from murple@murple.net, diagnosis from dtucker@zip.com.au
460 464
461$Id: ChangeLog,v 1.2781 2003/06/04 12:56:15 djm Exp $ 465$Id: ChangeLog,v 1.2782 2003/06/04 23:48:32 djm Exp $
diff --git a/openbsd-compat/fake-getaddrinfo.c b/openbsd-compat/fake-getaddrinfo.c
index 7e6044a53..ebf736670 100644
--- a/openbsd-compat/fake-getaddrinfo.c
+++ b/openbsd-compat/fake-getaddrinfo.c
@@ -13,7 +13,7 @@
13#include "xmalloc.h" 13#include "xmalloc.h"
14#include "ssh.h" 14#include "ssh.h"
15 15
16RCSID("$Id: fake-getaddrinfo.c,v 1.8 2003/05/19 00:39:37 djm Exp $"); 16RCSID("$Id: fake-getaddrinfo.c,v 1.9 2003/06/04 23:48:33 djm Exp $");
17 17
18#ifndef HAVE_GAI_STRERROR 18#ifndef HAVE_GAI_STRERROR
19char * 19char *
@@ -24,6 +24,8 @@ gai_strerror(int err)
24 return ("no address associated with name"); 24 return ("no address associated with name");
25 case EAI_MEMORY: 25 case EAI_MEMORY:
26 return ("memory allocation failure."); 26 return ("memory allocation failure.");
27 case EAI_NONAME:
28 return ("nodename nor servname provided, or not known");
27 default: 29 default:
28 return ("unknown/invalid error."); 30 return ("unknown/invalid error.");
29 } 31 }
@@ -116,6 +118,10 @@ getaddrinfo(const char *hostname, const char *servname,
116 return (0); 118 return (0);
117 } 119 }
118 120
121 /* Don't try DNS if AI_NUMERICHOST is set */
122 if (hints && hints->ai_flags & AI_NUMERICHOST)
123 return (EAI_NONAME);
124
119 hp = gethostbyname(hostname); 125 hp = gethostbyname(hostname);
120 if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { 126 if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
121 struct addrinfo *cur, *prev; 127 struct addrinfo *cur, *prev;
diff --git a/openbsd-compat/fake-getaddrinfo.h b/openbsd-compat/fake-getaddrinfo.h
index 6943378e9..eaba323d1 100644
--- a/openbsd-compat/fake-getaddrinfo.h
+++ b/openbsd-compat/fake-getaddrinfo.h
@@ -1,4 +1,4 @@
1/* $Id: fake-getaddrinfo.h,v 1.4 2003/02/24 01:35:09 djm Exp $ */ 1/* $Id: fake-getaddrinfo.h,v 1.5 2003/06/04 23:48:33 djm Exp $ */
2 2
3#ifndef _FAKE_GETADDRINFO_H 3#ifndef _FAKE_GETADDRINFO_H
4#define _FAKE_GETADDRINFO_H 4#define _FAKE_GETADDRINFO_H
@@ -8,14 +8,9 @@
8#include "fake-gai-errnos.h" 8#include "fake-gai-errnos.h"
9 9
10#ifndef AI_PASSIVE 10#ifndef AI_PASSIVE
11# define AI_PASSIVE 1 11# define AI_PASSIVE (1)
12# define AI_CANONNAME 2 12# define AI_CANONNAME (1<<1)
13#endif 13# define AI_NUMERICHOST (1<<2)
14
15#ifndef NI_NUMERICHOST
16# define NI_NUMERICHOST 2
17# define NI_NAMEREQD 4
18# define NI_NUMERICSERV 8
19#endif 14#endif
20 15
21#ifndef HAVE_STRUCT_ADDRINFO 16#ifndef HAVE_STRUCT_ADDRINFO
diff --git a/openbsd-compat/fake-getnameinfo.h b/openbsd-compat/fake-getnameinfo.h
index 7aaabc7f6..6c1bb30a4 100644
--- a/openbsd-compat/fake-getnameinfo.h
+++ b/openbsd-compat/fake-getnameinfo.h
@@ -1,4 +1,4 @@
1/* $Id: fake-getnameinfo.h,v 1.3 2003/05/18 14:13:39 djm Exp $ */ 1/* $Id: fake-getnameinfo.h,v 1.4 2003/06/04 23:48:33 djm Exp $ */
2 2
3#ifndef _FAKE_GETNAMEINFO_H 3#ifndef _FAKE_GETNAMEINFO_H
4#define _FAKE_GETNAMEINFO_H 4#define _FAKE_GETNAMEINFO_H
@@ -10,6 +10,12 @@ int getnameinfo(const struct sockaddr *, size_t, char *, size_t,
10 char *, size_t, int); 10 char *, size_t, int);
11#endif /* !HAVE_GETNAMEINFO */ 11#endif /* !HAVE_GETNAMEINFO */
12 12
13#ifndef NI_NUMERICHOST
14# define NI_NUMERICHOST (1)
15# define NI_NAMEREQD (1<<1)
16# define NI_NUMERICSERV (1<<2)
17#endif
18
13#ifndef NI_MAXSERV 19#ifndef NI_MAXSERV
14# define NI_MAXSERV 32 20# define NI_MAXSERV 32
15#endif /* !NI_MAXSERV */ 21#endif /* !NI_MAXSERV */