[squid-users] Re: [PATCH]: Fix whitespace in ACL files.

From: Henrik Nordstrom <hno@dont-contact.us>
Date: 16 Jan 2003 10:45:24 +0100

Thanks for you patch, however there is already a similar patch published
for the exact same problem:

http://www.squid-cache.org/Versions/v2/2.5/bugs/#squid-2.5.STABLE1-spaces

Regards
Henrik

tor 2003-01-16 klockan 01.45 skrev Gianni Tedesco:
> Hello,
>
> There is a bug in the code which parses ACL files. The code which is
> supposed to "skip leading and trailing whitespace" actually breaks ACLs
> with spaces in them.
>
> The attached patch fixes that behaviour and it now works as documented.
> Leading and trailing whitespace is ignored, and ACLs in files are read
> one per line.
>
> We bumped in to this problems loading regex files where our regexes had
> spaces in them.
>
> --
> // Gianni Tedesco (gianni at scaramanga dot co dot uk)
> lynx --source www.scaramanga.co.uk/gianni-at-ecsc.asc | gpg --import
> 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D
> ----
>

> diff -urN squid-2.5.STABLE1.orig/src/cache_cf.c squid-2.5.STABLE1/src/cache_cf.c
> --- squid-2.5.STABLE1.orig/src/cache_cf.c Sat Sep 7 16:13:59 2002
> +++ squid-2.5.STABLE1/src/cache_cf.c Thu Nov 21 09:39:39 2002
> @@ -2400,6 +2400,7 @@
> static FILE *wordFile = NULL;
>
> char *t, *fn;
> + char *ch;
> LOCAL_ARRAY(char, buf, 256);
>
> strtok_again:
> @@ -2436,7 +2437,10 @@
> t = buf;
> /* skip leading and trailing white space */
> t += strspn(buf, w_space);
> - t[strcspn(t, w_space)] = '\0';
> + for (ch=t+(strlen(t)-1); ch>=t; ch--) {
> + if ( !isspace(*ch) ) break;
> + *ch=0;
> + }
> /* skip comments */
> if (*t == '#')
> goto strtok_again;
Received on Thu Jan 16 2003 - 02:45:28 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:12:41 MST