From: hno <> Date: Sat, 18 Jan 2003 09:27:14 +0000 (+0000) Subject: --disable-hostname-checks configure option X-Git-Tag: SQUID_3_0_PRE1~449 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4fa7a4baf436399d04b85dfbf0e9506b3a0ab5b1;p=thirdparty%2Fsquid.git --disable-hostname-checks configure option also removed the dot magics. These are more evil than helpful and breaks semantic transparency in certain configurations. --- diff --git a/configure.in b/configure.in index 5d3136b6a5..bf02a9e965 100644 --- a/configure.in +++ b/configure.in @@ -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 _ diff --git a/include/autoconf.h.in b/include/autoconf.h.in index 6e0c1d6fe3..c764b90c9d 100644 --- a/include/autoconf.h.in +++ b/include/autoconf.h.in @@ -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 diff --git a/src/url.cc b/src/url.cc index de5766cde6..1e3df00d85 100644 --- a/src/url.cc +++ b/src/url.cc @@ -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) {