]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup of last nights changes for dots in hostnames. Now double dots are
authorhno <>
Sat, 18 Jan 2003 22:00:39 +0000 (22:00 +0000)
committerhno <>
Sat, 18 Jan 2003 22:00:39 +0000 (22:00 +0000)
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./)

src/url.cc

index 1e3df00d85168b33a4284c52f4f7124d3ce70c08..93c153fb0f33266c5bb9c2165abf1dd1ee267ea4 100644 (file)
@@ -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;