f80aa72
--- src/sgDiv.c.in.orig	2007-11-03 08:59:49.000000000 -0500
f80aa72
+++ src/sgDiv.c.in	2008-06-13 12:01:43.000000000 -0500
f80aa72
@@ -94,6 +94,7 @@
f80aa72
   int i = 0;
f80aa72
   char c;
f80aa72
   int report_once = 1;
f80aa72
+  int trailingdot = 1;
f80aa72
   size_t strsz;
f80aa72
   int ndx = 0;
f80aa72
   
f80aa72
@@ -148,6 +149,16 @@
f80aa72
             report_once--;
f80aa72
           }
f80aa72
       }
f80aa72
+      else if ('.' == p[ndx] && '/' == p[ndx+1] && trailingdot == 0) {
f80aa72
+      /* If the domain has trailing dot, remove (problem found with squid 3.0 stable1-5) */
f80aa72
+      /* if this char is a dot and the next char is a slash, then shift the rest of the string left one char */
f80aa72
+      /* We do this only the first time it is encountered. */
f80aa72
+         trailingdot++;
f80aa72
+         size_t sz = strlen(p+ndx+1);
f80aa72
+         strncpy(p+ndx,p+ndx+1, sz);
f80aa72
+         p[ndx+sz] = '\0';
f80aa72
+         @NOLOG1@ sgLogError("Warning: Possible bypass attempt. Found a trailing dot in the domain name: %s", s->orig); @NOLOG2@
f80aa72
+      }
f80aa72
       else
f80aa72
       {
f80aa72
         /* increment the string indexer */