- (djm) Support AI_NUMERICHOST in fake-getaddrinfo.c. Needed for recent

canohost.c changes.
This commit is contained in:
Damien Miller 2003-06-05 09:48:32 +10:00
parent 66c884070e
commit 10eac0cf8f
4 changed files with 23 additions and 12 deletions

View File

@ -1,3 +1,7 @@
20030605
- (djm) Support AI_NUMERICHOST in fake-getaddrinfo.c. Needed for recent
canohost.c changes.
20030604
- (djm) Bug #573 - Remove unneeded Krb headers and compat goop. Patch from
simon@sxw.org.uk (Also matches a change in OpenBSD a while ago)
@ -458,4 +462,4 @@
- Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
Report from murple@murple.net, diagnosis from dtucker@zip.com.au
$Id: ChangeLog,v 1.2781 2003/06/04 12:56:15 djm Exp $
$Id: ChangeLog,v 1.2782 2003/06/04 23:48:32 djm Exp $

View File

@ -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;

View File

@ -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

View File

@ -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 */