diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2003-01-27 17:57:45 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2003-01-27 17:57:45 +0000 |
commit | cb7e3eef04f7069edaa248bcb35d6b86b8266df8 (patch) | |
tree | 917be68d8a67866cadbb715ee14a12c4cfad2d57 | |
parent | 1624979f13c5ff94f5e693bb44f56a3221c0e7fe (diff) |
Added support for conditionally using case sensitive filtering files.
Code changes from James E. Flemer.
-rw-r--r-- | doc/tinyproxy.conf | 5 | ||||
-rw-r--r-- | src/filter.c | 6 | ||||
-rw-r--r-- | src/grammar.y | 11 | ||||
-rw-r--r-- | src/scanner.l | 3 | ||||
-rw-r--r-- | src/tinyproxy.h | 3 |
5 files changed, 23 insertions, 5 deletions
diff --git a/doc/tinyproxy.conf b/doc/tinyproxy.conf index d215477..12b38e6 100644 --- a/doc/tinyproxy.conf +++ b/doc/tinyproxy.conf @@ -133,6 +133,11 @@ Allow 192.168.1.0/25 #FilterExtended On # +# Use case sensitive regular expressions. +# +#FilterCaseSensitive On + +# # Change the default policy of the filtering system. If this directive is # commented out, or is set to "No" then the default policy is to allow everything # which is not specifically denied by the filter file. diff --git a/src/filter.c b/src/filter.c index ef60741..585b344 100644 --- a/src/filter.c +++ b/src/filter.c @@ -1,4 +1,4 @@ -/* $Id: filter.c,v 1.15 2002-10-03 20:40:39 rjkaes Exp $ +/* $Id: filter.c,v 1.16 2003-01-27 17:57:39 rjkaes Exp $ * * Copyright (c) 1999 George Talusan (gstalusan@uwaterloo.ca) * Copyright (c) 2002 James E. Flemer (jflemer@acm.jhu.edu) @@ -57,9 +57,11 @@ filter_init(void) if (fd) { p = NULL; - cflags = REG_NEWLINE | REG_NOSUB | REG_ICASE; + cflags = REG_NEWLINE | REG_NOSUB; if (config.filter_extended) cflags |= REG_EXTENDED; + if (!config.filter_casesensitive) + cflags |= REG_ICASE; while (fgets(buf, FILTER_BUFFER_LEN, fd)) { s = buf; diff --git a/src/grammar.y b/src/grammar.y index 4131dd3..0f52161 100644 --- a/src/grammar.y +++ b/src/grammar.y @@ -1,4 +1,4 @@ -/* $Id: grammar.y,v 1.17 2002-11-26 21:44:43 rjkaes Exp $ +/* $Id: grammar.y,v 1.18 2003-01-27 17:57:39 rjkaes Exp $ * * This is the grammar for tinyproxy's configuration file. It needs to be * in sync with scanner.l. If you know more about yacc and lex than I do @@ -48,6 +48,7 @@ int yylex(void); %token KW_USER KW_GROUP %token KW_ANONYMOUS KW_XTINYPROXY %token KW_FILTER KW_FILTERURLS KW_FILTEREXTENDED KW_FILTER_DEFAULT_DENY +%token KW_FILTER_CASESENSITIVE %token KW_UPSTREAM %token KW_CONNECTPORT KW_BIND KW_HTTP_VIA %token KW_ALLOW KW_DENY @@ -135,6 +136,14 @@ statement log_message(LOG_WARNING, "Filter support was not compiled in."); #endif } + | KW_FILTER_CASESENSITIVE yesno + { +#ifdef FILTER_ENABLE + config.filter_casesensitive = $2; +#else + log_message(LOG_WARNING, "Filter support was not compiled in."); +#endif + } | KW_FILTER_DEFAULT_DENY yesno { #ifdef FILTER_ENABLE diff --git a/src/scanner.l b/src/scanner.l index f6dbd51..29213b1 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -1,4 +1,4 @@ -/* $Id: scanner.l,v 1.16 2002-11-26 21:44:43 rjkaes Exp $ +/* $Id: scanner.l,v 1.17 2003-01-27 17:57:38 rjkaes Exp $ * * This builds the scanner for the tinyproxy configuration file. This * file needs to stay in sync with grammar.y. If someone knows lex and yacc @@ -47,6 +47,7 @@ static struct keyword keywords[] = { { "filterurls", KW_FILTERURLS }, { "filterextended", KW_FILTEREXTENDED }, { "filterdefaultdeny", KW_FILTER_DEFAULT_DENY }, + { "filtercasesensitive", KW_FILTER_CASESENSITIVE }, { "xtinyproxy", KW_XTINYPROXY }, { "upstream", KW_UPSTREAM }, { "allow", KW_ALLOW }, diff --git a/src/tinyproxy.h b/src/tinyproxy.h index 8edba3a..a12948a 100644 --- a/src/tinyproxy.h +++ b/src/tinyproxy.h @@ -1,4 +1,4 @@ -/* $Id: tinyproxy.h,v 1.36 2002-12-04 17:06:14 rjkaes Exp $ +/* $Id: tinyproxy.h,v 1.37 2003-01-27 17:57:37 rjkaes Exp $ * * See 'tinyproxy.c' for a detailed description. * @@ -38,6 +38,7 @@ struct config_s { char *filter; unsigned int filter_url; /* boolean */ unsigned int filter_extended; /* boolean */ + unsigned int filter_casesensitive; /* boolean */ #endif /* FILTER_ENABLE */ #ifdef XTINYPROXY_ENABLE char *my_domain; |