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