diff options
author | Damien Miller <djm@mindrot.org> | 2003-06-05 09:48:32 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2003-06-05 09:48:32 +1000 |
commit | 10eac0cf8f946526a7c0c5cd89287076f792b65d (patch) | |
tree | 009eec7a4a142af9ea1cccae3bcf38fb452ff999 /openbsd-compat | |
parent | 66c884070e57b8ac3db5ead0f51e73ea0ba3ccb0 (diff) |
- (djm) Support AI_NUMERICHOST in fake-getaddrinfo.c. Needed for recent
canohost.c changes.
Diffstat (limited to 'openbsd-compat')
-rw-r--r-- | openbsd-compat/fake-getaddrinfo.c | 8 | ||||
-rw-r--r-- | openbsd-compat/fake-getaddrinfo.h | 13 | ||||
-rw-r--r-- | openbsd-compat/fake-getnameinfo.h | 8 |
3 files changed, 18 insertions, 11 deletions
diff --git a/openbsd-compat/fake-getaddrinfo.c b/openbsd-compat/fake-getaddrinfo.c index 7e6044a5..ebf73667 100644 --- a/openbsd-compat/fake-getaddrinfo.c +++ b/openbsd-compat/fake-getaddrinfo.c @@ -13,7 +13,7 @@ #include "xmalloc.h" #include "ssh.h" -RCSID("$Id: fake-getaddrinfo.c,v 1.8 2003/05/19 00:39:37 djm Exp $"); +RCSID("$Id: fake-getaddrinfo.c,v 1.9 2003/06/04 23:48:33 djm Exp $"); #ifndef HAVE_GAI_STRERROR char * @@ -24,6 +24,8 @@ gai_strerror(int err) return ("no address associated with name"); case EAI_MEMORY: return ("memory allocation failure."); + case EAI_NONAME: + return ("nodename nor servname provided, or not known"); default: return ("unknown/invalid error."); } @@ -116,6 +118,10 @@ getaddrinfo(const char *hostname, const char *servname, return (0); } + /* Don't try DNS if AI_NUMERICHOST is set */ + if (hints && hints->ai_flags & AI_NUMERICHOST) + return (EAI_NONAME); + hp = gethostbyname(hostname); if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { struct addrinfo *cur, *prev; diff --git a/openbsd-compat/fake-getaddrinfo.h b/openbsd-compat/fake-getaddrinfo.h index 6943378e..eaba323d 100644 --- a/openbsd-compat/fake-getaddrinfo.h +++ b/openbsd-compat/fake-getaddrinfo.h @@ -1,4 +1,4 @@ -/* $Id: fake-getaddrinfo.h,v 1.4 2003/02/24 01:35:09 djm Exp $ */ +/* $Id: fake-getaddrinfo.h,v 1.5 2003/06/04 23:48:33 djm Exp $ */ #ifndef _FAKE_GETADDRINFO_H #define _FAKE_GETADDRINFO_H @@ -8,14 +8,9 @@ #include "fake-gai-errnos.h" #ifndef AI_PASSIVE -# define AI_PASSIVE 1 -# define AI_CANONNAME 2 -#endif - -#ifndef NI_NUMERICHOST -# define NI_NUMERICHOST 2 -# define NI_NAMEREQD 4 -# define NI_NUMERICSERV 8 +# define AI_PASSIVE (1) +# define AI_CANONNAME (1<<1) +# define AI_NUMERICHOST (1<<2) #endif #ifndef HAVE_STRUCT_ADDRINFO diff --git a/openbsd-compat/fake-getnameinfo.h b/openbsd-compat/fake-getnameinfo.h index 7aaabc7f..6c1bb30a 100644 --- a/openbsd-compat/fake-getnameinfo.h +++ b/openbsd-compat/fake-getnameinfo.h @@ -1,4 +1,4 @@ -/* $Id: fake-getnameinfo.h,v 1.3 2003/05/18 14:13:39 djm Exp $ */ +/* $Id: fake-getnameinfo.h,v 1.4 2003/06/04 23:48:33 djm Exp $ */ #ifndef _FAKE_GETNAMEINFO_H #define _FAKE_GETNAMEINFO_H @@ -10,6 +10,12 @@ int getnameinfo(const struct sockaddr *, size_t, char *, size_t, char *, size_t, int); #endif /* !HAVE_GETNAMEINFO */ +#ifndef NI_NUMERICHOST +# define NI_NUMERICHOST (1) +# define NI_NAMEREQD (1<<1) +# define NI_NUMERICSERV (1<<2) +#endif + #ifndef NI_MAXSERV # define NI_MAXSERV 32 #endif /* !NI_MAXSERV */ |