]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Matthias Pitzl <silamael@coronamundi.de>
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 27 Jun 2010 09:54:35 +0000 (21:54 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 27 Jun 2010 09:54:35 +0000 (21:54 +1200)
Bug 2967: raw-IPv6 address URL with append_domain broken

src/internal.cc
src/tools.cc
src/url.cc

index b152feccfb1bf56d868547f9fd9cf14394d2e73f..f6082d27e10501b0395f552471e879c2172821fe 100644 (file)
@@ -114,7 +114,12 @@ internalRemoteUri(const char *host, u_short port, const char *dir, const char *n
      * domains
      */
 
+#if USE_IPV6
+    /* For IPV6 addresses also check for a colon */
+    if (Config.appendDomain && !strchr(lc_host, '.') && !strchr(lc_host, ':'))
+#else
     if (Config.appendDomain && !strchr(lc_host, '.'))
+#endif
         strncat(lc_host, Config.appendDomain, SQUIDHOSTNAMELEN -
                 strlen(lc_host) - 1);
 
@@ -154,7 +159,12 @@ internalHostname(void)
     LOCAL_ARRAY(char, host, SQUIDHOSTNAMELEN + 1);
     xstrncpy(host, getMyHostname(), SQUIDHOSTNAMELEN);
 
+#if USE_IPV6
+    /* For IPV6 addresses also check for a colon */
+    if (Config.appendDomain && !strchr(host, '.') && !strchr(host, ':'))
+#else
     if (Config.appendDomain && !strchr(host, '.'))
+#endif
         strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN -
                 strlen(host) - 1);
 
index 70f961c45922b39c5eca2efe83e1763acb7eb861..f56313e7a27d58f806cef5807d0cd041c0f4e6f7 100644 (file)
@@ -1110,7 +1110,12 @@ parseEtcHosts(void)
             *nt = '\0';
             debugs(1, 5, "etc_hosts: got hostname '" << lt << "'");
 
+#if USE_IPV6
+            /* For IPV6 addresses also check for a colon */
+            if (Config.appendDomain && !strchr(lt, '.') && !strchr(lt, ':')) {
+#else
             if (Config.appendDomain && !strchr(lt, '.')) {
+#endif
                 /* I know it's ugly, but it's only at reconfig */
                 strncpy(buf2, lt, 512);
                 strncat(buf2, Config.appendDomain, 512 - strlen(lt) - 1);
index d9ac26f6d782e5a8eb59aef7a5b7b6e80d7a443e..070f5eef2de2121a620d173f16c227dbe1ed9349 100644 (file)
@@ -351,7 +351,12 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest *request)
         return NULL;
     }
 
+#if USE_IPV6
+    /* For IPV6 addresses also check for a colon */
+    if (Config.appendDomain && !strchr(host, '.') && !strchr(host, ':'))
+#else
     if (Config.appendDomain && !strchr(host, '.'))
+#endif
         strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN - strlen(host) - 1);
 
     /* remove trailing dots from hostnames */