Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/net disable AI_ADDRCONFIG (post RFC2553 specificati...



details:   https://anonhg.NetBSD.org/src/rev/accd9660a9d0
branches:  trunk
changeset: 485366:accd9660a9d0
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Apr 26 12:25:51 2000 +0000

description:
disable AI_ADDRCONFIG (post RFC2553 specification),
it has bug in PF_UNSPEC caes.  From: ume
fix boundary check which was broken by delint in the past.

diffstat:

 lib/libc/net/getaddrinfo.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (70 lines):

diff -r ad425b692b81 -r accd9660a9d0 lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c        Wed Apr 26 10:55:53 2000 +0000
+++ b/lib/libc/net/getaddrinfo.c        Wed Apr 26 12:25:51 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getaddrinfo.c,v 1.39 2000/04/24 10:40:24 itojun Exp $  */
+/*     $NetBSD: getaddrinfo.c,v 1.40 2000/04/26 12:25:51 itojun Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -78,7 +78,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getaddrinfo.c,v 1.39 2000/04/24 10:40:24 itojun Exp $");
+__RCSID("$NetBSD: getaddrinfo.c,v 1.40 2000/04/26 12:25:51 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -235,7 +235,9 @@
 static int get_portmatch __P((const struct addrinfo *, const char *));
 static int get_port __P((struct addrinfo *, const char *, int));
 static const struct afd *find_afd __P((int));
+#if 0
 static int addrconfig __P((const struct addrinfo *));
+#endif
 #ifdef INET6
 static int ip6_str2scopeid __P((char *, struct sockaddr_in6 *));
 #endif 
@@ -573,12 +575,16 @@
 
        result = NULL;
 
+#if 0
        /*
         * If AI_ADDRCONFIG is specified, check if we are expected to
         * return the address family or not.
+        * XXX does not handle PF_UNSPEC - should filter out result from
+        * nsdispatch()
         */
        if ((pai->ai_flags & AI_ADDRCONFIG) != 0 && !addrconfig(pai))
                return 0;
+#endif
 
        /*
         * if the servname does not match socktype/protocol, ignore it.
@@ -971,6 +977,7 @@
        return NULL;
 }
 
+#if 0
 /*
  * post-2553: AI_ADDRCONFIG check.  if we use getipnodeby* as backend, backend
  * will take care of it.
@@ -990,6 +997,7 @@
        close(s);
        return 1;
 }
+#endif
 
 #ifdef INET6
 /* convert a string to a scope identifier. XXX: IPv6 specific */
@@ -1844,7 +1852,7 @@
                        h_errno = NO_RECOVERY;
                        return (-1);
                }
-               if (n-- != 0 && name[n] == '.') {
+               if (n > 0 && name[--n] == '.') {
                        strncpy(nbuf, name, n);
                        nbuf[n] = '\0';
                } else



Home | Main Index | Thread Index | Old Index