From: "Jason L. Wright" <jason@thought.net>

The man page for getaddrinfo() and RFC2553 says it should return EAI_NONAME
for the case where hostname != NULL, hostname is not a numeric string and
ai_flags has the AI_NUMERICHOST bit set.  Instead, it returns EAI_NODATA
for this case.  The diff below makes it return EAI_NONAME for this case.

This is why ntpq and ntpdc from ntp-4.1.74 can't resolve hostnames,
but work fine with numeric strings like ::1 or 127.0.0.1.
This commit is contained in:
itojun 2003-03-17 23:10:25 +00:00
parent ba893423e9
commit b5dda3e238
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: getaddrinfo.c,v 1.63 2002/08/27 08:50:49 itojun Exp $ */
/* $NetBSD: getaddrinfo.c,v 1.64 2003/03/17 23:10:25 itojun Exp $ */
/* $KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $ */
/*
@ -79,7 +79,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getaddrinfo.c,v 1.63 2002/08/27 08:50:49 itojun Exp $");
__RCSID("$NetBSD: getaddrinfo.c,v 1.64 2003/03/17 23:10:25 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -500,10 +500,10 @@ getaddrinfo(hostname, servname, hints, res)
if (sentinel.ai_next)
goto good;
if (pai->ai_flags & AI_NUMERICHOST)
ERR(EAI_NODATA);
if (hostname == NULL)
ERR(EAI_NODATA);
if (pai->ai_flags & AI_NUMERICHOST)
ERR(EAI_NONAME);
/*
* hostname as alphabetical name.