#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
* 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
*/
#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.
*/
--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
# 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
# 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
# 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
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.
cat > conftest.$ac_ext << EOF
-#line 716 "configure"
+#line 718 "configure"
#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
{ 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 "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
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_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
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 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"
-{ (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
:
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"
-{ (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
:
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"
-{ (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
:
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
-#line 898 "configure"
+#line 900 "configure"
#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
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
-#line 927 "configure"
+#line 929 "configure"
#include "confdefs.h"
int main() {
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
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
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) ;;
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 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) ;;
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
-#line 1019 "configure"
+#line 1021 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#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*
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
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
:
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')
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
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
-#line 1124 "configure"
+#line 1126 "configure"
#include "confdefs.h"
int main() {
; 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
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
-#line 1199 "configure"
+#line 1201 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
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
-#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. */
; 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
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"
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 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
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
-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 $
*
* 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,
#ifdef _WIN32
#include <windows.h>
-#ifndef _WIN_CONSOLE\r
+#ifndef _WIN_CONSOLE
#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;
-\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)
/* 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);
+}
+
/*********************************************************************
*
if( logfname )
{
if( !(fp = fopen(logfname, "a")) )
- {\r
+ {
log_error(LOG_LEVEL_FATAL, "init_errlog(): can't open logfile: %s", logfname);
}
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_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;
+#endif /* def PCRS */
+#ifdef FORCE_LOAD
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;
}
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)
}
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 ) */
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 */
-\r
+
#if defined(_WIN32) && !defined(_WIN_CONSOLE)
/* Write to display */
LogPutString(outbuf);
#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 $
*
* 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
*
#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
+#endif /* def FORCE_LOAD */
+#ifdef 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
-#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, ...);
-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 $
* 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',
- * `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
*
* 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
"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";
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) ) )
}
+#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 */
/*********************************************************************
*
* 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.
*
*********************************************************************/
*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)
"<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);
s = strsav(s, "</code></a></li>\n");
}
#endif /* def USE_IMAGE_LIST */
-\r
+
#ifdef PCRS
if (csp->rlist)
{
}
+/*********************************************************************
+ *
+ * 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
/*********************************************************************
*
#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 $
*
* 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
*
*
*********************************************************************/
-\f\r
+\f
#include "project.h"
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);
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);
-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 $
*
* 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
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
*********************************************************************/
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;
- 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
- 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 */
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
freez(p);
}
}
-\r
+
/* 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);
-#endif /* def PCRS */\r
-\r
+#endif /* def PCRS */
+
/* grab the rest of the client's 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
- * we're disabled or in force mode.
+ * we're toggled off or in force mode.
*/
if (IS_TOGGLED_ON
#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;
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 == 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))
{
- 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) */
+ /* Block as HTML */
{
- /* Send HTML "blocked" message */
+ /* Send HTML "blocked" message, interception, or redirection result */
write_socket(csp->cfd, p, strlen(p));
}
* 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. */
-\r
+
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;
"- 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;
}
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 */
}
-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 $
*
* 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
*
#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 FAST_REDIRECTS
+int fast_redirects = 0;
+#endif /* def FAST_REDIRECTS */
+
#ifdef TRUST_FILES
const char *trustfile = NULL;
#endif /* def TRUST_FILES */
* 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).
*/
#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_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
* 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 )
#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)
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);
- /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
+ /* Never get here - LOG_LEVEL_FATAL causes program exit */
}
}
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;
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 );
{
*--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 (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
#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 $
*
* 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
*
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;
-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 $
*
* 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 'ยง'
*
const struct interceptors intercept_patterns[] = {
{ "show-proxy-args", 14, show_proxy_args },
+ { "ijb-send-banner", 14, ijb_send_banner },
#ifdef TRUST_FILES
- { "ij-untrusted-url", 14, ij_untrusted_url },
+ { "ij-untrusted-url", 15, ij_untrusted_url },
#endif /* def TRUST_FILES */
{ NULL, 0, NULL }
};
-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.
*
- * 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
* 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 $
+ * Revision 1.1.1.1 2001/05/15 13:59:02 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
\f
case 'o': break;
case 's': rc |= PCRE_DOTALL; break;
case 'x': rc |= PCRE_EXTENDED; break;
+ case 'U': rc |= PCRE_UNGREEDY; break;
default: break;
}
}
#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 $
*
* 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
*
int ssl;
};
-
struct gateway
{
/* generic attributes */
struct client_state
{
- int permissions;\r
- \r
+ int permissions;
+
int cfd;
int sfd;
/* 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 */
-\r
+
#ifdef PCRS
struct file_list *rlist; /* Perl re_filterfile */
#endif /* def PCRS */
#ifdef TRUST_FILES
struct file_list *tlist; /* trustfile */
#endif /* def TRUST_FILES */
-\r
+
struct client_state *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];
pcrs_job *joblist;
};
#endif /* def PCRS */
-\r
+
#ifdef ACL_FILES
#define ACL_PERMIT 1 /* accept connection request */
#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="
+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
# 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
# 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