From: Amos Jeffries Date: Thu, 24 Jun 2010 13:23:42 +0000 (-0600) Subject: Author: Matthias Pitzl X-Git-Tag: SQUID_3_2_0_1~123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=532e5dd46a2b8091fd93ddd7edcb240474faccc3;p=thirdparty%2Fsquid.git Author: Matthias Pitzl Bug 2967: raw-IPv6 address URL with append_domain broken --- diff --git a/src/internal.cc b/src/internal.cc index 472e95ff60..bb4f78de93 100644 --- a/src/internal.cc +++ b/src/internal.cc @@ -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); diff --git a/src/tools.cc b/src/tools.cc index 998d51dbb3..c8b8e4d2e0 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -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); diff --git a/src/url.cc b/src/url.cc index 43b0f465c8..c4e4d5ef78 100644 --- a/src/url.cc +++ b/src/url.cc @@ -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 */