Fri Sep 17 03:09:32 CEST 1999 Modified Files in squid/src acl.c There was two additional corners left in domain comparison 1. It failed miserably on domain names only different in the first character. 2. When building the splay tree ".example.com" and "example.com" was seen as the same thing, but matching would behave differently depending on which was written first. If ".example.com" was written first then "example.com" would not be matched. This patch changes the code to handle ".example.com" as any subdomains of "example.com", but not the host name "example.com" and give a warning if both is used. Index: squid/src/acl.c diff -u squid/src/acl.c:1.1.1.36.2.4 squid/src/acl.c:1.1.1.36.2.5 --- squid/src/acl.c:1.1.1.36.2.4 Sun Aug 8 02:58:05 1999 +++ squid/src/acl.c Fri Sep 17 03:09:31 1999 @@ -1930,10 +1930,14 @@ const char *d2 = b; int l1; int l2; +#if 0 /* .domain.com is all subdomains of domain.com, or + * aclHostDomainCompare needs to match this.. + */ while ('.' == *d1) d1++; while ('.' == *d2) d2++; +#endif l1 = strlen(d1); l2 = strlen(d2); while (d1[--l1] == d2[--l2]) { @@ -1973,19 +1977,19 @@ l1 = strlen(h); l2 = strlen(d); /* h != d */ - while (xtolower(h[l1]) == xtolower(d[l2])) { + while (xtolower(h[--l1]) == xtolower(d[--l2])) { if (l1 == 0) - break; + return -1; /* domain(h) < d */ if (l2 == 0) - break; - l1--; - l2--; + return 1; /* domain(h) > d */ } +#if 0 /* There isn't anything this special with '.' in aclDomainCompare...*/ /* a '.' is a special case */ - if ((h[l1] == '.') || (l1 == 0)) + if (h[l1] == '.') return -1; /* domain(h) < d */ - if ((d[l2] == '.') || (l2 == 0)) + if (d[l2] == '.') return 1; /* domain(h) > d */ +#endif return (xtolower(h[l1]) - xtolower(d[l2])); }