- Enabled filtering banners by size rather than URL
authoroes <oes@users.sourceforge.net>
Tue, 22 May 2001 18:46:04 +0000 (18:46 +0000)
committeroes <oes@users.sourceforge.net>
Tue, 22 May 2001 18:46:04 +0000 (18:46 +0000)
  by adding patterns that replace all standard banner
  sizes with the "Junkbuster" gif to the re_filterfile

- Enabled filtering WebBugs by providing a pattern
  which kills all 1x1 images

- Added support for PCRE_UNGREEDY behaviour to pcrs,
  which is selected by the (nonstandard and therefore
  capital) letter 'U' in the option string.
  It causes the quantifiers to be ungreedy by default.
  Appending a ? turns back to greedy (!).

- Added a new interceptor ijb-send-banner, which
  sends back the "Junkbuster" gif. Without imagelist or
  MSIE detection support, or if tinygif = 1, or the
  URL isn't recognized as an imageurl, a lame HTML
  explanation is sent instead.

- Added new feature, which permits blocking remote
  script redirects and firing back a local redirect
  to the browser.
  The feature is conditionally compiled, i.e. it
  can be disabled with --disable-fast-redirects,
  plus it must be activated by a "fast-redirects"
  line in the config file, has its own log level
  and of course wants to be displayed by show-proxy-args
  Note: Boy, all the #ifdefs in 1001 locations and
  all the fumbling with configure.in and acconfig.h
  were *way* more work than the feature itself :-(

- Because a generic redirect template was needed for
  this, tinygif = 3 now uses the same.

- Moved GIFs, and other static HTTP response templates
  to project.h

- Some minor fixes

- Removed some >400 CRs again (Jon, you really worked
  a lot! ;-)

14 files changed:
config.h.in
configure
configure.in
errlog.c
errlog.h
filters.c
filters.h
jcc.c
loadcfg.c
loadcfg.h
parsers.c
pcrs.c
project.h
re_filterfile

index 930ca66..b021767 100644 (file)
@@ -3,7 +3,7 @@
 #define _CONFIG_H
 /*********************************************************************
  *
 #define _CONFIG_H
 /*********************************************************************
  *
- * File        :  $Source: /home/administrator/cvs/ijb/acconfig.h,v $
+ * File        :  $Source: /cvsroot/ijbswa/current/config.h.in,v $
  *
  * Purpose     :  This file should be the first thing included in every
  *                .c file.  (Before even system headers).  It contains 
  *
  * Purpose     :  This file should be the first thing included in every
  *                .c file.  (Before even system headers).  It contains 
  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  * Revisions   :
  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  * Revisions   :
- *    $Log: acconfig.h,v $
+ *    $Log: config.h.in,v $
+ *    Revision 1.1  2001/05/15 13:58:49  oes
+ *    Initial revision
+ *
  *
  *********************************************************************/
 \f
  *
  *********************************************************************/
 \f
  */
 #undef FORCE_LOAD
 
  */
 #undef FORCE_LOAD
 
+/*
+ * Locally redirect remote script-redirect URLs
+ */
+#undef FAST_REDIRECTS
+
 /*
  * Split the show-proxy-args page into a page for each config file.
  */
 /*
  * Split the show-proxy-args page into a page for each config file.
  */
index 95567ec..849b830 100755 (executable)
--- a/configure
+++ b/configure
@@ -23,6 +23,8 @@ ac_help="$ac_help
   --disable-pcrs          Don't support arbitrary content modification"
 ac_help="$ac_help
   --disable-force         Don't allow blockfle to be bypassed"
   --disable-pcrs          Don't support arbitrary content modification"
 ac_help="$ac_help
   --disable-force         Don't allow blockfle to be bypassed"
+ac_help="$ac_help
+  --disable-fast-redirects Don't support fast redirects"
 ac_help="$ac_help
   --disable-killpopup     Never block popups"
 ac_help="$ac_help
 ac_help="$ac_help
   --disable-killpopup     Never block popups"
 ac_help="$ac_help
@@ -588,7 +590,7 @@ EOF
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:592: checking for $ac_word" >&5
+echo "configure:594: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -618,7 +620,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:622: checking for $ac_word" >&5
+echo "configure:624: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -669,7 +671,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:673: checking for $ac_word" >&5
+echo "configure:675: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -701,7 +703,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:705: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:707: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -712,12 +714,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
 
 cat > conftest.$ac_ext << EOF
 
-#line 716 "configure"
+#line 718 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -743,12 +745,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:747: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:749: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:752: checking whether we are using GNU C" >&5
+echo "configure:754: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -757,7 +759,7 @@ else
   yes;
 #endif
 EOF
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:761: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:763: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -776,7 +778,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:780: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:782: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -808,7 +810,7 @@ else
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:812: checking how to run the C preprocessor" >&5
+echo "configure:814: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -823,13 +825,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 827 "configure"
+#line 829 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -840,13 +842,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 844 "configure"
+#line 846 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:850: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -857,13 +859,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 861 "configure"
+#line 863 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:867: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:869: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -889,19 +891,19 @@ echo "$ac_t""$CPP" 1>&6
 
 
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
 
 
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:893: checking for mingw32 environment" >&5
+echo "configure:895: checking for mingw32 environment" >&5
 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 898 "configure"
+#line 900 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -918,12 +920,12 @@ echo "$ac_t""$ac_cv_mingw32" 1>&6
 MINGW32=
 test "$ac_cv_mingw32" = yes && MINGW32=yes
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
 MINGW32=
 test "$ac_cv_mingw32" = yes && MINGW32=yes
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:922: checking for Cygwin environment" >&5
+echo "configure:924: checking for Cygwin environment" >&5
 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 927 "configure"
+#line 929 "configure"
 #include "confdefs.h"
 
 int main() {
 #include "confdefs.h"
 
 int main() {
@@ -934,7 +936,7 @@ int main() {
 return __CYGWIN__;
 ; return 0; }
 EOF
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:938: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -953,7 +955,7 @@ test "$ac_cv_cygwin" = yes && CYGWIN=yes
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:957: checking for executable suffix" >&5
+echo "configure:959: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -963,7 +965,7 @@ else
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.o | *.obj) ;;
     for file in conftest.*; do
       case $file in
       *.c | *.o | *.obj) ;;
@@ -984,13 +986,13 @@ echo "$ac_t""${ac_cv_exeext}" 1>&6
 ac_exeext=$EXEEXT
 
 echo $ac_n "checking for object suffix""... $ac_c" 1>&6
 ac_exeext=$EXEEXT
 
 echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:988: checking for object suffix" >&5
+echo "configure:990: checking for object suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftest*
 echo 'int i = 1;' > conftest.$ac_ext
 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftest*
 echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   for ac_file in conftest.*; do
     case $ac_file in
     *.c) ;;
   for ac_file in conftest.*; do
     case $ac_file in
     *.c) ;;
@@ -1010,12 +1012,12 @@ ac_objext=$ac_cv_objext
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1014: checking for ANSI C header files" >&5
+echo "configure:1016: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1019 "configure"
+#line 1021 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1023,7 +1025,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1027: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1040,7 +1042,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1044 "configure"
+#line 1046 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1058,7 +1060,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1062 "configure"
+#line 1064 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1079,7 +1081,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1083 "configure"
+#line 1085 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1090,7 +1092,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
 exit (0); }
 
 EOF
-if { (eval echo configure:1094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
 then
   :
 else
@@ -1115,12 +1117,12 @@ fi
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1119: checking for working const" >&5
+echo "configure:1121: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1124 "configure"
+#line 1126 "configure"
 #include "confdefs.h"
 
 int main() {
 #include "confdefs.h"
 
 int main() {
@@ -1169,7 +1171,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
 
 ; return 0; }
 EOF
-if { (eval echo configure:1173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1190,12 +1192,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1194: checking for size_t" >&5
+echo "configure:1196: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1199 "configure"
+#line 1201 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1226,12 +1228,12 @@ fi
 for ac_func in strerror bcopy memmove
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
 for ac_func in strerror bcopy memmove
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1230: checking for $ac_func" >&5
+echo "configure:1232: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1235 "configure"
+#line 1237 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1254,7 +1256,7 @@ $ac_func();
 
 ; return 0; }
 EOF
 
 ; return 0; }
 EOF
-if { (eval echo configure:1258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1436,6 +1438,23 @@ EOF
 fi
 
 
 fi
 
 
+# Check whether --enable-fast-redirects or --disable-fast-redirects was given.
+if test "${enable_fast_redirects+set}" = set; then
+  enableval="$enable_fast_redirects"
+  if test $enableval = yes; then
+  cat >> confdefs.h <<\EOF
+#define FAST_REDIRECTS 1
+EOF
+
+fi
+else
+  cat >> confdefs.h <<\EOF
+#define FAST_REDIRECTS 1
+EOF
+
+fi
+
+
 # Check whether --enable-killpopup or --disable-killpopup was given.
 if test "${enable_killpopup+set}" = set; then
   enableval="$enable_killpopup"
 # Check whether --enable-killpopup or --disable-killpopup was given.
 if test "${enable_killpopup+set}" = set; then
   enableval="$enable_killpopup"
index 808b397..593ef0d 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl 
 dnl Process this file with autoconf to produce a configure script.
 dnl 
-dnl $Id: configure.in,v 1.1.1.1 2001/05/15 13:58:50 oes Exp $
+dnl $Id: configure.in,v 1.2 2001/05/20 01:21:20 jongfoster Exp $
 dnl 
 dnl Written by and Copyright (C) 2001 the SourceForge
 dnl IJBSWA team.  http://ijbswa.sourceforge.net
 dnl 
 dnl Written by and Copyright (C) 2001 the SourceForge
 dnl IJBSWA team.  http://ijbswa.sourceforge.net
@@ -28,6 +28,19 @@ dnl or write to the Free Software Foundation, Inc., 59
 dnl Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 dnl 
 dnl $Log: configure.in,v $
 dnl Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 dnl 
 dnl $Log: configure.in,v $
+dnl Revision 1.2  2001/05/20 01:21:20  jongfoster
+dnl Version 2.9.4 checkin.
+dnl - Merged popupfile and cookiefile, and added control over PCRS
+dnl   filtering, in new "permissionsfile".
+dnl - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
+dnl   file error you now get a message box (in the Win32 GUI) rather
+dnl   than the program exiting with no explanation.
+dnl - Made killpopup use the PCRS MIME-type checking and HTTP-header
+dnl   skipping.
+dnl - Removed tabs from "config"
+dnl - Moved duplicated url parsing code in "loaders.c" to a new funcition.
+dnl - Bumped up version number.
+dnl
 dnl Revision 1.1.1.1  2001/05/15 13:58:50  oes
 dnl Initial import of version 2.9.3 source tree
 dnl
 dnl Revision 1.1.1.1  2001/05/15 13:58:50  oes
 dnl Initial import of version 2.9.3 source tree
 dnl
@@ -180,6 +193,12 @@ AC_ARG_ENABLE(force,
   AC_DEFINE(FORCE_LOAD)
 fi],AC_DEFINE(FORCE_LOAD))
 
   AC_DEFINE(FORCE_LOAD)
 fi],AC_DEFINE(FORCE_LOAD))
 
+AC_ARG_ENABLE(fast-redirects,
+[  --disable-fast-redirects Don't support fast redirects],
+[if test $enableval = yes; then
+  AC_DEFINE(FAST_REDIRECTS)
+fi], AC_DEFINE(FAST_REDIRECTS))
+
 AC_ARG_ENABLE(killpopup,
 [  --disable-killpopup     Never block popups],
 [if test $enableval = yes; then
 AC_ARG_ENABLE(killpopup,
 [  --disable-killpopup     Never block popups],
 [if test $enableval = yes; then
index f994118..0aa139a 100644 (file)
--- a/errlog.c
+++ b/errlog.c
@@ -1,4 +1,4 @@
-const char errlog_rcs[] = "$Id: errlog.c,v 1.3 2001/05/20 01:11:40 jongfoster Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.4 2001/05/21 19:32:54 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.c,v $
@@ -33,6 +33,9 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.3 2001/05/20 01:11:40 jongfoster Ex
  *
  * Revisions   :
  *    $Log: errlog.c,v $
  *
  * Revisions   :
  *    $Log: errlog.c,v $
+ *    Revision 1.4  2001/05/21 19:32:54  jongfoster
+ *    Added another #ifdef _WIN_CONSOLE
+ *
  *    Revision 1.3  2001/05/20 01:11:40  jongfoster
  *    Added support for LOG_LEVEL_FATAL
  *    Renamed LOG_LEVEL_FRC to LOG_LEVEL_FORCE,
  *    Revision 1.3  2001/05/20 01:11:40  jongfoster
  *    Added support for LOG_LEVEL_FATAL
  *    Renamed LOG_LEVEL_FRC to LOG_LEVEL_FORCE,
@@ -65,23 +68,23 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.3 2001/05/20 01:11:40 jongfoster Ex
 
 #ifdef _WIN32
 #include <windows.h>
 
 #ifdef _WIN32
 #include <windows.h>
-#ifndef _WIN_CONSOLE\r
+#ifndef _WIN_CONSOLE
 #include "w32log.h"
 #include "w32log.h"
-#endif /* ndef _WIN_CONSOLE */\r
+#endif /* ndef _WIN_CONSOLE */
 #endif /* def _WIN32 */
 
 #include "errlog.h"
 #include "project.h"
 
 const char errlog_h_rcs[] = ERRLOG_H_VERSION;
 #endif /* def _WIN32 */
 
 #include "errlog.h"
 #include "project.h"
 
 const char errlog_h_rcs[] = ERRLOG_H_VERSION;
-\r
-
-/*\r
- * LOG_LEVEL_FATAL, LOG_LEVEL_ERROR and LOG_LEVEL_INFO\r
- * cannot be turned off.  (There are some exceptional situations\r
- * where we need to get a message to the user).\r
- *\r
- * FIXME: Do we need LOG_LEVEL_INFO here?\r
+
+
+/*
+ * LOG_LEVEL_FATAL, LOG_LEVEL_ERROR and LOG_LEVEL_INFO
+ * cannot be turned off.  (There are some exceptional situations
+ * where we need to get a message to the user).
+ *
+ * FIXME: Do we need LOG_LEVEL_INFO here?
  */
 #define LOG_LEVEL_MINIMUM  (LOG_LEVEL_FATAL | LOG_LEVEL_ERROR | LOG_LEVEL_INFO)
 
  */
 #define LOG_LEVEL_MINIMUM  (LOG_LEVEL_FATAL | LOG_LEVEL_ERROR | LOG_LEVEL_INFO)
 
@@ -94,35 +97,35 @@ static char * logfilename = NULL;
 /* logging detail level.  */
 static int debug = LOG_LEVEL_MINIMUM;  
 
 /* logging detail level.  */
 static int debug = LOG_LEVEL_MINIMUM;  
 
-static void fatal_error(const char * error_message);\r
-\r
-\r
-/*********************************************************************\r
- *\r
- * Function    :  fatal_error\r
- *\r
- * Description :  Displays a fatal error to standard error (or, on \r
- *                a WIN32 GUI, to a dialog box), and exits\r
- *                JunkBuster with status code 1.\r
- *\r
- * Parameters  :\r
- *          1  :  error_message = The error message to display.\r
- *\r
- * Returns     :  Does not return.\r
- *\r
- *********************************************************************/\r
-static void fatal_error(const char * error_message)\r
-{\r
-#if defined(_WIN32) && !defined(_WIN_CONSOLE)\r
-   MessageBox(NULL, error_message, "Internet JunkBuster Error", \r
-      MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND | MB_TOPMOST);  \r
-#else /* if !defined(_WIN32) || defined(_WIN_CONSOLE) */\r
-   fputs(error_message, stderr);\r
-#endif /* defined(_WIN32) && !defined(_WIN_CONSOLE) */\r
-\r
-   exit(1);\r
-}\r
-\r
+static void fatal_error(const char * error_message);
+
+
+/*********************************************************************
+ *
+ * Function    :  fatal_error
+ *
+ * Description :  Displays a fatal error to standard error (or, on 
+ *                a WIN32 GUI, to a dialog box), and exits
+ *                JunkBuster with status code 1.
+ *
+ * Parameters  :
+ *          1  :  error_message = The error message to display.
+ *
+ * Returns     :  Does not return.
+ *
+ *********************************************************************/
+static void fatal_error(const char * error_message)
+{
+#if defined(_WIN32) && !defined(_WIN_CONSOLE)
+   MessageBox(NULL, error_message, "Internet JunkBuster Error", 
+      MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND | MB_TOPMOST);  
+#else /* if !defined(_WIN32) || defined(_WIN_CONSOLE) */
+   fputs(error_message, stderr);
+#endif /* defined(_WIN32) && !defined(_WIN_CONSOLE) */
+
+   exit(1);
+}
+
 
 /*********************************************************************
  *
 
 /*********************************************************************
  *
@@ -158,7 +161,7 @@ void init_error_log(const char *prog_name, const char *logfname, int debuglevel)
    if( logfname )
    {
       if( !(fp = fopen(logfname, "a")) )
    if( logfname )
    {
       if( !(fp = fopen(logfname, "a")) )
-      {\r
+      {
          log_error(LOG_LEVEL_FATAL, "init_errlog(): can't open logfile: %s", logfname);
       }
 
          log_error(LOG_LEVEL_FATAL, "init_errlog(): can't open logfile: %s", logfname);
       }
 
@@ -212,12 +215,12 @@ void log_error(int loglevel, char *fmt, ...)
 
    switch (loglevel)
    {
 
    switch (loglevel)
    {
-      case LOG_LEVEL_ERROR:\r
-         outc = sprintf(outbuf, "IJB(%d) Error: ", this_thread);\r
-         break;\r
-      case LOG_LEVEL_FATAL:\r
-         outc = sprintf(outbuf, "IJB(%d) Fatal error: ", this_thread);\r
-         break;\r
+      case LOG_LEVEL_ERROR:
+         outc = sprintf(outbuf, "IJB(%d) Error: ", this_thread);
+         break;
+      case LOG_LEVEL_FATAL:
+         outc = sprintf(outbuf, "IJB(%d) Fatal error: ", this_thread);
+         break;
       case LOG_LEVEL_GPC:
          outc = sprintf(outbuf, "IJB(%d) Request: ", this_thread);
          break;
       case LOG_LEVEL_GPC:
          outc = sprintf(outbuf, "IJB(%d) Request: ", this_thread);
          break;
@@ -227,15 +230,24 @@ void log_error(int loglevel, char *fmt, ...)
       case LOG_LEVEL_HEADER:
          outc = sprintf(outbuf, "IJB(%d) Header: ", this_thread);
          break;
       case LOG_LEVEL_HEADER:
          outc = sprintf(outbuf, "IJB(%d) Header: ", this_thread);
          break;
-      case LOG_LEVEL_INFO:\r
-         outc = sprintf(outbuf, "IJB(%d) Info: ", this_thread);\r
-         break;\r
+      case LOG_LEVEL_INFO:
+         outc = sprintf(outbuf, "IJB(%d) Info: ", this_thread);
+         break;
+#ifdef PCRS
       case LOG_LEVEL_RE_FILTER:
          outc = sprintf(outbuf, "IJB(%d) Re-Filter: ", this_thread);
          break;
       case LOG_LEVEL_RE_FILTER:
          outc = sprintf(outbuf, "IJB(%d) Re-Filter: ", this_thread);
          break;
+#endif /* def PCRS */
+#ifdef FORCE_LOAD
       case LOG_LEVEL_FORCE:
          outc = sprintf(outbuf, "IJB(%d) Force: ", this_thread);
       case LOG_LEVEL_FORCE:
          outc = sprintf(outbuf, "IJB(%d) Force: ", this_thread);
-         break;\r
+         break;
+#endif /* def FORCE_LOAD */
+#ifdef FAST_REDIRECTS
+      case LOG_LEVEL_REDIRECTS:
+         outc = sprintf(outbuf, "IJB(%d) Redirect: ", this_thread);
+         break;
+#endif /* def FAST_REDIRECTS */
       default:
          outc = sprintf(outbuf, "IJB(%d) UNKNOWN LOG TYPE(%d): ", this_thread, loglevel);
          break;
       default:
          outc = sprintf(outbuf, "IJB(%d) UNKNOWN LOG TYPE(%d): ", this_thread, loglevel);
          break;
@@ -322,8 +334,8 @@ void log_error(int loglevel, char *fmt, ...)
                }
                fputs(outbuf, logfp);
                /* FIXME RACE HAZARD: should end critical section error_log_use here */
                }
                fputs(outbuf, logfp);
                /* FIXME RACE HAZARD: should end critical section error_log_use here */
-               fatal_error(outbuf);\r
-               /* Never get here */\r
+               fatal_error(outbuf);
+               /* Never get here */
                break;
             }
             if (outc < BUFSIZ-1) 
                break;
             }
             if (outc < BUFSIZ-1) 
@@ -390,8 +402,8 @@ void log_error(int loglevel, char *fmt, ...)
             }
             fputs(outbuf, logfp);
             /* FIXME RACE HAZARD: should end critical section error_log_use here */
             }
             fputs(outbuf, logfp);
             /* FIXME RACE HAZARD: should end critical section error_log_use here */
-            fatal_error(outbuf);\r
-            /* Never get here */\r
+            fatal_error(outbuf);
+            /* Never get here */
             break;
 
       } /* switch( p ) */
             break;
 
       } /* switch( p ) */
@@ -436,14 +448,14 @@ void log_error(int loglevel, char *fmt, ...)
 
    fputs(outbuf, logfp);
 
 
    fputs(outbuf, logfp);
 
-   if (loglevel == LOG_LEVEL_FATAL)\r
-   {\r
-      fatal_error(outbuf);\r
-      /* Never get here */\r
-   }\r
-\r
+   if (loglevel == LOG_LEVEL_FATAL)
+   {
+      fatal_error(outbuf);
+      /* Never get here */
+   }
+
    /* FIXME RACE HAZARD: should end critical section error_log_use here */
    /* FIXME RACE HAZARD: should end critical section error_log_use here */
-\r
+
 #if defined(_WIN32) && !defined(_WIN_CONSOLE)
    /* Write to display */
    LogPutString(outbuf);
 #if defined(_WIN32) && !defined(_WIN_CONSOLE)
    /* Write to display */
    LogPutString(outbuf);
index 82f8bc5..22c7c81 100644 (file)
--- a/errlog.h
+++ b/errlog.h
@@ -1,6 +1,6 @@
 #ifndef _ERRLOG_H
 #define _ERRLOG_H
 #ifndef _ERRLOG_H
 #define _ERRLOG_H
-#define ERRLOG_H_VERSION "$Id: errlog.h,v 1.1.1.1 2001/05/15 13:58:51 oes Exp $"
+#define ERRLOG_H_VERSION "$Id: errlog.h,v 1.2 2001/05/20 01:11:40 jongfoster Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.h,v $
  *
  * Revisions   :
  *    $Log: errlog.h,v $
  *
  * Revisions   :
  *    $Log: errlog.h,v $
+ *    Revision 1.2  2001/05/20 01:11:40  jongfoster
+ *    Added support for LOG_LEVEL_FATAL
+ *    Renamed LOG_LEVEL_FRC to LOG_LEVEL_FORCE,
+ *    and LOG_LEVEL_REF to LOG_LEVEL_RE_FILTER
+ *
  *    Revision 1.1.1.1  2001/05/15 13:58:51  oes
  *    Initial import of version 2.9.3 source tree
  *
  *    Revision 1.1.1.1  2001/05/15 13:58:51  oes
  *    Initial import of version 2.9.3 source tree
  *
@@ -53,15 +58,20 @@ extern "C" {
 #define LOG_LEVEL_IO         0x0004
 #define LOG_LEVEL_HEADER     0x0008
 #define LOG_LEVEL_LOG        0x0010
 #define LOG_LEVEL_IO         0x0004
 #define LOG_LEVEL_HEADER     0x0008
 #define LOG_LEVEL_LOG        0x0010
-#ifdef PCRS
+#ifdef FORCE_LOAD
 #define LOG_LEVEL_FORCE      0x0020
 #define LOG_LEVEL_FORCE      0x0020
+#endif /* def FORCE_LOAD */
+#ifdef PCRS
 #define LOG_LEVEL_RE_FILTER  0x0040
 #endif /* def PCRS */
 #define LOG_LEVEL_RE_FILTER  0x0040
 #endif /* def PCRS */
+#ifdef FAST_REDIRECTS
+#define LOG_LEVEL_REDIRECTS  0x0080
+#endif /* def FAST_REDIRECTS */
 
 /* Following are always on: */
 #define LOG_LEVEL_INFO    0x1000
 
 /* Following are always on: */
 #define LOG_LEVEL_INFO    0x1000
-#define LOG_LEVEL_ERROR   0x2000\r
-#define LOG_LEVEL_FATAL   0x4000 /* Exits after writing log */\r
+#define LOG_LEVEL_ERROR   0x2000
+#define LOG_LEVEL_FATAL   0x4000 /* Exits after writing log */
 
 extern void init_error_log(const char *prog_name, const char *logfname, int debuglevel);
 extern void log_error(int loglevel, char *fmt, ...);
 
 extern void init_error_log(const char *prog_name, const char *logfname, int debuglevel);
 extern void log_error(int loglevel, char *fmt, ...);
index f61f4fc..42f46af 100644 (file)
--- a/filters.c
+++ b/filters.c
@@ -1,4 +1,4 @@
-const char filters_rcs[] = "$Id: filters.c,v 1.2 2001/05/20 01:21:20 jongfoster Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.3 2001/05/20 16:44:47 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.c,v $
@@ -7,9 +7,9 @@ const char filters_rcs[] = "$Id: filters.c,v 1.2 2001/05/20 01:21:20 jongfoster
  *                Functions declared include:
  *                   `acl_addr', `add_stats', `block_acl', `block_imageurl',
  *                   `block_url', `url_permissions', `domaincmp', `dsplit',
  *                Functions declared include:
  *                   `acl_addr', `add_stats', `block_acl', `block_imageurl',
  *                   `block_url', `url_permissions', `domaincmp', `dsplit',
- *                   `filter_popups', `forward_url',
+ *                   `filter_popups', `forward_url', 'redirect_url',
  *                   `ij_untrusted_url', `intercept_url', `re_process_buffer',
  *                   `ij_untrusted_url', `intercept_url', `re_process_buffer',
- *                   `show_proxy_args', and `trust_url'
+ *                   `show_proxy_args', 'ijb_send_banner', and `trust_url'
  *
  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
  *                IJBSWA team.  http://ijbswa.sourceforge.net
  *
  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
  *                IJBSWA team.  http://ijbswa.sourceforge.net
@@ -38,6 +38,9 @@ const char filters_rcs[] = "$Id: filters.c,v 1.2 2001/05/20 01:21:20 jongfoster
  *
  * Revisions   :
  *    $Log: filters.c,v $
  *
  * Revisions   :
  *    $Log: filters.c,v $
+ *    Revision 1.3  2001/05/20 16:44:47  jongfoster
+ *    Removing last hardcoded JunkBusters.com URLs.
+ *
  *    Revision 1.2  2001/05/20 01:21:20  jongfoster
  *    Version 2.9.4 checkin.
  *    - Merged popupfile and cookiefile, and added control over PCRS
  *    Revision 1.2  2001/05/20 01:21:20  jongfoster
  *    Version 2.9.4 checkin.
  *    - Merged popupfile and cookiefile, and added control over PCRS
@@ -123,8 +126,8 @@ static const char CBLOCK[] =
       "was blocked because it matches the following pattern "
       "in the blockfile: <b>%s</b>\n</p>"
 #ifdef FORCE_LOAD
       "was blocked because it matches the following pattern "
       "in the blockfile: <b>%s</b>\n</p>"
 #ifdef FORCE_LOAD
-       "<p align=center><a href=\"http://" FORCE_PREFIX
-        "%s%s\">Go there anyway.</a></p>"
+       "<p align=center><a href=\"http://%s" FORCE_PREFIX
+        "%s\">Go there anyway.</a></p>"
 #endif /* def FORCE_LOAD */
       "</body>\n"
       "</html>\n";
 #endif /* def FORCE_LOAD */
       "</body>\n"
       "</html>\n";
@@ -510,9 +513,9 @@ void re_process_buffer(struct client_state *csp)
    struct re_filterfile_spec *b;
 
    /* Sanity first ;-) */
    struct re_filterfile_spec *b;
 
    /* Sanity first ;-) */
-   if (size <= 0)\r
-   {\r
-      return;\r
+   if (size <= 0)
+   {
+      return;
    }
 
    if ( ( NULL == (fl = csp->rlist) ) || ( NULL == (b = fl->f) ) )
    }
 
    if ( ( NULL == (fl = csp->rlist) ) || ( NULL == (b = fl->f) ) )
@@ -805,6 +808,50 @@ char *intercept_url(struct http_request *http, struct client_state *csp)
 
 }
 
 
 }
 
+#ifdef FAST_REDIRECTS
+/*********************************************************************
+ *
+ * Function    :  redirect_url
+ *
+ * Description :  Checks for redirection URLs and returns a HTTP redirect
+ *                to the destination URL.
+ *
+ * Parameters  :
+ *          1  :  http = http_request request, check `basename's of blocklist
+ *          2  :  csp = Current client state (buffers, headers, etc...)
+ *
+ * Returns     :  NULL if URL was clean, HTTP redirect otherwise.
+ *
+ *********************************************************************/
+char *redirect_url(struct http_request *http, struct client_state *csp)
+{
+   char *p, *q;
+
+   p = q = csp->http->path;
+       log_error(LOG_LEVEL_REDIRECTS, "checking path: %s", p);
+
+   /* find the last URL encoded in the request */
+   while (p = strstr(p, "http://"))
+               {
+                 q = p++;
+               }
+
+   /* if there was any, generate and return a HTTP redirect */
+       if (q != csp->http->path)
+       {
+         log_error(LOG_LEVEL_REDIRECTS, "redirecting to: %s", q);
+
+         p = (char *)malloc(strlen(HTTP_REDIRECT_TEMPLATE) + strlen(q));
+         sprintf(p, HTTP_REDIRECT_TEMPLATE, q);
+         return(p);
+   }
+       else
+   {
+      return(NULL);
+       }
+
+}
+#endif /* def FAST_REDIRECTS */
 
 /*********************************************************************
  *
 
 /*********************************************************************
  *
@@ -816,7 +863,7 @@ char *intercept_url(struct http_request *http, struct client_state *csp)
  *          1  :  http = http_request request for blocked URLs
  *          2  :  csp = Current client state (buffers, headers, etc...)
  *
  *          1  :  http = http_request request for blocked URLs
  *          2  :  csp = Current client state (buffers, headers, etc...)
  *
- * Returns     :  permissions bitmask specifiying what this URL can do.\r
+ * Returns     :  permissions bitmask specifiying what this URL can do.
  *                If not on list, will be default_permissions.
  *
  *********************************************************************/
  *                If not on list, will be default_permissions.
  *
  *********************************************************************/
@@ -834,9 +881,9 @@ int url_permissions(struct http_request *http, struct client_state *csp)
    *url = dsplit(http->host);
 
    /* if splitting the domain fails, punt */
    *url = dsplit(http->host);
 
    /* if splitting the domain fails, punt */
-   if (url->dbuf == NULL)\r
-   {\r
-      return(default_permissions);\r
+   if (url->dbuf == NULL)
+   {
+      return(default_permissions);
    }
 
    for (b = b->next; NULL != b; b = b->next)
    }
 
    for (b = b->next; NULL != b; b = b->next)
@@ -1200,7 +1247,7 @@ char *show_proxy_args(struct http_request *http, struct client_state *csp)
          "<br>\n"
          "<small><small><p>\n"
          "The " BANNER " Proxy - \n"
          "<br>\n"
          "<small><small><p>\n"
          "The " BANNER " Proxy - \n"
-         "<a href=\"" HOME_PAGE_URL "\">" HOME_PAGE_URL "</a>\n"\r
+         "<a href=\"" HOME_PAGE_URL "\">" HOME_PAGE_URL "</a>\n"
          "</small></small>"
          "</body></html>\n");
       return(s);
          "</small></small>"
          "</body></html>\n");
       return(s);
@@ -1258,7 +1305,7 @@ char *show_proxy_args(struct http_request *http, struct client_state *csp)
       s = strsav(s, "</code></a></li>\n");
    }
 #endif /* def USE_IMAGE_LIST */
       s = strsav(s, "</code></a></li>\n");
    }
 #endif /* def USE_IMAGE_LIST */
-\r
+
 #ifdef PCRS
    if (csp->rlist)
    {
 #ifdef PCRS
    if (csp->rlist)
    {
@@ -1332,6 +1379,28 @@ char *show_proxy_args(struct http_request *http, struct client_state *csp)
 }
 
 
 }
 
 
+/*********************************************************************
+ *
+ * Function    :  ijb_send_banner
+ *
+ * Description :  This "crunch"es "http:/any.thing/ijb-send-banner and
+ *                thus triggers sending the image in jcc.c:chat.
+ *                For the unlikely case, that the imagefile/MSIE
+ *                mechanism is not used, or tinygif = 0, a page
+ *                describing the reson of the interception is generated.
+ *
+ * Parameters  :
+ *          1  :  http = http_request request for crunched URL
+ *          2  :  csp = Current client state (buffers, headers, etc...)
+ *
+ * Returns     :  A string that contains why this was intercepted.
+ *
+ *********************************************************************/
+char *ijb_send_banner(struct http_request *http, struct client_state *csp)
+{
+   return(strdup(CNOBANNER));
+}
+
 #ifdef TRUST_FILES
 /*********************************************************************
  *
 #ifdef TRUST_FILES
 /*********************************************************************
  *
index a510ddf..7064388 100644 (file)
--- a/filters.h
+++ b/filters.h
@@ -1,6 +1,6 @@
 #ifndef _FILTERS_H
 #define _FILTERS_H
 #ifndef _FILTERS_H
 #define _FILTERS_H
-#define FILTERS_H_VERSION "$Id: filters.h,v 1.1.1.1 2001/05/15 13:58:52 oes Exp $"
+#define FILTERS_H_VERSION "$Id: filters.h,v 1.2 2001/05/20 01:21:20 jongfoster Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.h,v $
  *
  * Revisions   :
  *    $Log: filters.h,v $
  *
  * Revisions   :
  *    $Log: filters.h,v $
+ *    Revision 1.2  2001/05/20 01:21:20  jongfoster
+ *    Version 2.9.4 checkin.
+ *    - Merged popupfile and cookiefile, and added control over PCRS
+ *      filtering, in new "permissionsfile".
+ *    - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
+ *      file error you now get a message box (in the Win32 GUI) rather
+ *      than the program exiting with no explanation.
+ *    - Made killpopup use the PCRS MIME-type checking and HTTP-header
+ *      skipping.
+ *    - Removed tabs from "config"
+ *    - Moved duplicated url parsing code in "loaders.c" to a new funcition.
+ *    - Bumped up version number.
+ *
  *    Revision 1.1.1.1  2001/05/15 13:58:52  oes
  *    Initial import of version 2.9.3 source tree
  *
  *
  *********************************************************************/
  *    Revision 1.1.1.1  2001/05/15 13:58:52  oes
  *    Initial import of version 2.9.3 source tree
  *
  *
  *********************************************************************/
-\f\r
+\f
 
 #include "project.h"
 
 
 #include "project.h"
 
@@ -63,6 +76,7 @@ extern char *block_url(struct http_request *http, struct client_state *csp);
 extern char *trust_url(struct http_request *http, struct client_state *csp);
 #endif /* def TRUST_FILES */
 extern char *intercept_url(struct http_request *http, struct client_state *csp);
 extern char *trust_url(struct http_request *http, struct client_state *csp);
 #endif /* def TRUST_FILES */
 extern char *intercept_url(struct http_request *http, struct client_state *csp);
+extern char *redirect_url(struct http_request *http, struct client_state *csp);
 
 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
 extern int block_imageurl(struct http_request *http, struct client_state *csp);
 
 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
 extern int block_imageurl(struct http_request *http, struct client_state *csp);
@@ -79,6 +93,7 @@ extern struct url_spec dsplit(char *domain);
 extern int domaincmp(struct url_spec *pattern, struct url_spec *fqdn);
 
 extern char *show_proxy_args(struct http_request *http, struct client_state *csp);
 extern int domaincmp(struct url_spec *pattern, struct url_spec *fqdn);
 
 extern char *show_proxy_args(struct http_request *http, struct client_state *csp);
+extern char *ijb_send_banner(struct http_request *http, struct client_state *csp);
 
 #ifdef TRUST_FILES
 extern char *ij_untrusted_url(struct http_request *http, struct client_state *csp);
 
 #ifdef TRUST_FILES
 extern char *ij_untrusted_url(struct http_request *http, struct client_state *csp);
diff --git a/jcc.c b/jcc.c
index ee27d19..9b3b9ee 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.3 2001/05/20 01:21:20 jongfoster Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.4 2001/05/21 19:34:01 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -33,6 +33,9 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.3 2001/05/20 01:21:20 jongfoster Exp $";
  *
  * Revisions   :
  *    $Log: jcc.c,v $
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.4  2001/05/21 19:34:01  jongfoster
+ *    Made failure to bind() a fatal error.
+ *
  *    Revision 1.3  2001/05/20 01:21:20  jongfoster
  *    Version 2.9.4 checkin.
  *    - Merged popupfile and cookiefile, and added control over PCRS
  *    Revision 1.3  2001/05/20 01:21:20  jongfoster
  *    Version 2.9.4 checkin.
  *    - Merged popupfile and cookiefile, and added control over PCRS
@@ -135,90 +138,6 @@ static void serve(struct client_state *csp);
 static int32 server_thread(void *data);
 #endif /* def __BEOS__ */
 
 static int32 server_thread(void *data);
 #endif /* def __BEOS__ */
 
-
-#define BODY   "<body bgcolor=\"#f8f8f0\" link=\"#000078\" alink=\"#ff0022\" vlink=\"#787878\">\n"
-
-static const char CFAIL[] =
-   "HTTP/1.0 503 Connect failed\n"
-   "Content-Type: text/html\n\n"
-   "<html>\n"
-   "<head>\n"
-   "<title>Internet Junkbuster: Connect failed</title>\n"
-   "</head>\n"
-   BODY
-   "<h1><center>"
-   BANNER
-   "</center></h1>"
-   "TCP connection to '%s' failed: %s.\n<br>"
-   "</body>\n"
-   "</html>\n";
-
-static const char CNXDOM[] =
-   "HTTP/1.0 404 Non-existent domain\n"
-   "Content-Type: text/html\n\n"
-   "<html>\n"
-   "<head>\n"
-   "<title>Internet Junkbuster: Non-existent domain</title>\n"
-   "</head>\n"
-   BODY
-   "<h1><center>"
-   BANNER
-   "</center></h1>"
-   "No such domain: %s\n"
-   "</body>\n"
-   "</html>\n";
-
-static const char CSUCCEED[] =
-   "HTTP/1.0 200 Connection established\n"
-   "Proxy-Agent: IJ/" VERSION "\n\n";
-
-static const char CHEADER[] =
-   "HTTP/1.0 400 Invalid header received from browser\n\n";
-
-static const char SHEADER[] =
-   "HTTP/1.0 502 Invalid header received from server\n\n";
-
-#if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
-
-/*
- * Hint: You can encode your own GIFs like that:
- * perl -e 'while (read STDIN, $c, 1) { printf("\\%.3o,", unpack("C", $c)); }'
- */
-
-static const char BLANKGIF[] =
-   "HTTP/1.0 200 OK\r\n"
-   "Pragma: no-cache\r\n"
-   "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
-   "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
-   "Content-type: image/gif\r\n\r\n"
-   "GIF89a\001\000\001\000\200\000\000\377\377\377\000\000"
-   "\000!\371\004\001\000\000\000\000,\000\000\000\000\001"
-   "\000\001\000\000\002\002D\001\000;";
-
-static const char JBGIF[] =
-   "HTTP/1.0 200 OK\r\n"
-   "Pragma: no-cache\r\n"
-   "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
-   "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
-   "Content-type: image/gif\r\n\r\n"
-   "GIF89aD\000\013\000\360\000\000\000\000\000\377\377\377!"
-   "\371\004\001\000\000\001\000,\000\000\000\000D\000\013\000"
-   "\000\002a\214\217\251\313\355\277\000\200G&K\025\316hC\037"
-   "\200\234\230Y\2309\235S\230\266\206\372J\253<\3131\253\271"
-   "\270\215\342\254\013\203\371\202\264\334P\207\332\020o\266"
-   "N\215I\332=\211\312\3513\266:\026AK)\364\370\365aobr\305"
-   "\372\003S\275\274k2\354\254z\347?\335\274x\306^9\374\276"
-   "\037Q\000\000;";
-
-static const char FWGIF[] =
-   "HTTP/1.0 302 Blocked Advert\r\n" 
-   "Pragma: no-cache\r\n"
-   "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
-   "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
-   "Location: ";
-
-#endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
-
 #ifdef _WIN32
 #define sleep(N)  Sleep(((N) * 1000))
 #endif
 #ifdef _WIN32
 #define sleep(N)  Sleep(((N) * 1000))
 #endif
@@ -247,36 +166,35 @@ static const char FWGIF[] =
  *********************************************************************/
 static void chat(struct client_state *csp)
 {
  *********************************************************************/
 static void chat(struct client_state *csp)
 {
-/* This next line is a little ugly, but it simplifies the if statement below. */\r
-/* Basically if TOGGLE, then we want the if to test "csp->toggled_on", else we don't */\r
-#ifdef TOGGLE\r
-#   define IS_TOGGLED_ON csp->toggled_on &&\r
-#else /* ifndef TOGGLE */\r
-#   define IS_TOGGLED_ON\r
-#endif /* ndef TOGGLE */\r
-\r
-/* This next line is a little ugly, but it simplifies the if statement below. */\r
-/* Basically if TRUST_FILES, then we want the if to call "trust_url", else we don't */\r
-#ifdef TRUST_FILES\r
-#   define IS_TRUSTED_URL (p = trust_url(http, csp)) ||\r
-#else /* ifndef TRUST_FILES */\r
-#   define IS_TRUSTED_URL\r
-#endif /* ndef TRUST_FILES */\r
-\r
-   \r
+/* This next line is a little ugly, but it simplifies the if statement below. */
+/* Basically if TOGGLE, then we want the if to test "csp->toggled_on", else we don't */
+#ifdef TOGGLE
+#   define IS_TOGGLED_ON csp->toggled_on &&
+#else /* ifndef TOGGLE */
+#   define IS_TOGGLED_ON
+#endif /* ndef TOGGLE */
+
+/* This next line is a little ugly, but it simplifies the if statement below. */
+/* Basically if TRUST_FILES, then we want the if to call "trust_url", else we don't */
+#ifdef TRUST_FILES
+#   define IS_TRUSTED_URL (p = trust_url(http, csp)) ||
+#else /* ifndef TRUST_FILES */
+#   define IS_TRUSTED_URL
+#endif /* ndef TRUST_FILES */
+
    char buf[BUFSIZ], *hdr, *p, *req;
    char *err = NULL;
    char *eno;
    fd_set rfds;
    int n, maxfd, server_body, ms_iis5_hack = 0;
    const struct gateway *gw;
    char buf[BUFSIZ], *hdr, *p, *req;
    char *err = NULL;
    char *eno;
    fd_set rfds;
    int n, maxfd, server_body, ms_iis5_hack = 0;
    const struct gateway *gw;
-   struct http_request *http;\r
-#ifdef KILLPOPUPS\r
-   int block_popups;         /* bool, 1==will block popups */\r
-   int block_popups_now = 0; /* bool, 1==currently blocking popups */\r
-#endif /* def KILLPOPUPS */\r
+   struct http_request *http;
+#ifdef KILLPOPUPS
+   int block_popups;         /* bool, 1==will block popups */
+   int block_popups_now = 0; /* bool, 1==currently blocking popups */
+#endif /* def KILLPOPUPS */
 #ifdef PCRS
 #ifdef PCRS
-   int pcrs_filter;   /* bool, 1==will filter through pcrs */\r
+   int pcrs_filter;   /* bool, 1==will filter through pcrs */
    int filtering = 0; /* bool, 1==currently filtering through pcrs */
 #endif /* def PCRS */
 
    int filtering = 0; /* bool, 1==currently filtering through pcrs */
 #endif /* def PCRS */
 
@@ -341,7 +259,7 @@ static void chat(struct client_state *csp)
    if ((gw = forward_url(http, csp)) == NULL)
    {
       log_error(LOG_LEVEL_FATAL, "gateway spec is NULL!?!?  This can't happen!");
    if ((gw = forward_url(http, csp)) == NULL)
    {
       log_error(LOG_LEVEL_FATAL, "gateway spec is NULL!?!?  This can't happen!");
-      /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
+      /* Never get here - LOG_LEVEL_FATAL causes program exit */
    }
 
    /* build the http request to send to the server
    }
 
    /* build the http request to send to the server
@@ -389,31 +307,31 @@ static void chat(struct client_state *csp)
          freez(p);
       }
    }
          freez(p);
       }
    }
-\r
+
    /* decide what we're to do with cookies */
    /* decide what we're to do with cookies */
-\r
-#ifdef TOGGLE\r
-   if (!csp->toggled_on)\r
-   {\r
-      /* Most compatible set of permissions */\r
-      csp->permissions = PERMIT_COOKIE_SET | PERMIT_COOKIE_READ | PERMIT_POPUPS;\r
-   }\r
-   else\r
-   {\r
-      csp->permissions = url_permissions(http, csp);\r
-   }\r
-#else /* ifndef TOGGLE */\r
-   csp->permissions = url_permissions(http, csp);\r
-#endif /* ndef TOGGLE */\r
-\r
-#ifdef KILLPOPUPS\r
-   block_popups               = ((csp->permissions & PERMIT_POPUPS) == 0);\r
-#endif /* def KILLPOPUPS */\r
-#ifdef PCRS\r
-   pcrs_filter                = (csp->rlist != NULL) &&  /* There are expressions to be used */\r
+
+#ifdef TOGGLE
+   if (!csp->toggled_on)
+   {
+      /* Most compatible set of permissions */
+      csp->permissions = PERMIT_COOKIE_SET | PERMIT_COOKIE_READ | PERMIT_POPUPS;
+   }
+   else
+   {
+      csp->permissions = url_permissions(http, csp);
+   }
+#else /* ifndef TOGGLE */
+   csp->permissions = url_permissions(http, csp);
+#endif /* ndef TOGGLE */
+
+#ifdef KILLPOPUPS
+   block_popups               = ((csp->permissions & PERMIT_POPUPS) == 0);
+#endif /* def KILLPOPUPS */
+#ifdef PCRS
+   pcrs_filter                = (csp->rlist != NULL) &&  /* There are expressions to be used */
                                 ((csp->permissions & PERMIT_RE_FILTER) != 0);
                                 ((csp->permissions & PERMIT_RE_FILTER) != 0);
-#endif /* def PCRS */\r
-\r
+#endif /* def PCRS */
+
 
    /* grab the rest of the client's headers */
 
 
    /* grab the rest of the client's headers */
 
@@ -443,15 +361,8 @@ static void chat(struct client_state *csp)
 
    destroy_list(csp->headers);
 
 
    destroy_list(csp->headers);
 
-
-   /*\r
-    * by haroon - most of credit to srt19170\r
-    * if toggled_on flag is true then IJB is enabled, do the usual\r
-    * otherwise avoid crunching\r
-    */\r
-
        /* Check the request against all rules, unless
        /* Check the request against all rules, unless
-        * we're disabled or in force mode. 
+        * we're toggled off or in force mode. 
     */
  
    if (IS_TOGGLED_ON
     */
  
    if (IS_TOGGLED_ON
@@ -460,7 +371,11 @@ static void chat(struct client_state *csp)
 #endif /* def FORCE_LOAD */
        ( (p = intercept_url(http, csp)) ||
          IS_TRUSTED_URL
 #endif /* def FORCE_LOAD */
        ( (p = intercept_url(http, csp)) ||
          IS_TRUSTED_URL
-         (p = block_url(http, csp)) ))
+         (p = block_url(http, csp))
+#ifdef FAST_REDIRECTS
+         || (fast_redirects && (p = redirect_url(http, csp))) 
+#endif /* def FAST_REDIRECTS */
+      ))
    {
 #ifdef STATISTICS
       csp->rejected = 1;
    {
 #ifdef STATISTICS
       csp->rejected = 1;
@@ -469,31 +384,33 @@ static void chat(struct client_state *csp)
       log_error(LOG_LEVEL_GPC, "%s%s crunch!", http->hostport, http->path);
 
 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
       log_error(LOG_LEVEL_GPC, "%s%s crunch!", http->hostport, http->path);
 
 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
-      /* now use block_imageurl */
+      /* Block as image?  */
       if ( (tinygif > 0) && block_imageurl(http, csp) )
       {
          /* Send "blocked" image */
          log_error(LOG_LEVEL_GPC, "%s%s image crunch!",
                    http->hostport, http->path);
 
       if ( (tinygif > 0) && block_imageurl(http, csp) )
       {
          /* Send "blocked" image */
          log_error(LOG_LEVEL_GPC, "%s%s image crunch!",
                    http->hostport, http->path);
 
+         if ((tinygif == 2) || strstr(http->path, "ijb-send-banner"))
+         {
+            write_socket(csp->cfd, JBGIF, sizeof(JBGIF)-1);
+         }
          if (tinygif == 1)
          {
             write_socket(csp->cfd, BLANKGIF, sizeof(BLANKGIF)-1);
          }
          else if ((tinygif == 3) && (tinygifurl))
          {
          if (tinygif == 1)
          {
             write_socket(csp->cfd, BLANKGIF, sizeof(BLANKGIF)-1);
          }
          else if ((tinygif == 3) && (tinygifurl))
          {
-            write_socket(csp->cfd, FWGIF, sizeof(FWGIF)-1);
-            write_socket(csp->cfd, tinygifurl, strlen(tinygifurl));
-         }
-         else
-         {
-            write_socket(csp->cfd, JBGIF, sizeof(JBGIF)-1);
+            p = (char *)malloc(strlen(HTTP_REDIRECT_TEMPLATE) + strlen(tinygifurl));
+                sprintf(p, HTTP_REDIRECT_TEMPLATE, tinygifurl);
+            write_socket(csp->cfd, p, strlen(p));
          }
       }
       else
 #endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
          }
       }
       else
 #endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
+      /* Block as HTML */
       {
       {
-         /* Send HTML "blocked" message */
+         /* Send HTML "blocked" message, interception, or redirection result */
          write_socket(csp->cfd, p, strlen(p));
       }
 
          write_socket(csp->cfd, p, strlen(p));
       }
 
@@ -797,24 +714,24 @@ static void chat(struct client_state *csp)
              * the client (along with anything else that
              * may be in the buffer)
              */
              * the client (along with anything else that
              * may be in the buffer)
              */
-\r
-#ifdef KILLPOPUPS\r
-            /* Start blocking popups if appropriate. */\r
-\r
-            if (csp->is_text  &&  /* It's a text / * MIME-Type */\r
-                !http->ssl    &&  /* We talk plaintext */\r
-                block_popups)\r
-            {\r
-               block_popups_now = 1;\r
-            }\r
-\r
-#endif /* def KILLPOPUPS */\r
-\r
+
+#ifdef KILLPOPUPS
+            /* Start blocking popups if appropriate. */
+
+            if (csp->is_text  &&  /* It's a text / * MIME-Type */
+                !http->ssl    &&  /* We talk plaintext */
+                block_popups)
+            {
+               block_popups_now = 1;
+            }
+
+#endif /* def KILLPOPUPS */
+
 #ifdef PCRS
             /* Start re_filtering this if appropriate. */
 #ifdef PCRS
             /* Start re_filtering this if appropriate. */
-\r
+
             if (csp->is_text  &&  /* It's a text / * MIME-Type */
             if (csp->is_text  &&  /* It's a text / * MIME-Type */
-                !http->ssl    &&  /* We talk plaintext */\r
+                !http->ssl    &&  /* We talk plaintext */
                 pcrs_filter)      /* Policy allows */
             {
                filtering = 1;
                 pcrs_filter)      /* Policy allows */
             {
                filtering = 1;
@@ -1056,7 +973,7 @@ static void listen_loop(void)
          "- There may be another junkbuster or some other "
          "proxy running on port %d", 
          (NULL != haddr) ? haddr : "INADDR_ANY", hport, hport
          "- There may be another junkbuster or some other "
          "proxy running on port %d", 
          (NULL != haddr) ? haddr : "INADDR_ANY", hport, hport
-      );\r
+      );
       /* shouldn't get here */
       return;
    }
       /* shouldn't get here */
       return;
    }
@@ -1136,7 +1053,7 @@ static void listen_loop(void)
 
       if (run_loader(csp))
       {
 
       if (run_loader(csp))
       {
-         log_error(LOG_LEVEL_FATAL, "a loader failed - must exit");\r
+         log_error(LOG_LEVEL_FATAL, "a loader failed - must exit");
          /* Never get here - LOG_LEVEL_FATAL causes program exit */
       }
 
          /* Never get here - LOG_LEVEL_FATAL causes program exit */
       }
 
index 185241b..e85f47e 100644 (file)
--- a/loadcfg.c
+++ b/loadcfg.c
@@ -1,4 +1,4 @@
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.2 2001/05/17 23:01:01 oes Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.3 2001/05/20 01:21:20 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
@@ -35,6 +35,19 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.2 2001/05/17 23:01:01 oes Exp $";
  *
  * Revisions   :
  *    $Log: loadcfg.c,v $
  *
  * Revisions   :
  *    $Log: loadcfg.c,v $
+ *    Revision 1.3  2001/05/20 01:21:20  jongfoster
+ *    Version 2.9.4 checkin.
+ *    - Merged popupfile and cookiefile, and added control over PCRS
+ *      filtering, in new "permissionsfile".
+ *    - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
+ *      file error you now get a message box (in the Win32 GUI) rather
+ *      than the program exiting with no explanation.
+ *    - Made killpopup use the PCRS MIME-type checking and HTTP-header
+ *      skipping.
+ *    - Removed tabs from "config"
+ *    - Moved duplicated url parsing code in "loaders.c" to a new funcition.
+ *    - Bumped up version number.
+ *
  *    Revision 1.2  2001/05/17 23:01:01  oes
  *     - Cleaned CRLF's from the sources and related files
  *
  *    Revision 1.2  2001/05/17 23:01:01  oes
  *     - Cleaned CRLF's from the sources and related files
  *
@@ -143,16 +156,20 @@ const char *aclfile     = NULL;
 #ifdef USE_IMAGE_LIST
 const char *imagefile   = NULL;
 #endif /* def USE_IMAGE_LIST */
 #ifdef USE_IMAGE_LIST
 const char *imagefile   = NULL;
 #endif /* def USE_IMAGE_LIST */
-\r
-/*\r
- * Permissions to use for URLs not in the permissions list.\r
+
+/*
+ * Permissions to use for URLs not in the permissions list.
  */
  */
-int default_permissions = PERMIT_RE_FILTER;\r
+int default_permissions = PERMIT_RE_FILTER;
 
 #ifdef PCRS
 const char *re_filterfile = NULL;
 #endif /* def PCRS */
 
 
 #ifdef PCRS
 const char *re_filterfile = NULL;
 #endif /* def PCRS */
 
+#ifdef FAST_REDIRECTS
+int fast_redirects = 0;
+#endif /* def FAST_REDIRECTS */
+
 #ifdef TRUST_FILES
 const char *trustfile   = NULL;
 #endif /* def TRUST_FILES */
 #ifdef TRUST_FILES
 const char *trustfile   = NULL;
 #endif /* def TRUST_FILES */
@@ -212,7 +229,7 @@ const char **Argv = NULL;
  * something a little more readable.  This also makes changing the
  * hash values easier if they should change or the hash algorthm changes.
  * Use the included "hash" program to find out what the hash will be
  * something a little more readable.  This also makes changing the
  * hash values easier if they should change or the hash algorthm changes.
  * Use the included "hash" program to find out what the hash will be
- * for any string supplied on the command line.  (Or just put it in the\r
+ * for any string supplied on the command line.  (Or just put it in the
  * config file and read the number from the error message in the log).
  */
 
  * config file and read the number from the error message in the log).
  */
 
@@ -225,7 +242,7 @@ const char **Argv = NULL;
 #define hash_suppress_vanilla_wafer    3121233547ul
 #define hash_wafer                     89669ul
 #define hash_add_header                237434619ul
 #define hash_suppress_vanilla_wafer    3121233547ul
 #define hash_wafer                     89669ul
 #define hash_add_header                237434619ul
-#define hash_permissions_file          3825730796lu /* "permissionsfile" */\r
+#define hash_permissions_file          3825730796lu /* "permissionsfile" */
 #define hash_logfile                   2114766ul
 #define hash_blockfile                 48845391ul
 #define hash_imagefile                 51447891ul
 #define hash_logfile                   2114766ul
 #define hash_blockfile                 48845391ul
 #define hash_imagefile                 51447891ul
@@ -238,6 +255,7 @@ const char **Argv = NULL;
 #define hash_referrer                  10883969ul
 #define hash_referer                   2176719ul
 #define hash_from                      16264ul
 #define hash_referrer                  10883969ul
 #define hash_referer                   2176719ul
 #define hash_from                      16264ul
+#define hash_fast_redirects            464873764lu
 #define hash_hide_console              2048809870ul
 #define hash_include_stats             2174146548ul
 #define hash_suppress_blocklists       1948693308ul
 #define hash_hide_console              2048809870ul
 #define hash_include_stats             2174146548ul
 #define hash_suppress_blocklists       1948693308ul
@@ -267,7 +285,7 @@ const char **Argv = NULL;
  * Returns     :  configret : 0 => Ok, everything else is an error.
  *                Note: we use configret since a signal handler cannot
  *                return a value, and this function does double duty.
  * Returns     :  configret : 0 => Ok, everything else is an error.
  *                Note: we use configret since a signal handler cannot
  *                return a value, and this function does double duty.
- *                Ie. Is is called from main and from signal( SIGHUP );\r
+ *                Ie. Is is called from main and from signal( SIGHUP );
  *
  *********************************************************************/
 void load_config( int signum )
  *
  *********************************************************************/
 void load_config( int signum )
@@ -309,8 +327,8 @@ void load_config( int signum )
 #endif /* def JAR_FILES */
 
    debug             = 0;
 #endif /* def JAR_FILES */
 
    debug             = 0;
-   multi_threaded    = 1;\r
-\r
+   multi_threaded    = 1;
+
    default_permissions = PERMIT_RE_FILTER;
 
 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
    default_permissions = PERMIT_RE_FILTER;
 
 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
@@ -374,13 +392,17 @@ void load_config( int signum )
    freez((char *)re_filterfile);
 #endif /* def PCRS */
 
    freez((char *)re_filterfile);
 #endif /* def PCRS */
 
+#ifdef FAST_REDIRECTS
+   fast_redirects = 0;
+#endif /* def FAST_REDIRECTS */
+
    if (NULL != configfile)
    {
       if ((configfp = fopen(configfile, "r")) == NULL)
       {
          log_error(LOG_LEVEL_FATAL, "can't open configuration file '%s':  %E",
                  configfile);
    if (NULL != configfile)
    {
       if ((configfp = fopen(configfile, "r")) == NULL)
       {
          log_error(LOG_LEVEL_FATAL, "can't open configuration file '%s':  %E",
                  configfile);
-         /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
+         /* Never get here - LOG_LEVEL_FATAL causes program exit */
       }
    }
 
       }
    }
 
@@ -577,6 +599,12 @@ void load_config( int signum )
                from = strdup(arg);
                continue;
 
                from = strdup(arg);
                continue;
 
+#ifdef FAST_REDIRECTS
+                          case hash_fast_redirects :
+               fast_redirects = 1;
+               continue;
+#endif /* def FAST_REDIRECTS */
+
 #ifdef _WIN_CONSOLE
             case hash_hide_console :
                hideConsole = 1;
 #ifdef _WIN_CONSOLE
             case hash_hide_console :
                hideConsole = 1;
@@ -689,11 +717,11 @@ void load_config( int signum )
                continue;
 
             default :
                continue;
 
             default :
-               /*\r
-                * I decided that I liked this better as a warning than an\r
-                * error.  To change back to an error, just change log level\r
-                * to LOG_LEVEL_FATAL.\r
-                */\r
+               /*
+                * I decided that I liked this better as a warning than an
+                * error.  To change back to an error, just change log level
+                * to LOG_LEVEL_FATAL.
+                */
                log_error(LOG_LEVEL_ERROR, "Unrecognized directive (%lulu) in "
                      "configuration file: \"%s\"", hash_string( cmd ), buf);
                p = malloc( BUFSIZ );
                log_error(LOG_LEVEL_ERROR, "Unrecognized directive (%lulu) in "
                      "configuration file: \"%s\"", hash_string( cmd ), buf);
                p = malloc( BUFSIZ );
@@ -786,7 +814,7 @@ void load_config( int signum )
       {
          *--p = ':';
          log_error(LOG_LEVEL_FATAL, "invalid bind port spec %s", haddr);
       {
          *--p = ':';
          log_error(LOG_LEVEL_FATAL, "invalid bind port spec %s", haddr);
-         /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
+         /* Never get here - LOG_LEVEL_FATAL causes program exit */
       }
       if (*haddr == '\0')
       {
       }
       if (*haddr == '\0')
       {
@@ -796,8 +824,8 @@ void load_config( int signum )
 
    if (run_loader(NULL))
    {
 
    if (run_loader(NULL))
    {
-      log_error(LOG_LEVEL_FATAL, "A loader failed while loading config file. Exiting.");\r
-      /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
+      log_error(LOG_LEVEL_FATAL, "A loader failed while loading config file. Exiting.");
+      /* Never get here - LOG_LEVEL_FATAL causes program exit */
    }
 
 #ifdef JAR_FILES
    }
 
 #ifdef JAR_FILES
index 58ed1bb..4c9e992 100644 (file)
--- a/loadcfg.h
+++ b/loadcfg.h
@@ -1,6 +1,6 @@
 #ifndef _LOADCFG_H
 #define _LOADCFG_H
 #ifndef _LOADCFG_H
 #define _LOADCFG_H
-#define LOADCFG_H_VERSION "$Id: loadcfg.h,v 1.2 2001/05/17 23:01:01 oes Exp $"
+#define LOADCFG_H_VERSION "$Id: loadcfg.h,v 1.3 2001/05/20 01:21:20 jongfoster Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.h,v $
  *
  * Revisions   :
  *    $Log: loadcfg.h,v $
  *
  * Revisions   :
  *    $Log: loadcfg.h,v $
+ *    Revision 1.3  2001/05/20 01:21:20  jongfoster
+ *    Version 2.9.4 checkin.
+ *    - Merged popupfile and cookiefile, and added control over PCRS
+ *      filtering, in new "permissionsfile".
+ *    - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
+ *      file error you now get a message box (in the Win32 GUI) rather
+ *      than the program exiting with no explanation.
+ *    - Made killpopup use the PCRS MIME-type checking and HTTP-header
+ *      skipping.
+ *    - Removed tabs from "config"
+ *    - Moved duplicated url parsing code in "loaders.c" to a new funcition.
+ *    - Bumped up version number.
+ *
  *    Revision 1.2  2001/05/17 23:01:01  oes
  *     - Cleaned CRLF's from the sources and related files
  *
  *    Revision 1.2  2001/05/17 23:01:01  oes
  *     - Cleaned CRLF's from the sources and related files
  *
@@ -96,7 +109,11 @@ extern const char *trustfile;
 extern const char *re_filterfile;
 #endif /* def PCRS */
 
 extern const char *re_filterfile;
 #endif /* def PCRS */
 
-extern int default_permissions;\r
+#ifdef FAST_REDIRECTS
+extern int fast_redirects;
+#endif /* def FAST_REDIRECTS */
+
+extern int default_permissions;
 
 #ifdef JAR_FILES
 extern const char *jarfile;
 
 #ifdef JAR_FILES
 extern const char *jarfile;
index ad686b3..4f51e0b 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.2 2001/05/17 23:02:36 oes Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.3 2001/05/20 01:21:20 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -41,6 +41,19 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.2 2001/05/17 23:02:36 oes Exp $";
  *
  * Revisions   :
  *    $Log: parsers.c,v $
  *
  * Revisions   :
  *    $Log: parsers.c,v $
+ *    Revision 1.3  2001/05/20 01:21:20  jongfoster
+ *    Version 2.9.4 checkin.
+ *    - Merged popupfile and cookiefile, and added control over PCRS
+ *      filtering, in new "permissionsfile".
+ *    - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
+ *      file error you now get a message box (in the Win32 GUI) rather
+ *      than the program exiting with no explanation.
+ *    - Made killpopup use the PCRS MIME-type checking and HTTP-header
+ *      skipping.
+ *    - Removed tabs from "config"
+ *    - Moved duplicated url parsing code in "loaders.c" to a new funcition.
+ *    - Bumped up version number.
+ *
  *    Revision 1.2  2001/05/17 23:02:36  oes
  *     - Made referrer option accept 'L' as a substitute for '§'
  *
  *    Revision 1.2  2001/05/17 23:02:36  oes
  *     - Made referrer option accept 'L' as a substitute for '§'
  *
@@ -114,8 +127,9 @@ const struct parsers client_patterns[] = {
 
 const struct interceptors intercept_patterns[] = {
    { "show-proxy-args",    14, show_proxy_args },
 
 const struct interceptors intercept_patterns[] = {
    { "show-proxy-args",    14, show_proxy_args },
+   { "ijb-send-banner",    14, ijb_send_banner },
 #ifdef TRUST_FILES
 #ifdef TRUST_FILES
-   { "ij-untrusted-url",   14, ij_untrusted_url },
+   { "ij-untrusted-url",   15, ij_untrusted_url },
 #endif /* def TRUST_FILES */
    { NULL, 0, NULL }
 };
 #endif /* def TRUST_FILES */
    { NULL, 0, NULL }
 };
diff --git a/pcrs.c b/pcrs.c
index cd0c94a..edb1ebf 100644 (file)
--- a/pcrs.c
+++ b/pcrs.c
@@ -1,18 +1,17 @@
-const char pcrs_rcs[] = "$Id: pcrs.c,v 1.1 2001/05/13 21:57:07 administrator Exp $";
+const char pcrs_rcs[] = "$Id: pcrs.c,v 1.1.1.1 2001/05/15 13:59:02 oes Exp $";
 
 /*********************************************************************
  *
 
 /*********************************************************************
  *
- * File        :  $Source: /home/administrator/cvs/ijb/pcrs.c,v $
+ * File        :  $Source: /cvsroot/ijbswa/current/pcrs.c,v $
  *
  *
- * Purpose     :  This is the pre-pre-alpha realease of libpcrs. It is only
- *                published at this (ugly) stage of development, because it is
+ * Purpose     :  This is the alpha release of libpcrs. It is only published
+ *                at this early stage of development, because it is
  *                needed for a new feature in JunkBuster.
  *
  *                needed for a new feature in JunkBuster.
  *
- *                Apart from the code being quite a mess, no inconsistencies,
- *                memory leaks or functional bugs **should** be present.
- *
- *                While you ROTFL at the code, you could just as well mail me
- *                (andreas@oesterhelt.org) with advice for improvement.
+ *                While no inconsistencies, memory leaks or functional bugs
+ *                are known at this time, there *could* be plenty ;-). Also,
+ *                Many pcre-specific options are not yet supported, and
+ *                error handling needs improvement.
  *
  *                pcrs is a supplement to the brilliant pcre library by Philip
  *                Hazel (ph10@cam.ac.uk) and adds Perl-style substitution. That
  *
  *                pcrs is a supplement to the brilliant pcre library by Philip
  *                Hazel (ph10@cam.ac.uk) and adds Perl-style substitution. That
@@ -21,10 +20,32 @@ const char pcrs_rcs[] = "$Id: pcrs.c,v 1.1 2001/05/13 21:57:07 administrator Exp
  *                Currently, there's no documentation besides comments and the
  *                source itself ;-)
  *
  *                Currently, there's no documentation besides comments and the
  *                source itself ;-)
  *
- * Copyright   :  Written and copyright by andreas@oesterhelt.org
+ * Copyright   :  Written and Copyright (C) 2000 by Andreas Oesterhelt
+ *                <andreas@oesterhelt.org>
+ *
+ *                This program is free software; you can redistribute it 
+ *                and/or modify it under the terms of the GNU General
+ *                Public License as published by the Free Software
+ *                Foundation; either version 2 of the License, or (at
+ *                your option) any later version.
+ *
+ *                This program is distributed in the hope that it will
+ *                be useful, but WITHOUT ANY WARRANTY; without even the
+ *                implied warranty of MERCHANTABILITY or FITNESS FOR A
+ *                PARTICULAR PURPOSE.  See the GNU General Public
+ *                License for more details.
+ *
+ *                The GNU General Public License should be included with
+ *                this file.  If not, you can view it at
+ *                http://www.gnu.org/copyleft/gpl.html
+ *                or write to the Free Software Foundation, Inc., 59
+ *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  * Revisions   :
  *    $Log: pcrs.c,v $
  *
  * Revisions   :
  *    $Log: pcrs.c,v $
+ *    Revision 1.1.1.1  2001/05/15 13:59:02  oes
+ *    Initial import of version 2.9.3 source tree
+ *
  *
  *********************************************************************/
 \f
  *
  *********************************************************************/
 \f
@@ -121,6 +142,7 @@ int pcrs_compile_perl_options(char *optstring, int *globalflag)
          case 'o': break;
          case 's': rc |= PCRE_DOTALL; break;
          case 'x': rc |= PCRE_EXTENDED; break;
          case 'o': break;
          case 's': rc |= PCRE_DOTALL; break;
          case 'x': rc |= PCRE_EXTENDED; break;
+         case 'U': rc |= PCRE_UNGREEDY; break;
          default:  break;
       }
    }
          default:  break;
       }
    }
index 7371d65..28511c9 100644 (file)
--- a/project.h
+++ b/project.h
@@ -1,6 +1,6 @@
 #ifndef _PROJECT_H
 #define _PROJECT_H
 #ifndef _PROJECT_H
 #define _PROJECT_H
-#define PROJECT_H_VERSION "$Id: project.h,v 1.2 2001/05/17 23:01:01 oes Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.3 2001/05/20 01:21:20 jongfoster Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/project.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/project.h,v $
  *
  * Revisions   :
  *    $Log: project.h,v $
  *
  * Revisions   :
  *    $Log: project.h,v $
+ *    Revision 1.3  2001/05/20 01:21:20  jongfoster
+ *    Version 2.9.4 checkin.
+ *    - Merged popupfile and cookiefile, and added control over PCRS
+ *      filtering, in new "permissionsfile".
+ *    - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
+ *      file error you now get a message box (in the Win32 GUI) rather
+ *      than the program exiting with no explanation.
+ *    - Made killpopup use the PCRS MIME-type checking and HTTP-header
+ *      skipping.
+ *    - Removed tabs from "config"
+ *    - Moved duplicated url parsing code in "loaders.c" to a new funcition.
+ *    - Bumped up version number.
+ *
  *    Revision 1.2  2001/05/17 23:01:01  oes
  *     - Cleaned CRLF's from the sources and related files
  *
  *    Revision 1.2  2001/05/17 23:01:01  oes
  *     - Cleaned CRLF's from the sources and related files
  *
@@ -118,7 +131,6 @@ struct http_request
    int   ssl;
 };
 
    int   ssl;
 };
 
-
 struct gateway
 {
    /* generic attributes */
 struct gateway
 {
    /* generic attributes */
@@ -188,8 +200,8 @@ struct list
 
 struct client_state
 {
 
 struct client_state
 {
-   int  permissions;\r
-   \r
+   int  permissions;
+   
    int  cfd;
    int  sfd;
 
    int  cfd;
    int  sfd;
 
@@ -242,17 +254,17 @@ struct client_state
    /* files associated with this client */
    struct file_list *blist;   /* blockfile */
    struct file_list *flist;   /* forwardfile */
    /* files associated with this client */
    struct file_list *blist;   /* blockfile */
    struct file_list *flist;   /* forwardfile */
-   struct file_list *permissions_list;\r
-\r
+   struct file_list *permissions_list;
 
 
-#ifdef ACL_FILES\r
+
+#ifdef ACL_FILES
    struct file_list *alist;   /* aclfile */
 #endif /* def ACL_FILES */
 
 #ifdef USE_IMAGE_LIST
    struct file_list *ilist;   /* imagefile */
 #endif /* def USE_IMAGE_LIST */
    struct file_list *alist;   /* aclfile */
 #endif /* def ACL_FILES */
 
 #ifdef USE_IMAGE_LIST
    struct file_list *ilist;   /* imagefile */
 #endif /* def USE_IMAGE_LIST */
-\r
+
 #ifdef PCRS
      struct file_list *rlist;   /* Perl re_filterfile */
 #endif /* def PCRS */
 #ifdef PCRS
      struct file_list *rlist;   /* Perl re_filterfile */
 #endif /* def PCRS */
@@ -260,7 +272,7 @@ struct client_state
 #ifdef TRUST_FILES
    struct file_list *tlist;   /* trustfile */
 #endif /* def TRUST_FILES */
 #ifdef TRUST_FILES
    struct file_list *tlist;   /* trustfile */
 #endif /* def TRUST_FILES */
-\r
+
    struct client_state *next;
 };
 
    struct client_state *next;
 };
 
@@ -349,20 +361,20 @@ struct block_spec
    int    reject;
    struct block_spec *next;
 };
    int    reject;
    struct block_spec *next;
 };
-\r
-
-#define PERMIT_COOKIE_SET    0x0001\r
-#define PERMIT_COOKIE_READ   0x0002\r
-#define PERMIT_RE_FILTER     0x0004\r
-#define PERMIT_POPUPS        0x0008\r
-
-struct permissions_spec\r
-{\r
-   struct url_spec           url[1];\r
-   int                       permissions;\r
-   struct permissions_spec * next;\r
-};\r
-\r
+
+
+#define PERMIT_COOKIE_SET    0x0001
+#define PERMIT_COOKIE_READ   0x0002
+#define PERMIT_RE_FILTER     0x0004
+#define PERMIT_POPUPS        0x0008
+
+struct permissions_spec
+{
+   struct url_spec           url[1];
+   int                       permissions;
+   struct permissions_spec * next;
+};
+
 struct forward_spec
 {
    struct url_spec url[1];
 struct forward_spec
 {
    struct url_spec url[1];
@@ -380,7 +392,7 @@ struct re_filterfile_spec
    pcrs_job *joblist;
 };
 #endif /* def PCRS */
    pcrs_job *joblist;
 };
 #endif /* def PCRS */
-\r
+
 
 #ifdef ACL_FILES
 #define ACL_PERMIT   1  /* accept connection request */
 
 #ifdef ACL_FILES
 #define ACL_PERMIT   1  /* accept connection request */
@@ -410,20 +422,113 @@ struct access_control_list
 #define BANNER    "<strong>Internet J<small>UNK<i><font color=\"red\">BUSTER</font></i></small></strong>"
 
 #ifdef FORCE_LOAD
 #define BANNER    "<strong>Internet J<small>UNK<i><font color=\"red\">BUSTER</font></i></small></strong>"
 
 #ifdef FORCE_LOAD
-/*
- * FIXME: Unfortunately, IE lowercases the domain name.  JunkBuster does
- * a case-sensitive compare.  JunkBuster should be modified to do a
- * case-insensitive compatison.  As a temporary workaround, I've lowercased
- * the FORCE_PREFIX.
- *
- * #define FORCE_PREFIX "IJB-FORCE-LOAD-"
- */
-#define FORCE_PREFIX "ijb-force-load-"
+#define FORCE_PREFIX "/IJB-FORCE-LOAD"
 #endif /* def FORCE_LOAD */
 
 #define HOME_PAGE_URL  "http://ijbswa.sourceforge.net/"
 #define REDIRECT_URL HOME_PAGE_URL "redirect.php?v=" VERSION "&to="
 
 #endif /* def FORCE_LOAD */
 
 #define HOME_PAGE_URL  "http://ijbswa.sourceforge.net/"
 #define REDIRECT_URL HOME_PAGE_URL "redirect.php?v=" VERSION "&to="
 
+static const char CFAIL[] =
+   "HTTP/1.0 503 Connect failed\n"
+   "Content-Type: text/html\n\n"
+   "<html>\n"
+   "<head>\n"
+   "<title>Internet Junkbuster: Connect failed</title>\n"
+   "</head>\n"
+   BODY
+   "<h1><center>"
+   BANNER
+   "</center></h1>"
+   "TCP connection to '%s' failed: %s.\n<br>"
+   "</body>\n"
+   "</html>\n";
+
+static const char CNXDOM[] =
+   "HTTP/1.0 404 Non-existent domain\n"
+   "Content-Type: text/html\n\n"
+   "<html>\n"
+   "<head>\n"
+   "<title>Internet Junkbuster: Non-existent domain</title>\n"
+   "</head>\n"
+   BODY
+   "<h1><center>"
+   BANNER
+   "</center></h1>"
+   "No such domain: %s\n"
+   "</body>\n"
+   "</html>\n";
+
+static const char CNOBANNER[] =
+   "HTTP/1.0 200 No Banner\n"
+   "Content-Type: text/html\n\n"
+   "<html>\n"
+   "<head>\n"
+   "<title>Internet Junkbuster: No Banner</title>\n"
+   "</head>\n"
+   BODY
+   "<h1><center>"
+   BANNER
+   "</h1>"
+   "You asked for a banner that this proxy can't produce because either configuration does not permit.\n<br>"
+   "or the URL didn't end with .gif\n"
+   "</center></body>\n"
+   "</html>\n";
+
+static const char CSUCCEED[] =
+   "HTTP/1.0 200 Connection established\n"
+   "Proxy-Agent: IJ/" VERSION "\n\n";
+
+static const char CHEADER[] =
+   "HTTP/1.0 400 Invalid header received from browser\n\n";
+
+static const char SHEADER[] =
+   "HTTP/1.0 502 Invalid header received from server\n\n";
+
+#if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
+
+/*
+ * Hint: You can encode your own GIFs like that:
+ * perl -e 'while (read STDIN, $c, 1) { printf("\\%.3o,", unpack("C", $c)); }'
+ */
+
+static const char BLANKGIF[] =
+   "HTTP/1.0 200 OK\r\n"
+   "Pragma: no-cache\r\n"
+   "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+   "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+   "Content-type: image/gif\r\n\r\n"
+   "GIF89a\001\000\001\000\200\000\000\377\377\377\000\000"
+   "\000!\371\004\001\000\000\000\000,\000\000\000\000\001"
+   "\000\001\000\000\002\002D\001\000;";
+
+static const char JBGIF[] =
+   "HTTP/1.0 200 OK\r\n"
+   "Pragma: no-cache\r\n"
+   "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+   "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+   "Content-type: image/gif\r\n\r\n"
+   "GIF89aD\000\013\000\360\000\000\000\000\000\377\377\377!"
+   "\371\004\001\000\000\001\000,\000\000\000\000D\000\013\000"
+   "\000\002a\214\217\251\313\355\277\000\200G&K\025\316hC\037"
+   "\200\234\230Y\2309\235S\230\266\206\372J\253<\3131\253\271"
+   "\270\215\342\254\013\203\371\202\264\334P\207\332\020o\266"
+   "N\215I\332=\211\312\3513\266:\026AK)\364\370\365aobr\305"
+   "\372\003S\275\274k2\354\254z\347?\335\274x\306^9\374\276"
+   "\037Q\000\000;";
+
+#endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
+
+#if defined(FAST_REDIRECTS) || defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
+
+static const char HTTP_REDIRECT_TEMPLATE[] =
+      "HTTP/1.0 302 Local Redirect from Junkbuster\r\n" 
+      "Pragma: no-cache\r\n"
+      "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+      "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT\r\n"
+      "Location: %s\r\n";
+
+#endif /*  defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
index 16c073b..6e40a89 100644 (file)
@@ -5,6 +5,10 @@
 # Note that you are free to choose the delimter as you
 # see fit.
 #
 # Note that you are free to choose the delimter as you
 # see fit.
 #
+# Note: in addidion to the Perl-options egimosx, U is supported
+# and turns the default to ungreedy matching. Add ? to quantifiers
+# to switch back to greedy.
+#
 
 # Kill OnUnload popups. Yummy.
 # check it out on http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
 
 # Kill OnUnload popups. Yummy.
 # check it out on http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
@@ -42,6 +46,28 @@ s/status='.*?';*//ig
 # JavaScript: s/window\.open\(/who_wants_this_to.open(/ig
 # HTML      : s/target="?_blank"?/target_who/g
 
 # JavaScript: s/window\.open\(/who_wants_this_to.open(/ig
 # HTML      : s/target="?_blank"?/target_who/g
 
+# Kill banners by size:
+# (Sizes from http://www.iab.net/iab_banner_standards/bannersizes.html)
+#
+s|<img [^>]*?(width=['"]?468\D)[^>]*(height=['"]?60\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?234\D)[^>]*(height=['"]?60\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?88\D)[^>]*(height=['"]?31\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?120\D)[^>]*(height=['"]?90\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?120\D)[^>]*(height=['"]?60\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?160\D)[^>]*(height=['"]?600\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?120\D)[^>]*(height=['"]?600\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?125\D)[^>]*(height=['"]?125\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?120\D)[^>]*(height=['"]?240\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?180\D)[^>]*(height=['"]?150\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?300\D)[^>]*(height=['"]?250\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?250\D)[^>]*(height=['"]?250\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?240\D)[^>]*(height=['"]?400\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+s|<img [^>]*?(width=['"]?336\D)[^>]*(height=['"]?280\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
+
+# Squish WebBugs:
+#
+s/<img [^>]*?(width|height) *= *['"]?1\D[^>]*?(width|height) *= *['"]?1\D.*?>/<!-- Squished WebBug -->/ig
+
 # Fun stuff:
 #
 s/microsoft(?!.com)/<b>MicroSuck<\/b>/ig
 # Fun stuff:
 #
 s/microsoft(?!.com)/<b>MicroSuck<\/b>/ig