]> sjero.net Git - wget/commitdiff
[svn] Return an error from url_parse if the IP address is IPv6 and we don't
authorhniksic <devnull@localhost>
Tue, 9 Sep 2003 13:06:58 +0000 (06:06 -0700)
committerhniksic <devnull@localhost>
Tue, 9 Sep 2003 13:06:58 +0000 (06:06 -0700)
handle IPv6.

src/ChangeLog
src/url.c

index 06ee80e4a0d81e3ed930536aecaf5892d5057011..15affbcabe5079189e133cdc5ce822759f0eabcd 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-09  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * url.c (url_parse): Return an error if the URL contains a [...]
+       IPv6 numeric address and we don't support IPv6.
+
 2003-09-05  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * url.c (is_valid_ipv6_address): Modified to not require
index b5cb388b41b3325450b4333c2f1b9f49ec29d2bf..5435f9bc0709ab12801d3deeefa50fcb07588323 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -649,7 +649,9 @@ static char *parse_errors[] = {
   "Invalid user name",
 #define PE_UNTERMINATED_IPV6_ADDRESS   5
   "Unterminated IPv6 numeric address",
-#define PE_INVALID_IPV6_ADDRESS                6
+#define PE_IPV6_NOT_SUPPORTED          6
+  "IPv6 addresses not supported",
+#define PE_INVALID_IPV6_ADDRESS                7
   "Invalid IPv6 numeric address"
 };
 
@@ -658,6 +660,7 @@ static char *parse_errors[] = {
     *(p) = (v);                                        \
 } while (0)
 
+#ifdef INET6
 /* The following two functions were adapted from glibc. */
 
 static int
@@ -787,7 +790,7 @@ is_valid_ipv6_address (const char *str, const char *end)
 
   return 1;
 }
-
+#endif
 
 /* Parse a URL.
 
@@ -860,6 +863,7 @@ url_parse (const char *url, int *error)
          return NULL;
        }
 
+#ifdef INET6
       /* Check if the IPv6 address is valid. */
       if (!is_valid_ipv6_address(host_b, host_e))
        {
@@ -869,6 +873,10 @@ url_parse (const char *url, int *error)
 
       /* Continue parsing after the closing ']'. */
       p = host_e + 1;
+#else
+      SETERR (error, PE_IPV6_NOT_SUPPORTED);
+      return NULL;
+#endif
     }
   else
     {