summaryrefslogtreecommitdiff
path: root/openbsd-compat/fake-getaddrinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/fake-getaddrinfo.c')
-rw-r--r--openbsd-compat/fake-getaddrinfo.c8
1 files changed, 7 insertions, 1 deletions
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;