]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Matthias Pitzl <silamael@coronamundi.de>
authorAmos Jeffries <amosjeffries@squid-cache.org>
Thu, 24 Jun 2010 13:23:42 +0000 (07:23 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Thu, 24 Jun 2010 13:23:42 +0000 (07:23 -0600)
Bug 2967: raw-IPv6 address URL with append_domain broken

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

index 472e95ff60828f4a16754db5bb274b7ab8d6b181..bb4f78de935b72d2c40bf55d3f7265d4c883b82b 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 998d51dbb3861337a2c92a52ad8671cb6bd4275c..c8b8e4d2e0888b5c7e9fb9a665899a48839c366d 100644 (file)
@@ -1113,7 +1113,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 43b0f465c8ec94b54a11172f4c580ffeda4a1c57..c4e4d5ef784bd2c9520892ee3af453ce34a7f6be 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 */