Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/net From: "Jason L. Wright" <jason%thought.net@localhost>



details:   https://anonhg.NetBSD.org/src/rev/221d6d5651bd
branches:  trunk
changeset: 544347:221d6d5651bd
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Mar 17 23:10:25 2003 +0000

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

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.

diffstat:

 lib/libc/net/getaddrinfo.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 1b41b1df4b20 -r 221d6d5651bd lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c        Mon Mar 17 23:05:41 2003 +0000
+++ b/lib/libc/net/getaddrinfo.c        Mon Mar 17 23:10:25 2003 +0000
@@ -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 @@
        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.



Home | Main Index | Thread Index | Old Index