]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
--disable-hostname-checks configure option
authorhno <>
Sat, 18 Jan 2003 09:27:14 +0000 (09:27 +0000)
committerhno <>
Sat, 18 Jan 2003 09:27:14 +0000 (09:27 +0000)
also removed the dot magics. These are more evil than helpful and breaks
semantic transparency in certain configurations.

configure.in
include/autoconf.h.in
src/url.cc

index 5d3136b6a59bd96e6ae1a4903b3fb4ae07770946..bf02a9e965569361265ed874b2e28470e4b6e868 100644 (file)
@@ -3,7 +3,7 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.312 2003/01/18 02:10:37 hno Exp $
+dnl  $Id: configure.in,v 1.313 2003/01/18 02:27:14 hno Exp $
 dnl
 dnl
 dnl
@@ -13,7 +13,7 @@ AC_CONFIG_SRCDIR([src/main.cc])
 AC_CONFIG_AUX_DIR(cfgaux)
 AM_INIT_AUTOMAKE(squid, 3.0-DEVEL)
 AM_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.312 $)dnl
+AC_REVISION($Revision: 1.313 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -901,6 +901,27 @@ AC_ARG_ENABLE(truncate,
   fi
 ])
 
+dnl Disable hostname checks
+enable_hostname_checks=1
+AC_ARG_ENABLE(hostname_checks,
+[  --disable-hostname-checks
+                          Squid by default rejects any host names with
+                         odd characters in their name to conform with
+                         internet standards. If you disagree with this
+                         you may use this switch to turn off any such
+                         checks, provided that the resolver used by
+                         Squid does not reject such host names.. This
+                         may be required to participate in testbeds for
+                         international domain names.],
+[ if test "$enableval" = "no"; then
+    echo "Disabling hostname sanity checks"
+    enable_hostname_checks=0
+  fi
+])
+if test "$enable_hostname_checks" = 1; then
+  AC_DEFINE(CHECK_HOSTNAMES, 1, [Enable hostname sanity checks])
+fi
+
 dnl Enable underscore in hostnames
 AC_ARG_ENABLE(underscores,
 [  --enable-underscores    Squid by default rejects any host names with _
index 6e0c1d6fe394197d1667b61c4e3ced1797de7953..c764b90c9d078a2cf574c5803943e50ff7364a34 100644 (file)
@@ -19,6 +19,9 @@
 /* Enable for cbdata debug information */
 #undef CBDATA_DEBUG
 
+/* Enable hostname sanity checks */
+#undef CHECK_HOSTNAMES
+
 /* Host type from configure */
 #undef CONFIG_HOST_TYPE
 
index de5766cde6b580f8987b735bc15e27952a7f5434..1e3df00d85168b33a4284c52f4f7124d3ce70c08 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: url.cc,v 1.139 2002/10/25 07:36:32 robertc Exp $
+ * $Id: url.cc,v 1.140 2003/01/18 02:27:16 hno Exp $
  *
  * DEBUG: section 23    URL Parsing
  * AUTHOR: Duane Wessels
@@ -106,6 +106,7 @@ const char *ProtocolStr[] =
 };
 
 static request_t *urnParse(method_t method, char *urn);
+#if CHECK_HOSTNAMES
 static const char *const valid_hostname_chars =
 #if ALLOW_HOSTNAME_UNDERSCORES
 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -116,6 +117,7 @@ static const char *const valid_hostname_chars =
 "abcdefghijklmnopqrstuvwxyz"
 "0123456789-.";
 #endif
+#endif /* CHECK_HOSTNAMES */
 
 /* convert %xx in url string to a character 
  * Allocate a new string and return a pointer to converted string */
@@ -310,16 +312,20 @@ urlParse(method_t method, char *url)
            *q = '\0';
        }
     }
+#if CHECK_HOSTNAMES
     if (Config.onoff.check_hostnames && strspn(host, valid_hostname_chars) != strlen(host)) {
        debug(23, 1) ("urlParse: Illegal character in hostname '%s'\n", host);
        return NULL;
     }
+#endif
+#if DONT_DO_THIS_IT_BREAKS_SEMANTIC_TRANSPARENCY
     /* 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);
     if (port < 1 || port > 65535) {