From: hno <> Date: Sat, 18 Jan 2003 22:00:39 +0000 (+0000) Subject: Cleanup of last nights changes for dots in hostnames. Now double dots are X-Git-Tag: SQUID_3_0_PRE1~444 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8f57256db7127e058bbc89299c79cf185e916f78;p=thirdparty%2Fsquid.git Cleanup of last nights changes for dots in hostnames. Now double dots are rejected rather than cleaned up, and leading dots is also rejected to produce a conforming experience on all types of DNS resolvers. Trailing dots is normalized as before, but after append_domain to allow override of append_domain for top level domains (http://dk./) --- diff --git a/src/url.cc b/src/url.cc index 1e3df00d85..93c153fb0f 100644 --- a/src/url.cc +++ b/src/url.cc @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.140 2003/01/18 02:27:16 hno Exp $ + * $Id: url.cc,v 1.141 2003/01/18 15:00:39 hno Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -318,16 +318,16 @@ urlParse(method_t method, char *url) return NULL; } #endif -#if DONT_DO_THIS_IT_BREAKS_SEMANTIC_TRANSPARENCY + if (Config.appendDomain && !strchr(host, '.')) + strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN); /* remove trailing dots from hostnames */ while ((l = strlen(host)) > 0 && host[--l] == '.') host[l] = '\0'; - /* remove duplicate dots */ - while ((t = strstr(host, ".."))) - xmemmove(t, t + 1, strlen(t)); -#endif - if (Config.appendDomain && !strchr(host, '.')) - strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN); + /* reject duplicate or leading dots */ + if (strstr(host, "..") || *host == '.') { + debug(23, 1) ("urlParse: Illegal hostname '%s'\n", host); + return NULL; + } if (port < 1 || port > 65535) { debug(23, 3) ("urlParse: Invalid port '%d'\n", port); return NULL;