]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup:
authorAndreas Gustafsson <source@isc.org>
Thu, 24 Jan 2002 18:42:29 +0000 (18:42 +0000)
committerAndreas Gustafsson <source@isc.org>
Thu, 24 Jan 2002 18:42:29 +0000 (18:42 +0000)
 995.   [bug]           dig, host, nslookup: using a raw IPv6 address as a
                        target address should be fatal on a IPv4 only system.

CHANGES
bin/dig/dighost.c

diff --git a/CHANGES b/CHANGES
index b878e1f1d2576e9536c32ab9dcdf07abf368a752..ebd06b74a50a533f7d9ad9c3b40275a85ce02971 100644 (file)
--- a/CHANGES
+++ b/CHANGES
                        in the case of queries answered from the cache.
                        [RT #1436]
 
+ 995.  [bug]           dig, host, nslookup: using a raw IPv6 address as a
+                       target address should be fatal on a IPv4 only system.
+
        --- 9.2.0 released ---
 
 1134.  [bug]           Multithreaded servers could deadlock in ferror()
index e357b468f15bacb2ebf7d39c33a618f2eb0879a1..b7deb693ceca6282217a91afe965bde14ed2126d 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dighost.c,v 1.221.2.8 2001/11/28 23:29:13 gson Exp $ */
+/* $Id: dighost.c,v 1.221.2.9 2002/01/24 18:42:29 gson Exp $ */
 
 /*
  * Notice to programmers:  Do not use this code as an example of how to
@@ -2393,15 +2393,16 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
 
        debug("get_address()");
 
-       /*
-        * Assume we have v4 if we don't have v6, since setup_libs
-        * fatal()'s out if we don't have either.
-        */
-       if (have_ipv6 && inet_pton(AF_INET6, host, &in6) == 1)
+       if (inet_pton(AF_INET6, host, &in6) == 1) {
+               if (!have_ipv6)
+                       fatal("Protocol family INET6 not supported '%s'", host);
                isc_sockaddr_fromin6(sockaddr, &in6, port);
-       else if (inet_pton(AF_INET, host, &in4) == 1)
-               isc_sockaddr_fromin(sockaddr, &in4, port);
-       else {
+       } else if (inet_pton(AF_INET, host, &in4) == 1) {
+               if (have_ipv4)
+                       isc_sockaddr_fromin(sockaddr, &in4, port);
+               else
+                       isc_sockaddr_v6fromin(sockaddr, &in4, port);
+       } else {
 #ifdef USE_GETADDRINFO
                memset(&hints, 0, sizeof(hints));
                if (!have_ipv6)