From: Fabian Keil
Date: Wed, 27 Mar 2002 15:30:26 +0000 (+0000)
Subject: Synthetic commit for tag v_2_9_7
X-Git-Tag: v_2_9_7
X-Git-Url: http://www.privoxy.org/gitweb/?a=commitdiff_plain;h=edcdf98d67288cb521c8b545076b5edcc7c2c53c;p=privoxy.git
Synthetic commit for tag v_2_9_7
---
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 9ea1fd22..00000000
--- a/.gitignore
+++ /dev/null
@@ -1,55 +0,0 @@
-# CVS default ignores begin
-tags
-TAGS
-.make.state
-.nse_depinfo
-*~
-#*
-.#*
-,*
-_$*
-*$
-*.old
-*.bak
-*.BAK
-*.orig
-*.rej
-.del-*
-*.a
-*.olb
-*.o
-*.obj
-*.so
-*.exe
-*.Z
-*.elc
-*.ln
-core
-# CVS default ignores end
-*.txt
-GNUmakefile
-Makefile
-configure
-config.cache
-config.h
-config.h.in
-config.log
-config.status
-jarfile
-junkbstr.txt
-junkbuster
-junkbuster.log
-logfile
-permissionsfile
-privoxy
-privoxy.exe
-re_filterfile
-vc_debug
-vc_debug_winthr
-vc_junkbuster.ncb
-vc_junkbuster.opt
-vc_junkbuster.plg
-vc_release
-vc_release_winthr
-w32.aps
-w32.res
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index 9bece11a..00000000
--- a/AUTHORS
+++ /dev/null
@@ -1,53 +0,0 @@
- Authors of Privoxy v2.9.x and 3.x
-===========================================================================
-
-Current Project developers:
-
- Stefan Waldherr
- Andreas Oesterhelt
- Jon Foster
-
- Markus Breitenbach
- Thomas Steudten
-
-Current Project Contributors (in alphabetical order):
-
- David Schmidt (OS/2, Mac OSX ports)
- Gabriel L. Somlo
- Hal Burgiss (docs)
- Haroon Rafique
- John Venvertloh
- Joerg Strohmayer
- Rodney Stromlund
- Rodrigo Barbosa (RPM specfiles)
- Sarantis Paskalis
- Shamim Mohamed
-
-Originally developed by:
-
- Junkbusters Corp.
- Anonymous Coders
-
-Thanks to the many people who have tested Privoxy, reported bugs,
-or made suggestions. These include (in alphabetical order):
-
- Aaron Hamid
- Alexander Lazic (FreeBSD patch)
- Andrew J. Caines
- Bart Schelstraete
- Clifford Caoile
- Darren Wiebe
- Gabor Liptak
- Guy
- Ken Arromdee
- Magnus Holmgren
- Paul Lieverse
- Peter E
- Reiner Buehl
-
-If we've missed you off this list, please let us know!
-
-Privoxy team. http://www.privoxy.org/
-ijbswa-developers@lists.sourceforge.net
-
-
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index e16c454b..00000000
--- a/ChangeLog
+++ /dev/null
@@ -1,202 +0,0 @@
---------------------------------------------------------------------
-ChangeLog for Internet JunkBuster
---------------------------------------------------------------------
-
-*** Version 2.9.13 Beta ***
-
-- *NEWS*: The project has been renamed to Privoxy! The new name is
-reflected throughout (file locations, etc).
-- ijb.action is now default.action. re_filterfile is now
-default.filter.
-- http://i.j.b/ is now http://p.p/
-- The 'logo' option for replacing ad iamges is removed now. 'Pattern'
-(checkerboard) is now the default.
-
-
-*** Version 2.9.12 Beta ***
-
-- **READ**: The default listening PORT is NOW 8118!!! Changed from
-8000 due to conflict with NAS (Network Audio Server, whatever that
-is.)
-- More CGI actions editor fixes and improvements.
-- Win32 command line fix ups.
-- re_filterfile now has modular sections that can be activated on a
-per site basis. Some new goodies there too.
-- +filter now takes arguments to match FILTER sections in re_filterfile
-for even more flexibility.
-- Added a new image blocker option: +image-blocker{pattern}, which
-displays a checkerboard patthern and scales better than the logo.
-- PNG images will be used in place of GIF for JB built-in images
-if configured with --enable-no-gif.
-- Clean up compiler warnings (mostly).
-- Improved handling of failed DNS lookups & diagnostics for failed bind
-to listen socket
-- Made --no-daemon mode log to tty instead of logfile.
-- Various spec file and init script cleanups and improvements (Redhat and
-SuSE).
-- CGI Editor works on OS/2 now.
-- Fix restart failure where sockets were in TIME_WAIT.
-- Fixes for actions cgi editor, make sure we have right file.
-- A --pidfile command line option now, in addition to --help,
---version, --no-daemon, --user and configfile. --no-daemon replaces
-the former -d option and _DEBUG define. --user will drop privileges
-to the specified user.
-- Signal handling cleanups (*nix).
-- CGI actions editor improvements and fixes.
-- Error handling improvements, especially out of memory.
-- Default re_filterfile fix that caused spurious IJB logos
-(instead of 'blank').
-- configure.in threading fixes for Solaris.
-- Various other minor fixes.
-
-
-*** Version 2.9.11 Beta Changes ***
-
-- Add "session" cookie concept where cookies exist for the life
-of that browser session only (ie never goes to disk).
-- Checks for correct header length.
-- Fix user:pass@host.domain.com auth bug.
-- Better signal handling on *nix.
-- Fix CFLAGS hard-coded in configure.in
-- Fix threading bug re: gethostbyname() that caused random
-URLs to fail in some cases.
-
-
-*** Version 2.9.11 Alpha Changes ***
-
-- A web-based editor for the actions file is included (go to http://i.j.b/).
-- Web-based toggle IJB on/off support.
-- Cookie handling has changed - the new +no-cookies-keep feature is now the
-default.
-- actionsfile is renamed to ijb.action.
-- junkbstr.txt is now config.txt on Win32.
-- Support for running IJB as a UNIX daemon process has improved.
-- Unix daemon now returns error code on failed start.
-- Timestamps in logfile and jarfile now.
-- Fix for the Netscape bug reintroduced in 2.9.9.
-- make should now abort if gmake (GNU make) not present.
-- Many other minor bugfixes
-- Start a ChangeLog :)
-
-
-
-*** Version 2.9.3 pre-Alpha Changes ***
-
-- Amiga support (completely untested by me - I don't have an Amiga)
-- "tinygif 3" support (redirects blocked images to a specified URL, so
-the browser doesn't have to load and cache many copies of the same
-image).
-- one case where there were both local and global "referrer" variables
-(yuck!) clarified by renaming the local one to "refer".
-- Fixed some places where close() was used instead of close_socket().
-Thanks to Jörg Strohmayer (joergs at users.sourceforge.net) for these.
-- Temporary hack to get FORCE_LOAD to work with IE. I just lowercased the
-FORCE_LOAD_PREFIX. Needs fixing properly.
-- Most URLs hardcoded into JunkBuster were changed to go through a script
-e.g. http://ijbswa.sourceforge.net/redirect.php?v=2.9.3&to=faq
-The only other URLs left are the GNU GPL:
- http://www.fsf.org/copyleft/gpl.html
-and the home page:
- http://ijbswa.sourceforge.net/
-... and various URLs which will be intercepted by JunkBuster anyway.
-TODO: Still need to do something with the URLs in JunkBuster Corp's
-copyright/trademark notice on the bottom of the show-proxy-args page.
-- PCRE or GNU Regex is now a #define option.
-
-
-*** Version 2.9.2 pre-Alpha Changes ***
-
-- Andreas applied the latest version of the FORCE patch.
-
-
-*** Version 2.9.1 pre-Alpha Changes ***
-
-- in parsers.c, fixed two #ifdef FORCE to #ifdef FORCE_LOAD
-(BTW: I think FORCE is precise enough, since loading remote
-data is the whole purpose of a proxy..)
-- Set the FORCE_PREFIX (back) to 'IJB-FORCE-LOAD-'. While 'noijb.'
-is more elegant and looks like a hostname in the URL, it doesn't
-make clear to the inexperienced user that the proxy is bypassed. It
-also has a higher name collision risk.
-- Filled in the function header templates for my functions in
-parsers.c (again). They obviously got lost in our current
-patch war ;-)
-- Cut the credit for the §-referrer-option from the config file,
-that Stefan had placed there.
-- Improved the re_filterfile
-
-
-*** Version 2.9.0 pre-Alpha Changes ***
-
-- Now use PCRE, not GNU REGEX. I have not yet had chance to check the
-syntax of the block/image/cookie file to ensure that they match what
-is expected - however they seem to work.
-- Replaced "configure" script with one generated by "autoconf". Also
-use a header "config.h" (was ijbconfig.h in my previous release) for
-the #defines. "config.h" is now generated with "autoheader" from
-"acconfig.h" and "configure.in". (Note that to install you do not
-need autoconf or autoheader - just run "./configure".)
-To see command-line options, run "./configure --help".
-This is my first ever autoconf script, so it has some rough edges
-(how PCRE is handled is the roughest).
-- Error logging code replaced with new module errlog.c, based on the
-one from JunkBusterMT (but with the threading code removed).
-- Most of Rodney's 0.21 and 0.21A patches applied. (Marked *). I did not
-apply all of these, since I had already independently done conditional
-popup file, conditional image file, and integration of popup code.
-- ACL, Jar and trust files conditionally compiled.
-- New source file headers.
-- Various cosmetic changes. (But I have not consistently ordered the
-config files - I think that's worthwhile, but it's 1am and I want to
-get this released!)
-- RCS tags on .h files.
-- RCS tags are const char[] rather than const char *. (Saves 4 bytes
-per tag ;-)
-- VC++ project files renamed to vc_junkbuster.*.
-- show-proxy-args now shows status of all conditionals, not just REGEX
-- Various functions moved around. Most notably all the system-specific
-sockets code which was spread between jcc.c, bind.c, and connect.c,
-has been moved to "jbsockets.c". The non-system-specific code from
-connect.c and socks4.c has been movet to "gateway.c". Also, the
-config file loader and the global variables it writes to have been
-moved to "loadcfg.c". (Maybe this should go into loaders.c?)
-And candidate for the "worst filename ever" award is "miscutil.c",
-which contains, well, miscellaneous utility functions like zalloc.
-(Suggestions for a better name for this file are welcome!)
-- Loaders now use a common function to read a line and skip comments,
-and this function also stores the proxy_args.
-- Added ./junkbuster --help (Not for Win32 GUI)
-- Added ./junkbuster --version (Not for Win32 GUI)
-- Win32 resources are now all marked as "U.S. English", rather than
-being a mix of "U.S. English", "U.K. English" and "Irish English".
-- Version number changes to 2.9.0
-
-
-
-----------------------------------------------------------------------
-Copyright : Written by and Copyright (C) 2001 the SourceForge
- Privoxy team. http://www.privoxy.org/
-
- Based on the Internet Junkbuster originally written
- by and Copyright (C) 1997 Anonymous Coders and
- Junkbusters Corporation. http://www.junkbusters.com
-
- 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.
-
-
diff --git a/GNUmakefile.in b/GNUmakefile.in
deleted file mode 100644
index 7726cc7e..00000000
--- a/GNUmakefile.in
+++ /dev/null
@@ -1,945 +0,0 @@
-# Note: Makefile is built automatically from Makefile.in
-#
-# $Id: GNUmakefile.in,v 1.36 2002/03/27 14:58:08 swa Exp $
-#
-# Written by and Copyright (C) 2001 the SourceForge
-# Privoxy team. http://www.privoxy.org/
-#
-# Based on the Internet Junkbuster originally written
-# by and Copyright (C) 1997 Anonymous Coders and
-# Junkbusters Corporation. http://www.junkbusters.com
-#
-# 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.
-#
-
-#############################################################################
-# Version number (for RPM)
-#############################################################################
-
-VERSION_MAJOR = @VERSION_MAJOR@
-VERSION_MINOR = @VERSION_MINOR@
-VERSION_POINT = @VERSION_POINT@
-CODE_STATUS = @CODE_STATUS@
-VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
-# will automatically be postfixed with -$(RPM_PACKAGEV) in the SPECfile
-RPM_VERSION = $(VERSION)
-RPM_PACKAGEV = @VERSION_RPM_PACKAGE@
-
-
-#############################################################################
-# Directories for "make install"
-#############################################################################
-
-DEST = @sysconfdir@/privoxy
-SBIN_DEST = @sbindir@
-MAN_DEST = @mandir@
-
-
-#############################################################################
-# Build tools
-#############################################################################
-
-PROGRAM = privoxy@EXEEXT@
-CC = @CC@
-ECHO = echo
-GZIP_PROG = gzip
-INSTALL = cp -f
-LD = @CC@
-RM = rm -f
-STRIP_PROG = strip
-SED = sed
-CAT = cat
-RPM = rpm
-MV = mv
-TAR = tar
-MAKE = make
-LN = ln
-WDUMP = @WDUMP@ -dump
-JADEBIN = @JADEBIN@
-DB = $(JADEBIN) -t sgml -ihtml -D.. -d ldpOK.dsl\#html
-DB2HTML = @DB2HTML@
-DKPREFIX = @DKPREFIX@
-MAN2HTML = @MAN2HTML@
-TARGET_OS = foobar
-
-# Program to do LF->CRLF
-#
-# The sed version should be the most portable, but it doesn't for for me,
-# the other two do. FIXME.
-# - Jon
-#DOSFILTER = $(SED) -e $$'s,$$,\r,'
-#DOSFILTER = gawk -v ORS='\r\n' '{print $0;}'
-DOSFILTER = perl -p -e 's/\n/\r\n/'
-
-#############################################################################
-# Setup for make distribution rh and suse for now
-#############################################################################
-
-TAR_ARCH = /tmp/privoxy-$(RPM_VERSION).tar.gz
-RPM_BASE = @RPM_BASE@
-
-#############################################################################
-# Filenames and libraries
-#############################################################################
-
-C_SRC = actions.c cgi.c cgiedit.c cgisimple.c deanimate.c encode.c \
- errlog.c filters.c gateway.c jbsockets.c jcc.c killpopup.c \
- list.c loadcfg.c loaders.c miscutil.c parsers.c ssplit.c \
- urlmatch.c
-
-C_OBJS = $(C_SRC:.c=.@OBJEXT@)
-C_HDRS = $(C_SRC:.c=.h) project.h actionlist.h
-
-CONFIG_FILES = config trust \
- default.action \
- basic.action intermediate.action advanced.action \
- default.filter \
- templates/*
-
-DOC_FILES = AUTHORS LICENSE README ChangeLog doc/text/* privoxy.1
-
-W32_SRC = @WIN_ONLY@w32log.c w32taskbar.c win32.c
-W32_FILES = @WIN_ONLY@w32.res
-W32_OBJS = @WIN_ONLY@$(W32_SRC:.c=.@OBJEXT@) $(W32_FILES)
-W32_HDRS = @WIN_ONLY@w32log.h w32taskbar.h win32.h w32res.h
-W32_LIB = @WIN_ONLY@-lwsock32 -lcomctl32
-W32_INIS = @WIN_ONLY@config.txt trust.txt
-
-PCRS_SRC = @STATIC_PCRS_ONLY@pcrs.c
-PCRS_OBJS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.@OBJEXT@)
-PCRS_HDRS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.h)
-
-PCRE_SRC = @STATIC_PCRE_ONLY@pcre/get.c pcre/maketables.c pcre/study.c pcre/pcre.c
-PCRE_OBJS = @STATIC_PCRE_ONLY@$(PCRE_SRC:.c=.@OBJEXT@)
-PCRE_HDRS = @STATIC_PCRE_ONLY@pcre/config.h pcre/chartables.c pcre/internal.h pcre/pcre.h
-
-# No REGEX (Either because dynamically linked pcreposix, or no regex at all):
-REGEX_SRC =
-# GNU REGEX:
-@GNU_REGEX_ONLY@REGEX_SRC = gnu_regex.c
-# PCRE REGEX:
-@PCRE_REGEX_ONLY@@STATIC_PCRE_ONLY@REGEX_SRC = pcre/pcreposix.c
-
-REGEX_OBJS = $(REGEX_SRC:.c=.@OBJEXT@)
-REGEX_HDRS = $(REGEX_SRC:.c=.h)
-
-# Dependencies introduced by #include "project.h".
-PROJECT_H_DEPS = project.h $(REGEX_HDRS) $(PCRS_HDRS) @STATIC_PCRE_ONLY@pcre/pcre.h
-
-# Socket libraries for platforms that need them explicitly defined
-SOCKET_LIB = @SOCKET_LIB@
-
-# PThreads library, if needed.
-PTHREAD_LIB = @PTHREAD_ONLY@@PTHREAD_LIB@
-
-SRCS = $(C_SRC) $(W32_SRC) $(PCRS_SRC) $(PCRE_SRC) $(REGEX_SRC)
-OBJS = $(C_OBJS) $(W32_OBJS) $(PCRS_OBJS) $(PCRE_OBJS) $(REGEX_OBJS)
-HDRS = $(C_HDRS) $(W32_HDRS) $(PCRS_HDRS) $(PCRE_OBJS) $(REGEX_HDRS)
-LIBS = @LIBS@ $(W32_LIB) $(SOCKET_LIB) $(PTHREAD_LIB)
-
-
-#############################################################################
-# Compiler switches
-#############################################################################
-
-# The flag "-mno-win32" can be used by Cygwin to emulate a un?x type build.
-# The flag "-mwindows -mno-cygwin" will cause Cygwin to use MingW32 for a
-# Win32 GUI build.
-# The flag "-pthread" is required if using Pthreads under Linux (and
-# possibly other OSs).
-SPECIAL_CFLAGS = @SPECIAL_CFLAGS@
-
-# Add your flags here
-OTHER_CFLAGS =
-
-CFLAGS = @CFLAGS@ @CPPFLAGS@ $(OTHER_CFLAGS) $(SPECIAL_CFLAGS) -Wall \
- @STATIC_PCRE_ONLY@ -Ipcre
-
-LDFLAGS = $(DEBUG_CFLAGS) $(SPECIAL_CFLAGS)
-
-
-#############################################################################
-# Build section.
-#
-# There should NOT be any targets above this line.
-#############################################################################
-all: $(PROGRAM)
-
-
-#############################################################################
-# Phony targets
-#############################################################################
-.PHONY: all inifiles redhat-dist redhat-upload solaris-dist suse-dist \
-suse-upload win-dist tarball-dist dok redhat-dok webserver clean clobber tags \
-install
-
-
-#############################################################################
-# Define this explicitly because Solaris is broken!
-#############################################################################
-%.o: %.c
- $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
-
-
-#############################################################################
-# Win32 config files
-#############################################################################
-
-inifiles: $(W32_INIS)
-
-config.txt: config
- $(SED) -e 's!\trustfile trust!trustfile trust.txt!' \
- -e 's!\jarfile jarfile!jarfile jar.log!' \
- -e 's!\logfile logfile!logfile privoxy.log!' \
- -e 's!#Win32-only: !!' \
- < $< | \
- $(DOSFILTER) > $@
- # LF to CRLF in default.action
- $(DOSFILTER) default.action.txt && mv default.action.txt default.action
- # LF to CRLF in default.filter
- $(DOSFILTER) default.filter.txt && mv default.filter.txt default.filter
-
-trust.txt: trust
- $(DOSFILTER) < $< > $@
-
-re_filterfile.txt: re_filterfile
- $(DOSFILTER) < $< > $@
-
-
-#############################################################################
-# redhat distribution alpha and x86
-#############################################################################
-
-redhat-dist:
- for dir in RPMS SRPMS BUILD SOURCES SPECS; do \
- if [ ! -w $(RPM_BASE)/$$dir ]; then \
- $(ECHO) "$(RPM_BASE)/$$dir is not writable for you. Maybe try as root."; \
- $(ECHO) "Or add a suitable path to .rpmmacros like."; \
- $(ECHO) "%_topdir /home/foo/rpm-build"; \
- exit 1; \
- fi; \
- done; \
-
- $(MAKE) clobber
- if [ -f $(TAR_ARCH) ]; then $(RM) $(TAR_ARCH); fi
-
- TMPFILE=$$(mktemp -q /tmp/$(PROGRAM).XXXXXX); \
- if $(SED) -e 's/^\(Version:\).*/\1 $(RPM_VERSION)/g' \
- -e 's/^\(Release:\).*/\1 $(RPM_PACKAGEV)/g' \
- privoxy-rh.spec > $$TMPFILE ; then \
- $(MV) -f $$TMPFILE privoxy-rh.spec; \
- else \
- $(ECHO) "Could not set version info in specfile."; \
- exit 1;\
- fi
-
- $(TAR) --exclude "CVS" --exclude "privoxy-suse.spec" -czf $(TAR_ARCH) .
- $(RPM) --clean -ta $(TAR_ARCH)
- if [ -f $(TAR_ARCH) ]; then $(RM) $(TAR_ARCH); fi
-
-#
-# anonymously ncftps the rpms to sourceforge
-#
-redhat-upload:
- ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/SRPMS/privoxy-$(RPM_VERSION)-$(RPM_PACKAGEV).src.rpm
-# better should use `arch` here instead of ix86 to support other platforms too
- ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/RPMS/*/privoxy-$(RPM_VERSION)-$(RPM_PACKAGEV).*.rpm
- @$(ECHO) -------------------------------------------------------
- @$(ECHO) Now goto
- @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
- @$(ECHO) ... and release the files.
- @$(ECHO) -------------------------------------------------------
- # w3m http://sourceforge.net/project/admin/editpackages.php?group_id=11118
-
-#############################################################################
-# sun solaris distribution
-#############################################################################
-
-solaris-dist:
- @$(ECHO) ""
- @$(ECHO) "You have run autoconf && autoheader && ./configure right?"
- @$(ECHO) ""
- $(MAKE) $(PROGRAM)
- $(STRIP_PROG) $(PROGRAM)
- $(LN) -s current ../privoxy-$(VERSION)-$(CODE_STATUS)
-# add program
- $(TAR) -C.. -cvhf privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar privoxy-$(VERSION)-$(CODE_STATUS)/$(PROGRAM)
-# add config files
- for foo in $(CONFIG_FILES); do \
- $(TAR) -C.. --exclude "CVS" --exclude "#*" --exclude ".#*" --exclude ".cvsignore" -uvhf privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar privoxy-$(VERSION)-$(CODE_STATUS)/$$foo; \
- done;
-# add documentation
- for foo in $(DOC_FILES); do \
- $(TAR) -C.. --exclude "CVS" --exclude "#*" --exclude ".#*" --exclude ".cvsignore" -uvhf privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar privoxy-$(VERSION)-$(CODE_STATUS)/$$foo; \
- done;
-# and zip the archive
- $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
- $(GZIP_PROG) privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar
- @$(ECHO) Distribution with binary created.
-
-# anonymously ncftps the tarball to sourceforge
-solaris-upload:
- ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar.gz
- @$(ECHO) -------------------------------------------------------
- @$(ECHO) Now goto
- @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
- @$(ECHO) ... and release the files.
- @$(ECHO) -------------------------------------------------------
-
-# use with care
-solaris-clean:
- $(RM) privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar*
-
-#############################################################################
-# hpux distribution
-#############################################################################
-hpux-dist:
- @$(ECHO) coming soon.
-hpux-upload:
- @$(ECHO) coming soon.
-
-#############################################################################
-# debian distribution
-#############################################################################
-debian-dist:
- @$(ECHO) coming soon.
-debian-upload:
- @$(ECHO) coming soon.
-
-#############################################################################
-# macosx distribution
-#############################################################################
-macosx-dist:
- @$(ECHO) coming soon.
-macosx-upload:
- @$(ECHO) coming soon.
-
-#############################################################################
-# amiga distribution
-#############################################################################
-amiga-dist:
- @$(ECHO) coming soon.
-amiga-upload:
- @$(ECHO) coming soon.
-
-#############################################################################
-# freebsd distribution
-#############################################################################
-freebsd-dist:
- @$(ECHO) coming soon.
-freebsd-upload:
- @$(ECHO) coming soon.
-
-#############################################################################
-# suse distribution. works fine. no need to be root.
-#############################################################################
-suse-dist:
- for dir in RPMS SRPMS BUILD SOURCES SPECS; do \
- if [ ! -w $(RPM_BASE)/$$dir ]; then \
- $(ECHO) "$(RPM_BASE)/$$dir is not writable for you. Maybe try as root."; \
- $(ECHO) "Or add a suitable path to .rpmmacros like."; \
- $(ECHO) "%_topdir /home/foo/rpm-build"; \
- exit 1; \
- fi; \
- done; \
-
- $(MAKE) clobber
- if [ -f $(TAR_ARCH) ]; then $(RM) $(TAR_ARCH); fi
-
- TMPFILE=$$(mktemp -q /tmp/$(PROGRAM).XXXXXX); \
- if $(SED) -e 's/^\(Version:\).*/\1 $(RPM_VERSIO)/g' \
- -e 's/^\(Release:\).*/\1 $(RPM_PACKAGEV)/g' \
- privoxy-suse.spec > $$TMPFILE ; then \
- $(MV) -f $$TMPFILE privoxy-suse.spec; \
- else \
- $(ECHO) "Could not set version info in specfile."; \
- exit 1;\
- fi
-
- $(TAR) --exclude "CVS" --exclude "privoxy-rh.spec" -czf $(TAR_ARCH) .
- $(RPM) --clean -ta $(TAR_ARCH)
- if [ -f $(TAR_ARCH) ]; then $(RM) $(TAR_ARCH); fi
-
-#
-# anonymously ncftps the rpms to sourceforge
-#
-suse-upload:
- ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/SRPMS/privoxy-suse-$(RPM_VERSION)-$(RPM_PACKAGEV).src.rpm
-# better should use `arch` here instead of ix86 to support other platforms too
- ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/RPMS/*/privoxy-suse-$(RPM_VERSION)-$(RPM_PACKAGEV).*.rpm
- @$(ECHO) -------------------------------------------------------
- @$(ECHO) Now goto
- @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
- @$(ECHO) ... and release the files.
- @$(ECHO) -------------------------------------------------------
-
-# handle with care. use with root.
-suse-clean:
- rpm -e junkbuster-suse || true
- rm -rf /etc/junkbuster
- rm -rf /etc/rc.d/junkbuster*
- rm -rf /var/run/junkbuster.pid
- rm -rf /var/log/junkbuster
- rm -f /etc/init.d/junkbuster
- rm -f /usr/sbin/junkbuster
- rm -f /usr/sbin/rcjunkbuster
- rm -f /usr/share/man/man1/junkbuster.1.gz
- rpm -e privoxy-suse || true
- rm -rf /etc/privoxy
- rm -rf /etc/rc.d/privoxy*
- rm -rf /var/run/privoxy.pid
- rm -rf /var/log/privoxy
- rm -f /etc/init.d/privoxy
- rm -f /usr/sbin/privoxy
- rm -f /usr/sbin/rcprivoxy
- rm -f /usr/share/man/man1/privoxy.1.gz
-
-#############################################################################
-# Windows distribution
-#############################################################################
-win-dist:
- $(ECHO) Not implemented.
-
-
-#############################################################################
-# Tarball distribution
-#############################################################################
-tarball-dist: clobber
- $(LN) -s current ../privoxy-$(VERSION)-$(CODE_STATUS)
- $(TAR) -C.. --exclude "CVS" --exclude "#*" --exclude ".#*" --exclude ".cvsignore" -cvhzf privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz privoxy-$(VERSION)-$(CODE_STATUS)
- $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
- @$(ECHO) Tarball (without any binary) created.
-
-# anonymously ncftps the tarball to sourceforge
-tarball-upload:
- ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
- @$(ECHO) -------------------------------------------------------
- @$(ECHO) Now goto
- @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
- @$(ECHO) ... and release the files.
- @$(ECHO) -------------------------------------------------------
-
-# handle with care
-tarball-clean:
- $(RM) privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
-
-#############################################################################
-#
-# Documentation
-#
-# converts doc/source/*.sgml into html, text and man pages
-#
-#############################################################################
-dok: doc/source/ldpOK.dsl man2html-swa
- mkdir -p doc/text doc/man
-# user manual
- rm -rf doc/webserver/user-manual
- cd doc/source && $(DB2HTML) -s ldpOK.dsl user-manual.sgml && mv user-manual ../webserver
- cd doc/source && $(DB2HTML) -s ldpOK.dsl --nochunks user-manual.sgml > tmp.html && lynx -dump tmp.html > ../text/user-manual.txt && rm -rf tmp.html user-manual
-## developer manual
- rm -rf doc/webserver/developer-manual
- cd doc/source && $(DB2HTML) -s ldpOK.dsl developer-manual.sgml && mv developer-manual ../webserver
- cd doc/source && $(DB2HTML) -s ldpOK.dsl --nochunks developer-manual.sgml > tmp.html && lynx -dump tmp.html > ../text/developer-manual.txt && rm -rf tmp.html developer-manual
-## faq
- rm -rf doc/webserver/faq
- cd doc/source && $(DB2HTML) -s ldpOK.dsl faq.sgml && mv faq ../webserver
- cd doc/source && $(DB2HTML) -s ldpOK.dsl --nochunks faq.sgml > tmp.html && lynx -dump tmp.html > ../text/faq.txt && rm -rf tmp.html faq
-
-man2html-swa:
- if [ "$(MAN2HTML)" != "false" ]; then \
- mkdir -p doc/webserver/man-page; \
- $(ECHO) "Privoxy|Doc/Man page
NAME
" > doc/webserver/man-page/privoxy-man-page.html; \
- man ./privoxy.1 | $(MAN2HTML) -bare \
- >> doc/webserver/man-page/privoxy-man-page.html; \
- $(ECHO) "" >> doc/webserver/man-page/privoxy-man-page.html; \
- fi
-
-redhat-dok: doc/source/ldpOK.dsl man2html
- mkdir -p doc/text doc/man doc/source/user-manual \
- doc/source/developer-manual doc/source/faq
-## user manual
- rm -rf doc/webserver/user-manual
- cd doc/source/user-manual && $(DB) ../user-manual.sgml && cd .. &&\
- mv user-manual ../webserver
- cd doc/source && $(DB) -V nochunks user-manual.sgml > tmp.html && \
- $(WDUMP) tmp.html > ../text/user-manual.txt && rm -rf tmp.html \
- user-manual
-## developer manual
- rm -rf doc/webserver/developer-manual
- cd doc/source/developer-manual && $(DB) ../developer-manual.sgml &&\
- cd .. && mv developer-manual ../webserver
- cd doc/source && $(DB) -V nochunks developer-manual.sgml > tmp.html && \
- $(WDUMP) tmp.html > ../text/developer-manual.txt && rm -rf tmp.html \
- developer-manual
-## faq
- rm -rf doc/webserver/faq
- cd doc/source/faq && $(DB) ../faq.sgml && cd .. && mv faq ../webserver
- cd doc/source && $(DB) -V nochunks faq.sgml > tmp.html && $(WDUMP) \
- tmp.html > ../text/faq.txt && rm -rf tmp.html faq
-
-doc/source/ldpOK.dsl:
- if [ "$(DKPREFIX)" != "none" ]; then \
- sed -e "s@/usr/share/sgml/docbook/dsssl-stylesheets@$(DKPREFIX)@g" doc/source/ldp.dsl > doc/source/ldpOK.dsl; \
- else \
- cp doc/source/ldp.dsl doc/source/ldpOK.dsl; \
- fi
-
-man2html:
- if [ "$(MAN2HTML)" != "false" ]; then \
- $(MAN2HTML) privoxy.1 |grep -v "^Content-type" > doc/webserver/man-page/privoxy-man-page.html; \
- fi
-
-#############################################################################
-#
-# Webserver
-#
-# moves dokumentation to webserver
-#
-#############################################################################
-webserver:
- @$(ECHO) -------------------------------------------------------
- @$(ECHO) You have run make dok/redhat-dok before, right?
- @$(ECHO) Note that this command scps all stuff to the webserver,
- @$(ECHO) it will not remove obsolete documents.
- @$(ECHO) -------------------------------------------------------
- chmod -R a+r doc/webserver
- find doc/webserver -type d -exec chmod a+rx {} \;
- cd doc/webserver && scp -Cr . ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
-
-#############################################################################
-# Source file dependencies
-#############################################################################
-
-actions.@OBJEXT@: actions.c actions.h config.h $(PROJECT_H_DEPS) errlog.h jcc.h list.h loaders.h miscutil.h actionlist.h
-cgi.@OBJEXT@: cgi.c cgi.h config.h $(PROJECT_H_DEPS) cgiedit.h cgisimple.h list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
-cgiedit.@OBJEXT@: cgiedit.c cgiedit.h config.h $(PROJECT_H_DEPS) cgi.h list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
-cgisimple.@OBJEXT@: cgisimple.c cgisimple.h config.h $(PROJECT_H_DEPS) cgi.h list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
-deanimate.@OBJEXT@: deanimate.c deanimate.h config.h $(PROJECT_H_DEPS)
-encode.@OBJEXT@: encode.c encode.h config.h
-errlog.@OBJEXT@: errlog.c errlog.h config.h $(PROJECT_H_DEPS) @WIN_ONLY@w32log.h
-filters.@OBJEXT@: filters.c filters.h config.h $(PROJECT_H_DEPS) errlog.h encode.h gateway.h jbsockets.h jcc.h loadcfg.h parsers.h ssplit.h cgi.h deanimate.h @WIN_ONLY@win32.h
-gateway.@OBJEXT@: gateway.c gateway.h config.h $(PROJECT_H_DEPS) errlog.h jbsockets.h jcc.h loadcfg.h
-jbsockets.@OBJEXT@: jbsockets.c jbsockets.h config.h $(PROJECT_H_DEPS) filters.h
-jcc.@OBJEXT@: jcc.c jcc.h config.h $(PROJECT_H_DEPS) errlog.h filters.h gateway.h jbsockets.h killpopup.h loadcfg.h loaders.h miscutil.h parsers.h @WIN_ONLY@w32log.h win32.h cgi.h
-killpopup.@OBJEXT@: killpopup.c killpopup.h config.h $(PROJECT_H_DEPS) jcc.h loadcfg.h
-list.@OBJEXT@: list.c list.h config.h $(PROJECT_H_DEPS) list.h miscutil.h
-loadcfg.@OBJEXT@: loadcfg.c loadcfg.h config.h $(PROJECT_H_DEPS) errlog.h filters.h gateway.h jbsockets.h jcc.h killpopup.h loaders.h miscutil.h parsers.h @WIN_ONLY@w32log.h win32.h
-loaders.@OBJEXT@: loaders.c loaders.h config.h $(PROJECT_H_DEPS) errlog.h encode.h filters.h gateway.h jcc.h loadcfg.h miscutil.h parsers.h ssplit.h
-miscutil.@OBJEXT@: miscutil.c miscutil.h config.h
-parsers.@OBJEXT@: parsers.c parsers.h config.h $(PROJECT_H_DEPS) errlog.h encode.h filters.h jbsockets.h jcc.h loadcfg.h loaders.h miscutil.h ssplit.h
-ssplit.@OBJEXT@: ssplit.c ssplit.h config.h miscutil.h
-urlmatch.@OBJEXT@: urlmatch.c urlmatch.h config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
-
-# GNU regex
-gnu_regex.@OBJEXT@: gnu_regex.c gnu_regex.h config.h
-
-# PCRS
-pcrs.@OBJEXT@: pcrs.c pcre/pcre.h pcrs.h
-
-# PCRE
-pcre/get.@OBJEXT@: pcre/get.c pcre/config.h pcre/internal.h pcre/pcre.h
-pcre/maketables.@OBJEXT@: pcre/maketables.c pcre/config.h pcre/internal.h pcre/pcre.h
-pcre/pcre.@OBJEXT@: pcre/pcre.c pcre/config.h pcre/internal.h pcre/pcre.h pcre/chartables.c
-pcre/pcreposix.@OBJEXT@: pcre/pcreposix.c pcre/config.h pcre/internal.h pcre/pcre.h pcre/pcreposix.h
-pcre/study.@OBJEXT@: pcre/study.c pcre/config.h pcre/internal.h pcre/pcre.h
-
-# An auxiliary program makes the PCRE default character table source
-
-pcre/chartables.c: pcre/dftables@EXEEXT@
- pcre/dftables@EXEEXT@ >pcre/chartables.c
-
-pcre/dftables@EXEEXT@: pcre/dftables.c pcre/maketables.c pcre/pcre.h pcre/internal.h pcre/config.h
- $(CC) -o pcre/dftables@EXEEXT@ $(CFLAGS) pcre/dftables.c
-
-# Win32
-w32log.@OBJEXT@: w32log.c errlog.h config.h jcc.h loadcfg.h miscutil.h pcre/pcre.h pcre/pcreposix.h pcrs.h project.h w32log.h w32taskbar.h win32.h
-w32taskbar.@OBJEXT@: w32taskbar.c config.h w32log.h w32taskbar.h
-win32.@OBJEXT@: win32.c config.h jcc.h loadcfg.h pcre/pcre.h pcre/pcreposix.h pcrs.h project.h w32log.h win32.h
-
-w32.res: w32.rc w32res.h icons/ico00001.ico icons/ico00002.ico icons/ico00003.ico icons/ico00004.ico icons/ico00005.ico icons/ico00006.ico icons/ico00007.ico icons/ico00008.ico icons/idle.ico icons/privoxy.ico config.h
- windres -D__MINGW32__=0.2 -O coff -i $< -o $@
-
-# AmigaOS
-@AMIGAOS_ONLY@OBJS += amiga.o
-@AMIGAOS_ONLY@CFLAGS += -D__AMIGAVERSION__=\"$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_POINT)\" -D__AMIGADATE__=\"`date +%d.%m.%Y`\" -W -m68020 -noixemul -fbaserel -msmall-code
-@AMIGAOS_ONLY@LDFLAGS += -m68020 -noixemul -fbaserel
-@AMIGAOS_ONLY@LIBS = -lm /gg/lib/libb/libm020/libnix/swapstack.o
-@AMIGAOS_ONLY@amiga.o: amiga.c amiga.h config.h
-
-
-$(PROGRAM): $(OBJS) $(W32_FILES)
- $(LD) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
-
-clean:
- $(RM) a.out core $(OBJS) $(W32_FILES) $(W32_INIS) $(PROGRAM) junkbuster
-
-clobber: clean
- $(RM) $(PROGRAM) cscope.* logfile *.pdb *.lib *.exp `find . -name tags` `find . -name TAGS` config.status config.h.in config.log junkbuster.log privoxy.log config.cache *~ *.tar.gz configure
-
-tags: $(SRCS) $(HDRS)
- etags $(SRCS) $(HDRS)
-
-install: all
- #
- # FIXME: This is a dirty hack to have an install target
- # that works at least for some setups. This needs
- # to be fixed!
- #
- $(STRIP_PROG) $(PROGRAM)
- $(INSTALL) $(PROGRAM) $(SBIN_DEST)
- mkdir -p $(DEST)/user-manual
- mkdir -p $(DEST)/templates
- cp -r doc/webserver/user-manual $(DEST)
- cp -r templates $(DEST)
- $(INSTALL) config default.action default.filter trust $(DEST)
- # FIXME $(ECHO) privoxy.logrotate privoxy.monthly privoxy.weekly
- # FIXME: Need new manual! $(GZIP_PROG) -c privoxy.1 > $(MAN_DEST)/privoxy.1.gz
- $(INSTALL) privoxy.init /etc/init.d/privoxy
-
-
-#############################################################################
-
-## Local Variables:
-## tab-width: 3
-## end:
-
-# $Log: GNUmakefile.in,v $
-# Revision 1.36 2002/03/27 14:58:08 swa
-# can be used by mutilple targets
-#
-# Revision 1.35 2002/03/27 14:53:19 swa
-# added solaris-dist
-#
-# Revision 1.34 2002/03/27 10:30:11 swa
-# we want a html man file on the webserver
-#
-# Revision 1.33 2002/03/27 03:05:35 hal9
-# Added man2html target for docs (redhat-dok only for now)
-#
-# Revision 1.32 2002/03/26 22:29:54 swa
-# we have a new homepage!
-#
-# Revision 1.31 2002/03/26 14:00:18 swa
-# fixed make tarball, tarball-dist, tarball-clean
-#
-# Revision 1.30 2002/03/25 12:52:25 swa
-# new targets
-#
-# Revision 1.29 2002/03/24 17:03:55 jongfoster
-# Name change
-#
-# Revision 1.28 2002/03/24 16:19:48 swa
-# configure needs to be generated.
-#
-# Revision 1.27 2002/03/24 16:13:57 swa
-# generated files are a nono in cvs
-#
-# Revision 1.26 2002/03/24 15:36:02 swa
-# did not build.
-#
-# Revision 1.25 2002/03/24 14:31:08 swa
-# remove more crappy files. set RPM
-# release version correctly.
-#
-# Revision 1.24 2002/03/24 14:19:55 swa
-# set rpm package release in configure.in. nowhere else.
-#
-# Revision 1.23 2002/03/24 13:06:49 swa
-# suse-clean now runs fine
-#
-# Revision 1.22 2002/03/24 12:56:21 swa
-# name change related issues.
-#
-# Revision 1.21 2002/03/24 12:43:57 swa
-# name change
-#
-# Revision 1.20 2002/03/24 11:39:17 jongfoster
-# Renaming config files
-#
-# Revision 1.19 2002/03/22 20:53:03 morcego
-# - Ongoing process to change name to JunkbusterNG
-# - configure/configure.in: no change needed
-# - GNUmakefile.in:
-# - TAR_ARCH = /tmp/JunkbusterNG-$(RPM_VERSION).tar.gz
-# - PROGRAM = jbng@EXEEXT@
-# - rh-spec now references as junkbusterng-rh.spec
-# - redhat-upload: references changed to junkbusterng-* (package names)
-# - tarball-dist: references changed to JunkbusterNG-distribution-*
-# - tarball-src: now JunkbusterNG-*
-# - install: initscript now junkbusterng.init and junkbusterng (when
-# installed)
-# - junkbuster-rh.spec: renamed to junkbusterng-rh.spec
-# - junkbusterng.spec:
-# - References to the expression ijb where changed where possible
-# - New package name: junkbusterng (all in lower case, acording to
-# the LSB recomendation)
-# - Version changed to: 2.9.13
-# - Release: 1
-# - Added: junkbuster to obsoletes and conflicts (Not sure this is
-# right. If it obsoletes, why conflict ? Have to check it later)
-# - Summary changed: Stefan, please check and aprove it
-# - Changes description to use the new name
-# - Sed string was NOT changed. Have to wait to the manpage to
-# change first
-# - Keeping the user junkbuster for now. It will require some aditional
-# changes on the script (scheduled for the next specfile release)
-# - Added post entry to move the old logfile to the new log directory
-# - Removing "chkconfig --add" entry (not good to have it automaticaly
-# added to the startup list).
-# - Added preun section to stop the service with the old name, as well
-# as remove it from the startup list
-# - Removed the chkconfig --del entry from the conditional block on
-# the preun scriptlet (now handled on the %files section)
-# - junkbuster.init: renamed to junkbusterng.init
-# - junkbusterng.init:
-# - Changed JB_BIN to jbng
-# - Created JB_OBIN with the old value of JB_BIN (junkbuster), to
-# be used where necessary (config dir)
-#
-# Aditional notes:
-# - The config directory is /etc/junkbuster yet. Have to change it on the
-# specfile, after it is changes on the code
-# - The only files that got renamed on the cvs tree were the rh specfile and
-# the init file. Some file references got changes on the makefile and on the
-# rh-spec (as listed above)
-#
-# Revision 1.18 2002/03/21 23:00:00 swa
-# want to autogenerate stuff.
-#
-# Revision 1.17 2002/03/19 19:30:04 morcego
-# - Fixing stylesheet checking on configure. If it is found, no further checks
-# should be done
-#
-# - configure will now check for db2html or docbook2html (should work now
-# on SuSe without the docbktls package)
-#
-# Revision 1.16 2002/03/14 22:32:32 hal9
-# Bumped the RPM version.
-#
-# Revision 1.15 2002/03/08 20:00:28 swa
-# some leftovers.
-#
-# Revision 1.14 2002/03/07 18:25:56 swa
-# synced redhat and suse build process
-#
-# Revision 1.13 2002/03/07 17:17:56 oes
-# (Hopefully) fixed for older make versions
-#
-# Revision 1.12 2002/03/07 15:28:27 swa
-# more informative
-#
-# Revision 1.11 2002/03/06 14:33:18 sarantis
-# Use proper temp file, not "abc".
-#
-# Revision 1.10 2002/03/06 14:19:35 sarantis
-# Cleanup PID_FILE_PATH from redhat-dist target
-#
-# Revision 1.9 2002/03/05 17:31:11 morcego
-# Search for docbook.dsl. Should solve portability problems for SuSe.
-#
-# Revision 1.8 2002/03/05 14:07:42 morcego
-# configure now detects rpm topdir, and change GNUmakefile acordingly
-# (based on sugestion by Sarantis Paskalis)
-#
-# Revision 1.7 2002/03/05 13:43:28 morcego
-# Checking for text browser, so redhat-dok can work.
-#
-# Revision 1.6 2002/03/05 13:10:51 morcego
-# Changes to implement redhat-dok (Hal Burgiss)
-# Changes to make it work on other distros and out-of-the-shelf configurations
-#
-# Revision 1.5 2002/02/27 15:30:39 hal9
-# Reset $(RPM_PACKAGEV) to 1 (was 2)
-#
-# Revision 1.4 2002/01/17 21:44:04 jongfoster
-# Adding urlmatch.[ch]
-#
-# Revision 1.3 2002/01/04 15:26:08 oes
-# Added tarball-src target
-#
-# Revision 1.2 2001/12/30 14:07:31 steudten
-# - Add signal handling (unix)
-# - Add SIGHUP handler (unix)
-# - Add creation of pidfile (unix)
-# - Add action 'top' in rc file (RH)
-# - Add entry 'SIGNALS' to manpage
-# - Add exit message to logfile (unix)
-#
-# Revision 1.1 2001/12/01 11:22:57 jongfoster
-# Renaming Makefile.in to GNUmakefile.in so that non-GNU versions of
-# make break in a more obvious way.
-# Adding .PHONY section.
-#
-# Revision 1.40 2001/12/01 00:24:11 jongfoster
-# Renaming various config files
-# Fixing CR->CRLF under Win32 (I hope)
-#
-# Revision 1.39 2001/11/06 12:07:30 steudten
-# Add --clean for building rpm in target redhat-dist.
-#
-# Revision 1.38 2001/11/05 21:35:23 steudten
-# Complete rewrite for the 'redhat-dist' target.
-# Checks for writeable RPM build directories for calling user.
-# So you must not be root, just set the modes to 1777 to
-# build a RH package.
-# Fix the upload-target to be arch independant.
-# Add target for 'solaris-dist' - coming soon.
-#
-# Revision 1.37 2001/11/01 00:52:04 hal9
-# Redhat-upload stuff per Stefan.
-#
-# Revision 1.36 2001/10/31 19:26:13 swa
-# automate process of uploading new releases
-# to sf.
-#
-# Revision 1.35 2001/10/15 22:14:59 joergs
-# Removed -O2 and -Wall from AmigaOS-only CFLAGS since they are now in
-# the general CFLAGS already.
-#
-# Revision 1.34 2001/10/15 18:28:06 steudten
-# remove config.cache for target clobber.
-# Cleanup make dist for RH and S.u.S.E.
-#
-# Revision 1.33 2001/10/10 12:43:33 oes
-# Added ugly hack to make install target work at least for some setups.
-#
-# Revision 1.32 2001/10/09 22:38:19 jongfoster
-# Correcting actionsfile filename for Win32 INI build
-#
-# Revision 1.31 2001/09/23 10:13:48 swa
-# upload process established. run make webserver and
-# the documentation is moved to the webserver. documents
-# are now linked correctly.
-#
-# Revision 1.30 2001/09/19 17:55:49 oes
-# Fixed CFLAGS
-#
-# Revision 1.29 2001/09/16 17:34:27 jongfoster
-# Removing showargs.[ch], adding cgi(simple|edit).[ch]
-# Replacing $(OBJEXT) with @OBJEXT@ - this seems to be a common source
-# of build problems.
-#
-# Revision 1.28 2001/09/13 15:19:08 swa
-# we want text files as well.
-#
-# Revision 1.27 2001/09/13 13:11:37 steudten
-#
-# Replace DEBUG_CFLAGS with OTHER_CFLAGS
-#
-# Revision 1.26 2001/09/12 23:44:54 david__schmidt
-# Mac OSX (Darwin) support added.
-#
-# Revision 1.25 2001/09/12 22:55:45 joergs
-# AmigaOS support added.
-#
-# Revision 1.24 2001/09/12 17:28:59 david__schmidt
-#
-# OS/2 port: update autoconf'd support for the platform.
-#
-# Revision 1.23 2001/09/12 16:28:42 swa
-# added "make dok" section to generate html pages from
-# the sgml source documents. note that the we do not want
-# generated stuff in cvs.
-#
-# Revision 1.22 2001/09/10 16:31:23 swa
-# buildroot definition in the specfile fucks up the build
-# process under suse. hence I moved it to the "rpm -ta"
-# command
-#
-# Revision 1.21 2001/09/10 11:12:49 oes
-# Turning on -Wall
-#
-# Revision 1.20 2001/08/02 22:04:29 jongfoster
-# Removing some remaining references to obsolete w32rulesdlg.[ch]
-#
-# Revision 1.19 2001/07/30 22:14:03 jongfoster
-# Removing obsolete w32rulesdlg.c and w32rulesdlg.h
-#
-# Revision 1.18 2001/07/29 17:09:17 jongfoster
-# Major changes to build system in order to fix these bugs:
-# - pthreads under Linux was broken - changed -lpthread to -pthread
-# - Compiling in MinGW32 mode under CygWin now correctly detects
-# which shared libraries are available
-# - Solaris support (?) (Not tested under Solaris yet)
-#
-# Revision 1.17 2001/07/28 16:44:54 oes
-# Fixed sed LF->CRLF conversion and removed deprecated files
-#
-# Revision 1.16 2001/07/15 19:45:33 jongfoster
-# Added support for linking with POSIX threads library
-#
-# Revision 1.15 2001/07/13 13:48:07 oes
-# - Moved STATIC #define for pcre to (ac)config.h
-# - Made -Ipcre depandant on static pcre compilation to
-# avoid version conflicts
-# - Included compilation and depandancies for new deanimate.c
-# - Made changes to the pcre/pcreposix/pcrs build process
-# as required by the new library autodetection in
-# configure.in
-#
-# Revision 1.14 2001/07/01 16:27:44 oes
-# Fixed misplaced dependancy
-#
-# Revision 1.13 2001/06/29 13:18:36 oes
-# - added depandancy of filters.o on cgi.h
-#
-# Revision 1.12 2001/06/12 17:15:56 swa
-# fixes, because a clean build on rh6.1 was impossible.
-# GZIP confuses make, %configure confuses rpm, etc.
-#
-# Revision 1.11 2001/06/11 11:26:35 sarantis
-# RPM version should be the same as ijbswa version. The rpm release is
-# specified in the specfile.
-#
-# Revision 1.10 2001/06/07 17:27:45 swa
-# added suse build section
-#
-# Revision 1.9 2001/06/04 18:31:58 swa
-# files are now prefixed with either `confdir' or `logdir'.
-# `make redhat-dist' replaces both entries confdir and logdir
-# with redhat values
-#
-# Revision 1.8 2001/06/04 10:44:57 swa
-# `make redhatr-dist' now works. Except for the paths
-# in the config file.
-#
-# Revision 1.7 2001/06/03 17:09:09 swa
-# swa for oes: reversed my earlier change
-#
-# Revision 1.6 2001/06/03 17:07:27 swa
-# swa for oes
-#
-# Revision 1.5 2001/06/03 13:57:26 swa
-# compile cgi.c (for andreas' GUI)
-#
-# Revision 1.4 2001/05/31 21:18:45 jongfoster
-# Added files actions.[ch], actionlist.h, list.[ch] to Makefile
-#
-# Revision 1.3 2001/05/29 20:02:48 joergs
-# Changes for AmigaOS added.
-#
-# Revision 1.2 2001/05/17 22:23:23 oes
-# - Added auto-generation of CRLFs for Win32 config files
-# - Added comment-prefix to all Win32-only options in the config file
-# and provided auto stripping of this prefix for the Win32 platform by make
-#
-# Revision 1.1.1.1 2001/05/15 13:59:00 oes
-# Initial import of version 2.9.3 source tree
-#
-#
diff --git a/Junkbuster Status.URL b/Junkbuster Status.URL
new file mode 100644
index 00000000..6c95de6d
Binary files /dev/null and b/Junkbuster Status.URL differ
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 1bcc46f5..00000000
--- a/LICENSE
+++ /dev/null
@@ -1,342 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- , 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-
diff --git a/Makefile b/Makefile
deleted file mode 100644
index c195c8dc..00000000
--- a/Makefile
+++ /dev/null
@@ -1,63 +0,0 @@
-# $Id: Makefile,v 1.2 2002/03/24 13:25:42 swa Exp $
-#
-# Written by and Copyright (C) 2001 the SourceForge
-# Privoxy team. http://www.privoxy.org/
-#
-# Based on the Internet Junkbuster originally written
-# by and Copyright (C) 1997 Anonymous Coders and
-# Junkbusters Corporation. http://www.junkbusters.com
-#
-# 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.
-#
-# $Log: Makefile,v $
-# Revision 1.2 2002/03/24 13:25:42 swa
-# name change related issues
-#
-# Revision 1.1 2001/12/01 11:24:29 jongfoster
-# Will display a warning if non-GNU make is used
-#
-#
-
-#############################################################################
-
-error: GNUmakefile
- @echo
- @echo "ERROR!"
- @echo "To build this program, you must run ./configure and then run GNU make."
- @echo
- @echo "You are not using the GNU version of Make - maybe it's called gmake"
- @echo "or it's in a different directory?"
- @echo
-
-GNUmakefile:
- @echo
- @echo "ERROR!"
- @echo "To build this program, you must run ./configure and then run GNU make."
- @echo
- @echo "You haven't run ./configure yet."
- @echo
- @false
-
-.PHONY: error
-
-#############################################################################
-
-## Local Variables:
-## tab-width: 3
-## end:
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 00000000..6dd9a26e
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,363 @@
+# Note: Makefile is built automatically from Makefile.in
+#
+# $Id: Makefile.in,v 1.15 2001/07/13 13:48:07 oes Exp $
+#
+# Written by and Copyright (C) 2001 the SourceForge
+# IJBSWA team. http://ijbswa.sourceforge.net
+#
+# Based on the Internet Junkbuster originally written
+# by and Copyright (C) 1997 Anonymous Coders and
+# Junkbusters Corporation. http://www.junkbusters.com
+#
+# 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.
+#
+# $Log: Makefile.in,v $
+# Revision 1.15 2001/07/13 13:48:07 oes
+# - Moved STATIC #define for pcre to (ac)config.h
+# - Made -Ipcre depandant on static pcre compilation to
+# avoid version conflicts
+# - Included compilation and depandancies for new deanimate.c
+# - Made changes to the pcre/pcreposix/pcrs build process
+# as required by the new library autodetection in
+# configure.in
+#
+# Revision 1.14 2001/07/01 16:27:44 oes
+# Fixed misplaced dependancy
+#
+# Revision 1.13 2001/06/29 13:18:36 oes
+# - added depandancy of filters.o on cgi.h
+#
+# Revision 1.12 2001/06/12 17:15:56 swa
+# fixes, because a clean build on rh6.1 was impossible.
+# GZIP confuses make, %configure confuses rpm, etc.
+#
+# Revision 1.11 2001/06/11 11:26:35 sarantis
+# RPM version should be the same as ijbswa version. The rpm release is
+# specified in the specfile.
+#
+# Revision 1.10 2001/06/07 17:27:45 swa
+# added suse build section
+#
+# Revision 1.9 2001/06/04 18:31:58 swa
+# files are now prefixed with either `confdir' or `logdir'.
+# `make redhat-dist' replaces both entries confdir and logdir
+# with redhat values
+#
+# Revision 1.8 2001/06/04 10:44:57 swa
+# `make redhatr-dist' now works. Except for the paths
+# in the config file.
+#
+# Revision 1.7 2001/06/03 17:09:09 swa
+# swa for oes: reversed my earlier change
+#
+# Revision 1.6 2001/06/03 17:07:27 swa
+# swa for oes
+#
+# Revision 1.5 2001/06/03 13:57:26 swa
+# compile cgi.c (for andreas' GUI)
+#
+# Revision 1.4 2001/05/31 21:18:45 jongfoster
+# Added files actions.[ch], actionlist.h, list.[ch] to Makefile
+#
+# Revision 1.3 2001/05/29 20:02:48 joergs
+# Changes for AmigaOS added.
+#
+# Revision 1.2 2001/05/17 22:23:23 oes
+# - Added auto-generation of CRLFs for Win32 config files
+# - Added comment-prefix to all Win32-only options in the config file
+# and provided auto stripping of this prefix for the Win32 platform by make
+#
+# Revision 1.1.1.1 2001/05/15 13:59:00 oes
+# Initial import of version 2.9.3 source tree
+#
+#
+
+# define version (will be wired into the rpm.)
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MINOR = @VERSION_MINOR@
+VERSION_POINT = @VERSION_POINT@
+VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
+# will automatically be postfixed with -$(RPM_PACKAGEV) in the SPECfile
+RPM_VERSION = $(VERSION)
+RPM_PACKAGEV = 1
+
+# The version is currently specified in config.h, which is
+# written by "configure".
+#
+#VERSION_CFLAGS = -DVERSION_MAJOR=$(VERSION_MAJOR) \
+# -DVERSION_MINOR=$(VERSION_MINOR) \
+# -DVERSION_POINT=$(VERSION_POINT) \
+# -DVERSION="$(VERSION)"
+
+# Directories for "make install"
+DEST = /etc/junkbuster
+SBIN_DEST = @sbindir@
+MAN_DEST = @mandir@
+
+# The flag "-mno-win32" can be used by Cygwin to emulate a un?x type install.
+# The flag "-mwindows -mno-cygwin" will cause Cygwin to use MingW32 for Win32 install.
+CYGWIN_FLAGS = @CYGWIN_FLAGS@
+
+# Either/Or of these next two lines
+#DEBUG_CFLAGS = -g
+DEBUG_CFLAGS = -O3
+
+# Solaris needs a special define:
+# FIXME: This is always commented out
+SOLARIS_FLAGS = @SOLARIS_ONLY@-D__EXTENSIONS__=1
+
+# -DSTDC_HEADERS Now in config.h
+# Do we need -DHAVE_STRING ???
+CFLAGS = @CFLAGS@ @CPPFLAGS@ \
+ -D__MT__=1 -D__STDC__=1 $(SOLARIS_FLAGS) -DHAVE_STRING $(DEBUG_CFLAGS) \
+ $(CYGWIN_FLAGS) $(PCRE_WIN_FLAGS) @STATIC_PCRE_ONLY@ -Ipcre
+
+PROGRAM = junkbuster@EXEEXT@
+CC = gcc
+ECHO = echo
+GZIP_PROG = gzip
+INSTALL = cp -f
+LD = gcc
+OBJEXT = @OBJEXT@
+RM = rm -f
+STRIP_PROG = strip
+
+C_SRC = actions.c encode.c errlog.c filters.c gateway.c jbsockets.c \
+ jcc.c killpopup.c list.c loadcfg.c loaders.c miscutil.c \
+ parsers.c showargs.c ssplit.c cgi.c deanimate.c
+
+C_OBJS = $(C_SRC:.c=.$(OBJEXT))
+C_HDRS = $(C_SRC:.c=.h) project.h actionlist.h
+
+W32_SRC = @WIN_ONLY@w32log.c w32rulesdlg.c w32taskbar.c win32.c
+W32_FILES = @WIN_ONLY@w32.res
+W32_OBJS = @WIN_ONLY@$(W32_SRC:.c=.$(OBJEXT)) $(W32_FILES)
+W32_HDRS = @WIN_ONLY@w32log.h w32res.h w32rulesdlg.h w32taskbar.h
+W32_LIB = @WIN_ONLY@-lwsock32 -lcomctl32
+W32_INIS = @WIN_ONLY@junkbstr.txt saclfile.txt sblock.txt scookie.txt \
+ @WIN_ONLY@sforward.txt simage.txt spopup.txt strust.txt sregexp.txt
+
+PCRS_SRC = @STATIC_PCRS_ONLY@pcrs.c
+PCRS_OBJS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.$(OBJEXT))
+PCRS_HDRS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.h)
+
+PCRE_SRC = @STATIC_PCRE_ONLY@pcre/get.c pcre/maketables.c pcre/study.c pcre/pcre.c
+PCRE_OBJS = @STATIC_PCRE_ONLY@$(PCRE_SRC:.c=.$(OBJEXT))
+PCRE_HDRS = @STATIC_PCRE_ONLY@pcre/config.h pcre/chartables.c pcre/internal.h pcre/pcre.h
+
+# No REGEX (Either because dynamically linked pcreposix, or no regex at all):
+REGEX_SRC =
+# GNU REGEX:
+@GNU_REGEX_ONLY@REGEX_SRC = gnu_regex.c
+# PCRE REGEX:
+@PCRE_REGEX_ONLY@@STATIC_PCRE_ONLY@REGEX_SRC = pcre/pcreposix.c
+
+REGEX_OBJS = $(REGEX_SRC:.c=.$(OBJEXT))
+REGEX_HDRS = $(REGEX_SRC:.c=.h)
+
+# Dependencies introduced by #include "project.h".
+PROJECT_H_DEPS = project.h $(REGEX_HDRS) $(PCRS_HDRS) @STATIC_PCRE_ONLY@pcre/pcre.h
+
+# Only need this on Solaris
+# FIXME: This is always commented out
+SOCKET_LIB = @SOLARIS_ONLY@-lsocket -lnsl
+
+# PThreads library, if needed.
+PTHREAD_LIB = @PTHREAD_ONLY@@PTHREAD_LIB@
+
+LIBS = @LIBS@ $(W32_LIB) $(SOCKET_LIB) $(PTHREAD_LIB)
+
+SRCS = $(C_SRC) $(W32_SRC) $(PCRS_SRC) $(PCRE_SRC) $(REGEX_SRC)
+OBJS = $(C_OBJS) $(W32_OBJS) $(PCRS_OBJS) $(PCRE_OBJS) $(REGEX_OBJS)
+HDRS = $(C_HDRS) $(W32_HDRS) $(PCRS_HDRS) $(PCRE_OBJS) $(REGEX_HDRS)
+
+
+# -------------------------------------------------------------------------
+# Do not change anything below this line
+# And there should NOT be any targets above this line.
+# -------------------------------------------------------------------------
+LDFLAGS = $(DEBUG_CFLAGS) $(CYGWIN_FLAGS)
+
+all: $(PROGRAM)
+
+SUFFIX = .txt:o
+.SUFFIXES : .txt
+
+%.txt:
+ sed -e 's/$$/&
/' < $< > $@
+
+inifiles: $(W32_INIS)
+
+junkbstr.txt: config
+ sed -e 's!\(/etc/junkbuster\|.\)/blocklist!sblock.txt!' \
+ -e 's!\(/etc/junkbuster\|.\)/popup!spopup.txt!' \
+ -e 's!\(/etc/junkbuster\|.\)/cookiefile!scookie.txt!' \
+ -e 's!\(/etc/junkbuster\|.\)/forward!sforward.txt!' \
+ -e 's!\(/etc/junkbuster\|.\)/trust!strust.txt!' \
+ -e 's!\(/etc/junkbuster\|.\)/aclfile!sacl.txt!' \
+ -e 's!\(/var/log/junkbuster\|.\)/jarfile!jar.log!' \
+ -e 's!\(/var/log/junkbuster\|.\)/junkbuster\.log!junkbstr.log!' \
+ -e 's!\(/etc/junkbuster\|.\)/imagelist!simage.txt!' \
+ -e 's!\(/etc/junkbuster\|.\)/re_filterfile!sregexp.txt!' \
+ -e 's!$$!&
!' \
+ -e 's!#Win32-only: !!' \
+ < $< > $@
+
+saclfile.txt: aclfile
+sblock.txt: blocklist
+scookie.txt: cookiefile
+sforward.txt: forward
+simage.txt: imagelist
+spopup.txt: popup
+strust.txt: trust
+sregexp.txt: re_filterfile
+
+
+# -------------------------------------------------------------------------
+# redhat distribution
+# -------------------------------------------------------------------------
+redhat-dist:
+ @make clobber
+# verify that i'm root needs to be done
+ rm -f ../ijbswa.tar.gz
+# verify all version strings, FLAGS, etc. in the spec file
+ cat junkbuster-rh.spec | sed 's/^Version:.*/Version: $(RPM_VERSION)/g' | sed 's/^Release:.*/Release: $(RPM_PACKAGEV)/g' > /tmp/abc && cp -f /tmp/abc junkbuster-rh.spec
+ tar --exclude "CVS" --exclude "junkbuster-suse.spec" -cvzf ../ijbswa.tar.gz .
+# verify all files in their correct location needs to be done
+ cd .. && rpm -ta ijbswa.tar.gz
+
+# -------------------------------------------------------------------------
+# suse distribution
+# -------------------------------------------------------------------------
+suse-dist:
+ @make clobber
+# verify that i'm root needs to be done
+ rm -f ../ijbswa.tar.gz
+# verify all version strings, FLAGS, etc. in the spec file
+ cat junkbuster-suse.spec | sed 's/^Version:.*/Version: $(RPM_VERSION)/g' | sed 's/^Release:.*/Release: $(RPM_PACKAGEV)/g' > /tmp/abc && cp -f /tmp/abc junkbuster-suse.spec
+ tar --exclude "CVS" --exclude "junkbuster-rh.spec" -cvzf ../ijbswa.tar.gz .
+# verify all files in their correct location needs to be done
+ cd .. && rpm -ta ijbswa.tar.gz
+
+# -------------------------------------------------------------------------
+#
+# -------------------------------------------------------------------------
+win-dist:
+ $(ECHO) Not implemented.
+
+# -------------------------------------------------------------------------
+#
+# -------------------------------------------------------------------------
+tarball-dist:
+ @make clean
+ make $(PROGRAM)
+# remove all objects and create the tarball with the binary
+ cd .. && $(RM) ijb/a.out ijb/core ijb/*.$(OBJEXT) && tar --exclude "ijb/CVS" -cvzf ../ijb-distribution-$(VERSION).tar.gz ijb/
+ chmod a+r ../../ijb-distribution-$(VERSION).tar.gz
+ @$(ECHO) Tarball with binary created.
+
+# -------------------------------------------------------------------------
+#
+# -------------------------------------------------------------------------
+
+actions.@OBJEXT@: actions.c actions.h config.h $(PROJECT_H_DEPS) errlog.h jcc.h list.h loaders.h miscutil.h actionlist.h
+encode.@OBJEXT@: encode.c encode.h config.h
+errlog.@OBJEXT@: errlog.c errlog.h config.h $(PROJECT_H_DEPS) @WIN_ONLY@w32log.h
+filters.@OBJEXT@: filters.c filters.h config.h $(PROJECT_H_DEPS) errlog.h encode.h gateway.h jbsockets.h jcc.h loadcfg.h parsers.h showargs.h ssplit.h cgi.h deanimate.h @WIN_ONLY@win32.h
+gateway.@OBJEXT@: gateway.c gateway.h config.h $(PROJECT_H_DEPS) errlog.h jbsockets.h jcc.h loadcfg.h
+jbsockets.@OBJEXT@: jbsockets.c jbsockets.h config.h $(PROJECT_H_DEPS) filters.h
+jcc.@OBJEXT@: jcc.c jcc.h config.h $(PROJECT_H_DEPS) errlog.h filters.h gateway.h jbsockets.h killpopup.h loadcfg.h loaders.h miscutil.h parsers.h showargs.h @WIN_ONLY@w32log.h win32.h cgi.h
+killpopup.@OBJEXT@: killpopup.c killpopup.h config.h $(PROJECT_H_DEPS) jcc.h loadcfg.h
+list.@OBJEXT@: list.c list.h config.h $(PROJECT_H_DEPS) list.h miscutil.h
+loadcfg.@OBJEXT@: loadcfg.c loadcfg.h config.h $(PROJECT_H_DEPS) errlog.h filters.h gateway.h jbsockets.h jcc.h killpopup.h loaders.h miscutil.h parsers.h showargs.h @WIN_ONLY@w32log.h win32.h
+loaders.@OBJEXT@: loaders.c loaders.h config.h $(PROJECT_H_DEPS) errlog.h encode.h filters.h gateway.h jcc.h loadcfg.h miscutil.h parsers.h ssplit.h
+miscutil.@OBJEXT@: miscutil.c miscutil.h config.h
+parsers.@OBJEXT@: parsers.c parsers.h config.h $(PROJECT_H_DEPS) errlog.h encode.h filters.h jbsockets.h jcc.h loadcfg.h loaders.h miscutil.h showargs.h ssplit.h
+showargs.@OBJEXT@: showargs.c showargs.h config.h $(PROJECT_H_DEPS) errlog.h encode.h gateway.h jcc.h loadcfg.h miscutil.h parsers.h
+ssplit.@OBJEXT@: ssplit.c ssplit.h config.h miscutil.h
+cgi.@OBJEXT@: cgi.c cgi.h config.h $(PROJECT_H_DEPS) list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
+deanimate.@OBJEXT@: deanimate.c deanimate.h config.h $(PROJECT_H_DEPS)
+
+# GNU regex
+gnu_regex.@OBJEXT@: gnu_regex.c gnu_regex.h config.h
+
+# PCRS
+pcrs.@OBJEXT@: pcrs.c pcre/pcre.h pcrs.h
+
+# PCRE
+pcre/get.@OBJEXT@: pcre/get.c pcre/config.h pcre/internal.h pcre/pcre.h
+pcre/maketables.@OBJEXT@: pcre/maketables.c pcre/config.h pcre/internal.h pcre/pcre.h
+pcre/pcre.@OBJEXT@: pcre/pcre.c pcre/config.h pcre/internal.h pcre/pcre.h pcre/chartables.c
+pcre/pcreposix.@OBJEXT@: pcre/pcreposix.c pcre/config.h pcre/internal.h pcre/pcre.h pcre/pcreposix.h
+pcre/study.@OBJEXT@: pcre/study.c pcre/config.h pcre/internal.h pcre/pcre.h
+
+# An auxiliary program makes the PCRE default character table source
+
+pcre/chartables.c: pcre/dftables
+ pcre/dftables >pcre/chartables.c
+
+pcre/dftables: pcre/dftables.c pcre/maketables.c pcre/pcre.h pcre/internal.h pcre/config.h
+ $(CC) -o pcre/dftables $(CFLAGS) pcre/dftables.c
+
+# Win32
+w32log.@OBJEXT@: w32log.c errlog.h config.h jcc.h loadcfg.h miscutil.h pcre/pcre.h pcre/pcreposix.h pcrs.h project.h w32log.h w32rulesdlg.h w32taskbar.h win32.h
+w32rulesdlg.@OBJEXT@: w32rulesdlg.c config.h w32rulesdlg.h win32.h
+w32taskbar.@OBJEXT@: w32taskbar.c config.h w32log.h w32taskbar.h
+win32.@OBJEXT@: win32.c config.h jcc.h loadcfg.h pcre/pcre.h pcre/pcreposix.h pcrs.h project.h w32log.h win32.h
+
+w32.res: w32.rc w32res.h icons/denyrule.ico icons/ico00001.ico icons/ico00002.ico icons/ico00003.ico icons/ico00004.ico icons/ico00005.ico icons/ico00006.ico icons/ico00007.ico icons/ico00008.ico icons/icon1.ico icons/idle.ico icons/junkbust.ico config.h
+ windres -D__MINGW32__=0.2 -O coff -i $< -o $@
+
+## AmigaOS, GCC 2.95.1 (or lower, 2.95.3 does NOT work!)
+#ifeq ($(shell $(CC) $(CFLAGS) -dumpmachine), m68k-amigaos)
+#OBJS += amiga.o
+#CFLAGS += -D__AMIGAVERSION__=\"$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_POINT)\" -D__AMIGADATE__=\"`date +%d.%m.%Y`\" -W -Wall -m68020 -Os -noixemul -fbaserel -msmall-code
+#LDFLAGS += -m68020 -noixemul -fbaserel
+#LIBS = -lm /gg/lib/libb/libm020/libnix/swapstack.o
+#amiga.o: amiga.c amiga.h config.h
+#endif
+#
+
+$(PROGRAM): $(OBJS) $(W32_FILES)
+ $(LD) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
+
+clean:
+ $(RM) a.out core $(OBJS) $(W32_FILES) $(W32_INIS)
+
+clobber: clean
+ $(RM) $(PROGRAM) *.pdb *.lib *.exp TAGS junkbuster.log
+
+tags: $(SRCS) $(HDRS)
+ etags $(SRCS) $(HDRS)
+
+install: all
+ $(STRIP_PROG) $(PROGRAM)
+ $(INSTALL) $(PROGRAM) $(SBIN_DEST)
+ $(INSTALL) README README.TOO README.WIN README.re_filter README.cygwin $(DEST)
+ $(INSTALL) aclfile blocklist config cookiefile forward imagelist \
+ popup re_filterfile trust $(DEST)
+ # FIXME: On SuSE, these are not found. Where do they go?
+ $(ECHO) junkbuster.logrotate junkbuster.monthly junkbuster.weekly
+ $(GZIP_PROG) -c junkbuster.1 > $(MAN_DEST)/junkbuster.1.gz
+ $(INSTALL) junkbuster.init /sbin/init.d/junkbuster
+
+
+## Local Variables:
+## tab-width: 3
+## end:
diff --git a/README b/README
deleted file mode 100644
index 2c3fc2c4..00000000
--- a/README
+++ /dev/null
@@ -1,181 +0,0 @@
-/*********************************************************************
- *
- * File : $Source: /cvsroot/ijbswa/current/README,v $
- *
- * Purpose : README file to give a short intro.
- *
- * Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
- *
- * Based on the Internet Junkbuster originally written
- * by and Copyright (C) 1997 Anonymous Coders and
- * Junkbusters Corporation. http://www.junkbusters.com
- *
- * 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.
- *
- *********************************************************************/
-
-This README is included with the development version of Privoxy,
-which will eventually become Privoxy v3.0 (and soon we hope!). See
-http://www.privoxy.org/. The current code level is BETA, and seems
-stable to us :)
-
-Privoxy is a web proxy with advanced filtering capabilities for
-protecting privacy, filtering web page content, managing cookies,
-controlling access, and removing ads, banners, pop-ups and other
-obnoxious Internet junk. Privoxy has a very flexible configuration and
-can be customized to suit individual needs and tastes. Privoxy
-has application for both stand-alone systems and multi-user
-networks.
-
-Privoxy is based on the code of the Internet Junkbuster. Junkbuster
-was originally written by JunkBusters Corporation, and was released as
-free open-source software under the GNU GPL. Stefan Waldherr made many
-improvements, and started the SourceForge project to continue
-development. Several other developers are now contributing.
-
-
- IMPORTANT CHANGES
-------------------
-
-NEWS! As of 03/24/02, the name of this project has been changed
-from ijbswa/Junkbuster to Privoxy. This is reflected in many of the
-included files.
-
-WARNING! If upgrading from earlier versions of this project via
-RPM packages, the new package will delete any previously installed
-'Junkbuster' packages.
-
-IMPORTANT! READ! Configuration Change as of 3 Apr 2002: The default
-listening port is now 8118 due to conflicts with port 8000 assignment.
-You will need to change your browser if upgrading!!! And maybe
-firewall, etc.
-
-
- INSTALL
---------
-
-For tarball, first unpack:
-
- tar xzvf privoxy-2.9.13-beta-src.tar.gz
- cd privoxy-2.9.13-beta
-
- autoheader
- autoconf
- ./configure (--help to see options)
- gmake (the make from gnu)
- su
- make -n install (to see where all the files will go)
- make install (to really install)
-
-Redhat and SuSE src and binary RPMs can be built with 'make
-redhat-dist' or 'make suse-dist' (run ./configure first) from unpacked
-sources. BSD will (probably?) require gmake (from http://gnu.org). See
-the user-manual for OS/2 build instructions.
-
-Privoxy is also available via anonymous CVS:
-
- cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login
- cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current
-
-This will create a directory named 'current'. Then, 'cd current', and
-then build as above.
-
-
- RUN
-----
-
-privoxy [--help] [--version] [--no-daemon] [--pidfile PIDFILE]
- [--user USER] [config_file]
-
-Or for RedHat: /etc/rc.d/init.d/privoxy start
-Or for SuSE: /etc/rc.d/privoxy start
-
-See the man page or user-manual for a brief explanation of each.
-
-
- CONFIGURATION
---------------
-
-See: 'config', '*.action', and 'default.filter'. These are all well
-commented. Most of the magic is in '*.action', and there are several
-of these included with varying degrees of aggressiveness. On Unix-like
-systems, these files are installed in /etc/privoxy. On Windows, then wherever
-the executable itself is installed. There are many significant changes and
-advances since Junkbuster v2.0.x. The user-manual has a run down of
-configuration options, and examples: http://www.privoxy.org/user-manual/.
-
-Be sure to set your browser(s) for HTTP/HTTPS Proxy at :, or
-whatever you specify in the config file under 'listen-address'.
-DEFAULT is localhost:8118.
-
-The default.action file can be configured via the web interface accessed
-via http://p.p/, as well other options.
-
-
- DOCUMENTATION
---------------
-
-There is a growing amount of documentation in the 'doc' subdirectory,
-but it is not finished at this point. In particular, see the
-user-manual there, and developers should look at developer-manual.
-
-The most up to date source of information on the current development version,
-may still be either comments in the source code, or the included configuration
-files, which are all well commented. These are 'config', '*.action', and
-'default.filter' in the toplevel source directory.
-
-Some legacy Junkbuster documentation may also be included only to give an idea
-of what Privoxy can do under doc/obsolete/*. Much has changed since these docs
-were written, so beware.
-
-Included documentation may vary according to platform and packager.
-
-
- CONTACTING THE DEVELOPERS, BUG REPORTING AND FEATURE REQUESTS
---------------------------------------------------------------
-
-We value your feedback. However, to provide you with the best support,
-please note:
-
- * Use the support forum to get help:
- http://sourceforge.net/tracker/?group_id=11118&atid=211118
- * Submit bugs only thru our bug forum:
- http://sourceforge.net/tracker/?group_id=11118&atid=111118
- Make sure that the bug has not already been submitted. Please try
- to verify that it is a Privoxy bug, and not a browser or site
- bug first. If you are using your own custom configuration, please
- try the stock configs to see if the problem is a configuration
- related bug. And if not using the latest development snapshot,
- please try the latest one. Or even better, CVS sources.
- * Submit feature requests only thru our feature request forum:
- http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse
-
-For any other issues, feel free to use the mailing lists:
-http://sourceforge.net/mail/?group_id=11118
-
-Anyone interested in actively participating in development and related
-discussions can join the appropriate mailing list here:
-http://sourceforge.net/mail/?group_id=11118. Archives are available
-here too.
-
--------------------------------------------------------------------------
-ijbswa-developers@lists.sourceforge.net
-
-$Id: README,v 1.21 2002/03/26 22:29:54 swa Exp $
diff --git a/acconfig.h b/acconfig.h
index bf746a61..a61d3f62 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,5 +1,5 @@
-#ifndef CONFIG_H_INCLUDED
-#define CONFIG_H_INCLUDED
+#ifndef _CONFIG_H
+#define _CONFIG_H
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/acconfig.h,v $
@@ -11,7 +11,7 @@
* getting ludicrously long with feature defines.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -37,68 +37,6 @@
*
* Revisions :
* $Log: acconfig.h,v $
- * Revision 1.21 2002/03/24 14:31:08 swa
- * remove more crappy files. set RPM
- * release version correctly.
- *
- * Revision 1.20 2002/03/24 13:46:44 swa
- * name change related issue.
- *
- * Revision 1.19 2002/03/24 13:25:42 swa
- * name change related issues
- *
- * Revision 1.18 2002/03/08 16:40:28 oes
- * Added FEATURE_NO_GIFS
- *
- * Revision 1.17 2002/03/04 17:52:44 oes
- * Deleted PID_FILE_PATH
- *
- * Revision 1.16 2002/01/10 12:36:18 oes
- * Moved HAVE_*_R to acconfig.h, where they belong.
- *
- * Revision 1.15 2001/12/30 14:07:31 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.14 2001/10/23 21:24:09 jongfoster
- * Support for FEATURE_CGI_EDIT_ACTIONS
- *
- * Revision 1.13 2001/10/07 15:30:41 oes
- * Removed FEATURE_DENY_GZIP
- *
- * Revision 1.12 2001/09/13 19:56:37 jongfoster
- * Reverting to revision 1.10 - previous checking was majorly broken.
- *
- * Revision 1.10 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.9 2001/07/29 19:08:52 jongfoster
- * Changing _CONFIG_H to CONFIG_H_INCLUDED.
- * Also added protection against using a MinGW32 or CygWin version of
- * config.h from within MS Visual C++
- *
- * Revision 1.8 2001/07/29 17:09:17 jongfoster
- * Major changes to build system in order to fix these bugs:
- * - pthreads under Linux was broken - changed -lpthread to -pthread
- * - Compiling in MinGW32 mode under CygWin now correctly detects
- * which shared libraries are available
- * - Solaris support (?) (Not tested under Solaris yet)
- *
- * Revision 1.7 2001/07/25 22:53:59 jongfoster
- * Will #error if pthreads is enabled under BeOs
- *
- * Revision 1.6 2001/07/15 17:54:29 jongfoster
- * Renaming #define STATIC to STATIC_PCRE
- * Adding new #define FEATURE_PTHREAD that will be used to enable
- * POSIX threads support.
- *
* Revision 1.5 2001/07/13 13:48:37 oes
* - (Fix:) Copied CODE_STATUS #define from config.h.in
* - split REGEX #define into REGEX_GNU and REGEX_PCRE
@@ -204,18 +142,13 @@
*/
#undef VERSION_POINT
-/*
- * Version number - RPM-release
- */
-#undef VERSION_RPM_PACKAGE
-
/*
* Version number, as a string
*/
#undef VERSION
/*
- * Status of the code: "alpha", "beta" or "stable".
+ * Status of the code: alpha, beta or stable
*/
#undef CODE_STATUS
@@ -244,45 +177,57 @@
#undef STATIC_PCRS
/*
- * Allows the use of an ACL to control access to the proxy by IP address.
+ * Allow JunkBuster to be "disabled" so it is just a normal non-blocking
+ * non-anonymizing proxy. This is useful if you're trying to access a
+ * blocked or broken site - just change the setting in the config file
+ * and send a SIGHUP (UN*X), or use the handy "Disable" menu option (Windows
+ * GUI).
*/
-#undef FEATURE_ACL
+#undef TOGGLE
/*
- * Enables the web-based configuration (actionsfile) editor. If you
- * have a shared proxy, you might want to turn this off.
+ * If a stream is compressed via gzip (Netscape specific I think), then
+ * it cannot be modified with Perl regexps. This forces it to be
+ * uncompressed.
*/
-#undef FEATURE_CGI_EDIT_ACTIONS
+#undef DENY_GZIP
/*
- * Allows the use of jar files to capture cookies.
+ * Enables statistics function.
*/
-#undef FEATURE_COOKIE_JAR
+#undef STATISTICS
+
+/*
+ * Bypass filtering for 1 page only
+ */
+#undef FORCE_LOAD
/*
* Locally redirect remote script-redirect URLs
*/
-#undef FEATURE_FAST_REDIRECTS
+#undef FAST_REDIRECTS
/*
- * Bypass filtering for 1 page only
+ * Split the show-proxy-args page into a page for each config file.
*/
-#undef FEATURE_FORCE_LOAD
+#undef SPLIT_PROXY_ARGS
/*
- * Allow blocking using images as well as HTML.
- * If you do not define this then everything is blocked as HTML.
- *
- * Note that this is required if you want to use FEATURE_IMAGE_DETECT_MSIE.
+ * Kills JavaScript popups - window.open, onunload, etc.
+ */
+#undef KILLPOPUPS
+
+/*
+ * Support for webDAV - e.g. so Microsoft Outlook can access HotMail e-mail
*/
-#undef FEATURE_IMAGE_BLOCKING
+#undef WEBDAV
/*
* Detect image requests automatically for MSIE. Will fall back to
* other image-detection methods (i.e. "+image" permission) for other
* browsers.
*
- * You must also define FEATURE_IMAGE_BLOCKING to use this feature.
+ * You must also define IMAGE_BLOCKING to use this feature.
*
* It detects the following header pair as an image request:
*
@@ -307,90 +252,45 @@
* These limitations are due to IE making inconsistent choices
* about which "Accept:" header to send.
*/
-#undef FEATURE_IMAGE_DETECT_MSIE
-
-/*
- * Kills JavaScript popups - window.open, onunload, etc.
- */
-#undef FEATURE_KILL_POPUPS
-
-/*
- * Use PNG instead of GIF for built-in images
- */
-#undef FEATURE_NO_GIFS
-
-/*
- * Use POSIX threads instead of native threads.
- */
-#undef FEATURE_PTHREAD
+#undef DETECT_MSIE_IMAGES
/*
- * Enables statistics function.
+ * Allow blocking using images as well as HTML.
+ * If you do not define this then everything is blocked as HTML.
+ *
+ * Note that this is required if you want to use DETECT_MSIE_IMAGES.
*/
-#undef FEATURE_STATISTICS
+#undef IMAGE_BLOCKING
/*
- * Allow Privoxy to be "disabled" so it is just a normal non-blocking
- * non-anonymizing proxy. This is useful if you're trying to access a
- * blocked or broken site - just change the setting in the config file,
- * or use the handy "Disable" menu option in the Windows GUI.
+ * Allows the use of ACL files to control access to the proxy by IP address.
*/
-#undef FEATURE_TOGGLE
+#undef ACL_FILES
/*
* Allows the use of trust files.
*/
-#undef FEATURE_TRUST
+#undef TRUST_FILES
/*
- * Defined on Solaris only. Makes the system libraries thread safe.
+ * Allows the use of jar files to capture cookies.
*/
-#undef _REENTRANT
+#undef JAR_FILES
/*
- * Defined on Solaris only. Without this, many important functions are not
- * defined in the system headers.
+ * Define this to use the Windows GUI for editing the blocklist.
+ * FIXME: This feature is only partially implemented and does not work
+ * FIXME: This #define can never be set by ./configure.
*/
-#undef __EXTENSIONS__
+#undef WIN_GUI_EDIT
/*
- * Defined always.
- * FIXME: Don't know what it does or why we need it.
- * (presumably something to do with MultiThreading?)
- */
-#undef __MT__
-
-/* If the (nonstandard and thread-safe) function gethostbyname_r
- * is available, select which signature to use
- */
-#undef HAVE_GETHOSTBYNAME_R_6_ARGS
-#undef HAVE_GETHOSTBYNAME_R_5_ARGS
-#undef HAVE_GETHOSTBYNAME_R_3_ARGS
-
-/* If the (nonstandard and thread-safe) function gethostbyaddr_r
- * is available, select which signature to use
- */
-#undef HAVE_GETHOSTBYADDR_R_8_ARGS
-#undef HAVE_GETHOSTBYADDR_R_7_ARGS
-#undef HAVE_GETHOSTBYADDR_R_5_ARGS
-
-/* Define if you have gmtime_r and localtime_r with a signature
- * of (struct time *, struct tm *)
+ * Use POSIX threads instead of native threads.
*/
-#undef HAVE_GMTIME_R
-#undef HAVE_LOCALTIME_R
+#undef FEATURE_PTHREAD
@BOTTOM@
-/*
- * Defined always.
- * FIXME: Don't know what it does or why we need it.
- * (presumably something to do with ANSI Standard C?)
- */
-#ifndef __STDC__
-#define __STDC__ 1
-#endif /* ndef __STDC__ */
-
/*
* Need to set up this define only for the Pthreads library for
* Win32, available from http://sources.redhat.com/pthreads-win32/
@@ -399,23 +299,4 @@
#define __CLEANUP_C
#endif /* defined(FEATURE_PTHREAD) && defined(_WIN32) */
-/*
- * BEOS does not currently support POSIX threads.
- * This *should* be detected by ./configure, but let's be sure.
- */
-#if defined(FEATURE_PTHREAD) && defined(__BEOS__)
-#error BEOS does not support pthread - please run ./configure again with "--disable-pthread"
-
-#endif /* defined(FEATURE_PTHREAD) && defined(__BEOS__) */
-
-
-/*
- * It's too easy to accidentally use a Cygwin or MinGW32 version of config.h
- * under VC++, and it usually gives many wierd error messages. Let's make
- * the error messages understandable, by bailing out now.
- */
-#ifdef _MSC_VER
-#error For MS VC++, please use config.h.win or config.h.win32threads.win. You can usually do this by selecting the "Build", "Clean" menu option.
-#endif /* def _MSC_VER */
-
-#endif /* CONFIG_H_INCLUDED */
+#endif /* _CONFIG_H */
diff --git a/actionlist.h b/actionlist.h
index c2ae6b48..cc65b2aa 100644
--- a/actionlist.h
+++ b/actionlist.h
@@ -13,7 +13,7 @@
* DEFINE_ACTION_ALIAS
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -39,40 +39,6 @@
*
* Revisions :
* $Log: actionlist.h,v $
- * Revision 1.14 2002/03/24 16:32:08 jongfoster
- * Removing logo option
- *
- * Revision 1.13 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.12 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.11 2002/03/12 01:42:49 oes
- * Introduced modular filters
- *
- * Revision 1.10 2002/03/08 18:19:14 jongfoster
- * Adding +image-blocker{pattern} option to edit interface
- *
- * Revision 1.9 2001/11/22 21:58:41 jongfoster
- * Adding action +no-cookies-keep
- *
- * Revision 1.8 2001/10/10 16:42:52 oes
- * Fixed a bug, Added +limit-connect string action
- *
- * Revision 1.7 2001/10/07 15:33:59 oes
- * Introduced a +no-compression action
- * Introduced a +downgrade action
- *
- * Revision 1.6 2001/09/16 15:47:37 jongfoster
- * First version of CGI-based edit interface. This is very much a
- * work-in-progress, and you can't actually use it to edit anything
- * yet. You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
- * to have any effect.
- *
- * Revision 1.5 2001/07/18 12:27:03 oes
- * Changed deanimate-gifs to string action
- *
* Revision 1.4 2001/07/13 13:52:12 oes
* - Formatting
* - Introduced new action ACTION_DEANIMATE
@@ -84,58 +50,23 @@
*********************************************************************/
-#if !(defined(DEFINE_ACTION_BOOL) && defined(DEFINE_ACTION_MULTI) && defined(DEFINE_ACTION_STRING))
-#error Please define lots of macros before including "actionlist.h".
-#endif /* !defined(all the DEFINE_ACTION_xxx macros) */
-
-#ifndef DEFINE_CGI_PARAM_RADIO
-#define DEFINE_CGI_PARAM_RADIO(name, bit, index, value, is_default)
-#define DEFINE_CGI_PARAM_CUSTOM(name, bit, index, default_val)
-#define DEFINE_CGI_PARAM_NO_RADIO(name, bit, index, default_val)
-#endif /* ndef DEFINE_CGI_PARAM_RADIO */
-
-DEFINE_ACTION_MULTI ("add-header", ACTION_MULTI_ADD_HEADER)
-DEFINE_ACTION_BOOL ("block", ACTION_BLOCK)
-DEFINE_ACTION_STRING ("deanimate-gifs", ACTION_DEANIMATE, ACTION_STRING_DEANIMATE)
-DEFINE_CGI_PARAM_RADIO ("deanimate-gifs", ACTION_DEANIMATE, ACTION_STRING_DEANIMATE, "first", 0)
-DEFINE_CGI_PARAM_RADIO ("deanimate-gifs", ACTION_DEANIMATE, ACTION_STRING_DEANIMATE, "last", 1)
-DEFINE_ACTION_BOOL ("downgrade", ACTION_DOWNGRADE)
-DEFINE_ACTION_BOOL ("fast-redirects", ACTION_FAST_REDIRECTS)
-DEFINE_ACTION_MULTI ("filter", ACTION_MULTI_FILTER)
-DEFINE_ACTION_BOOL ("hide-forwarded", ACTION_HIDE_FORWARDED)
-DEFINE_ACTION_STRING ("hide-from", ACTION_HIDE_FROM, ACTION_STRING_FROM)
-DEFINE_CGI_PARAM_RADIO ("hide-from", ACTION_HIDE_FROM, ACTION_STRING_FROM, "block", 1)
-DEFINE_CGI_PARAM_CUSTOM ("hide-from", ACTION_HIDE_FROM, ACTION_STRING_FROM, "spam_me_senseless@sittingduck.xyz")
-DEFINE_ACTION_STRING ("hide-referer", ACTION_HIDE_REFERER, ACTION_STRING_REFERER)
-DEFINE_CGI_PARAM_RADIO ("hide-referer", ACTION_HIDE_REFERER, ACTION_STRING_REFERER, "forge", 1)
-DEFINE_CGI_PARAM_RADIO ("hide-referer", ACTION_HIDE_REFERER, ACTION_STRING_REFERER, "block", 0)
-DEFINE_CGI_PARAM_CUSTOM ("hide-referer", ACTION_HIDE_REFERER, ACTION_STRING_REFERER, "http://www.google.com/")
-DEFINE_ACTION_STRING ("hide-user-agent", ACTION_HIDE_USER_AGENT, ACTION_STRING_USER_AGENT)
-DEFINE_CGI_PARAM_NO_RADIO("hide-user-agent", ACTION_HIDE_USER_AGENT, ACTION_STRING_USER_AGENT, "Privoxy/3.0 (Anonymous)")
-DEFINE_ACTION_BOOL ("image", ACTION_IMAGE)
-DEFINE_ACTION_STRING ("image-blocker", ACTION_IMAGE_BLOCKER, ACTION_STRING_IMAGE_BLOCKER)
-DEFINE_CGI_PARAM_RADIO ("image-blocker", ACTION_IMAGE_BLOCKER, ACTION_STRING_IMAGE_BLOCKER, "pattern", 1)
-DEFINE_CGI_PARAM_RADIO ("image-blocker", ACTION_IMAGE_BLOCKER, ACTION_STRING_IMAGE_BLOCKER, "blank", 0)
-DEFINE_CGI_PARAM_CUSTOM ("image-blocker", ACTION_IMAGE_BLOCKER, ACTION_STRING_IMAGE_BLOCKER, CGI_PREFIX "show-banner?type=pattern")
-DEFINE_ACTION_STRING ("limit-connect", ACTION_LIMIT_CONNECT, ACTION_STRING_LIMIT_CONNECT)
-DEFINE_CGI_PARAM_NO_RADIO("limit-connect", ACTION_LIMIT_CONNECT, ACTION_STRING_LIMIT_CONNECT, "443")
-DEFINE_ACTION_BOOL ("no-compression", ACTION_NO_COMPRESSION)
-DEFINE_ACTION_BOOL ("no-cookies-keep", ACTION_NO_COOKIE_KEEP)
-DEFINE_ACTION_BOOL ("no-cookies-read", ACTION_NO_COOKIE_READ)
-DEFINE_ACTION_BOOL ("no-cookies-set", ACTION_NO_COOKIE_SET)
-DEFINE_ACTION_BOOL ("no-popups", ACTION_NO_POPUPS)
-DEFINE_ACTION_BOOL ("vanilla-wafer", ACTION_VANILLA_WAFER)
-DEFINE_ACTION_MULTI ("wafer", ACTION_MULTI_WAFER)
+DEFINE_ACTION_MULTI ("add-header", ACTION_MULTI_ADD_HEADER)
+DEFINE_ACTION_BOOL ("block", ACTION_BLOCK)
+DEFINE_ACTION_STRING("deanimate-gifs", ACTION_DEANIMATE, ACTION_STRING_DEANIMATE)
+DEFINE_ACTION_BOOL ("fast-redirects", ACTION_FAST_REDIRECTS)
+DEFINE_ACTION_BOOL ("filter", ACTION_FILTER)
+DEFINE_ACTION_BOOL ("hide-forwarded", ACTION_HIDE_FORWARDED)
+DEFINE_ACTION_STRING("hide-from", ACTION_HIDE_FROM, ACTION_STRING_FROM)
+DEFINE_ACTION_STRING("hide-referer", ACTION_HIDE_REFERER, ACTION_STRING_REFERER)
+DEFINE_ACTION_STRING("hide-user-agent", ACTION_HIDE_USER_AGENT, ACTION_STRING_USER_AGENT)
+DEFINE_ACTION_BOOL ("image", ACTION_IMAGE)
+DEFINE_ACTION_STRING("image-blocker", ACTION_IMAGE_BLOCKER, ACTION_STRING_IMAGE_BLOCKER)
+DEFINE_ACTION_BOOL ("no-cookies-read", ACTION_NO_COOKIE_READ)
+DEFINE_ACTION_BOOL ("no-cookies-set", ACTION_NO_COOKIE_SET)
+DEFINE_ACTION_BOOL ("no-popups", ACTION_NO_POPUPS)
+DEFINE_ACTION_BOOL ("vanilla-wafer", ACTION_VANILLA_WAFER)
+DEFINE_ACTION_MULTI ("wafer", ACTION_MULTI_WAFER)
#if DEFINE_ACTION_ALIAS
-DEFINE_ACTION_BOOL ("no-popup", ACTION_NO_POPUPS)
-DEFINE_ACTION_STRING ("hide-referrer", ACTION_HIDE_REFERER, ACTION_STRING_REFERER)
+DEFINE_ACTION_BOOL ("no-popup", ACTION_NO_POPUPS)
+DEFINE_ACTION_STRING("hide-referrer", ACTION_HIDE_REFERER, ACTION_STRING_REFERER)
#endif /* if DEFINE_ACTION_ALIAS */
-
-#undef DEFINE_ACTION_MULTI
-#undef DEFINE_ACTION_STRING
-#undef DEFINE_ACTION_BOOL
-#undef DEFINE_ACTION_ALIAS
-#undef DEFINE_CGI_PARAM_CUSTOM
-#undef DEFINE_CGI_PARAM_RADIO
-#undef DEFINE_CGI_PARAM_NO_RADIO
-
diff --git a/actions.c b/actions.c
index e0f3fcad..e4e5aaf2 100644
--- a/actions.c
+++ b/actions.c
@@ -1,4 +1,4 @@
-const char actions_rcs[] = "$Id: actions.c,v 1.25 2002/03/24 13:25:43 swa Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.7 2001/06/09 10:55:28 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.c,v $
@@ -7,13 +7,13 @@ const char actions_rcs[] = "$Id: actions.c,v 1.25 2002/03/24 13:25:43 swa Exp $"
* Functions declared include: FIXME
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
- * by and Copyright (C) 1997 Anonymous Coders and
+ * by and Copyright (C) 1997 Anonymous Coders and
* Junkbusters Corporation. http://www.junkbusters.com
*
- * This program is free software; you can redistribute it
+ * 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
@@ -33,88 +33,6 @@ const char actions_rcs[] = "$Id: actions.c,v 1.25 2002/03/24 13:25:43 swa Exp $"
*
* Revisions :
* $Log: actions.c,v $
- * Revision 1.25 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.24 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.23 2002/03/07 03:46:16 oes
- * Fixed compiler warnings
- *
- * Revision 1.22 2002/01/21 00:27:02 jongfoster
- * Allowing free_action(NULL).
- * Moving the functions that #include actionlist.h to the end of the file,
- * because the Visual C++ 97 debugger gets extremely confused if you try
- * to debug any code that comes after them in the file.
- *
- * Revision 1.21 2002/01/17 20:54:44 jongfoster
- * Renaming free_url to free_url_spec, since it frees a struct url_spec.
- *
- * Revision 1.20 2001/11/22 21:56:49 jongfoster
- * Making action_spec->flags into an unsigned long rather than just an
- * unsigned int.
- * Fixing a bug in the display of -add-header and -wafer
- *
- * Revision 1.19 2001/11/13 00:14:07 jongfoster
- * Fixing stupid bug now I've figured out what || means.
- * (It always returns 0 or 1, not one of it's paramaters.)
- *
- * Revision 1.18 2001/11/07 00:06:06 steudten
- * Add line number in error output for lineparsing for
- * actionsfile.
- *
- * Revision 1.17 2001/10/25 03:40:47 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.16 2001/10/23 21:30:30 jongfoster
- * Adding error-checking to selected functions.
- *
- * Revision 1.15 2001/10/14 21:58:22 jongfoster
- * Adding support for the CGI-based editor:
- * - Exported get_actions()
- * - Added new function free_alias_list()
- * - Added support for {{settings}} and {{description}} blocks
- * in the actions file. They are currently ignored.
- * - Added restriction to only one {{alias}} block which must appear
- * first in the file, to simplify the editor's rewriting rules.
- * - Note that load_actions_file() is no longer used by the CGI-based
- * editor, but some of the other routines in this file are.
- *
- * Revision 1.14 2001/09/22 16:36:59 jongfoster
- * Removing unused parameter fs from read_config_line()
- *
- * Revision 1.13 2001/09/16 15:47:37 jongfoster
- * First version of CGI-based edit interface. This is very much a
- * work-in-progress, and you can't actually use it to edit anything
- * yet. You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
- * to have any effect.
- *
- * Revision 1.12 2001/09/16 13:21:27 jongfoster
- * Changes to use new list functions.
- *
- * Revision 1.11 2001/09/14 00:17:32 jongfoster
- * Tidying up memory allocation. New function init_action().
- *
- * Revision 1.10 2001/09/10 10:14:34 oes
- * Removing unused variable
- *
- * Revision 1.9 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.8 2001/06/29 13:19:52 oes
- * Removed logentry from cancelled commit
- *
* Revision 1.7 2001/06/09 10:55:28 jongfoster
* Changing BUFSIZ ==> BUFFER_SIZE
*
@@ -146,8 +64,6 @@ const char actions_rcs[] = "$Id: actions.c,v 1.25 2002/03/24 13:25:43 swa Exp $"
#include
#include
-#include
-#include
#include "project.h"
#include "jcc.h"
@@ -156,14 +72,27 @@ const char actions_rcs[] = "$Id: actions.c,v 1.25 2002/03/24 13:25:43 swa Exp $"
#include "miscutil.h"
#include "errlog.h"
#include "loaders.h"
-#ifdef FEATURE_CGI_EDIT_ACTIONS
-#include "encode.h"
-#endif /* def FEATURE_CGI_EDIT_ACTIONS */
-#include "urlmatch.h"
const char actions_h_rcs[] = ACTIONS_H_VERSION;
+/* Turn off everything except forwarding */
+/* This structure is used to hold user-defined aliases */
+struct action_alias
+{
+ const char * name;
+ struct action_spec action[1];
+ struct action_alias * next;
+};
+
+
+/*
+ * Must declare this in this file for the above structure.
+ */
+static int get_actions (char *line,
+ struct action_alias * alias_list,
+ struct action_spec *cur_action);
+
/*
* We need the main list of options.
*
@@ -178,10 +107,10 @@ const char actions_h_rcs[] = ACTIONS_H_VERSION;
#define AV_ADD_STRING 1 /* +stropt{string} */
#define AV_REM_STRING 2 /* -stropt */
#define AV_ADD_MULTI 3 /* +multiopt{string} +multiopt{string2} */
-#define AV_REM_MULTI 4 /* -multiopt{string} -multiopt */
+#define AV_REM_MULTI 4 /* -multiopt{string} -multiopt{*} */
/*
- * We need a structure to hold the name, flag changes,
+ * We need a structure to hold the name, flag changes,
* type, and string index.
*/
struct action_name
@@ -237,14 +166,13 @@ static const struct action_name action_names[] =
* 1 : cur_action = Current actions, to modify.
* 2 : new_action = Action to add.
*
- * Returns : JB_ERR_OK or JB_ERR_MEMORY
+ * Returns : N/A
*
*********************************************************************/
-jb_err merge_actions (struct action_spec *dest,
- const struct action_spec *src)
+void merge_actions (struct action_spec *dest,
+ const struct action_spec *src)
{
int i;
- jb_err err;
dest->mask &= src->mask;
dest->add &= src->mask;
@@ -257,10 +185,6 @@ jb_err merge_actions (struct action_spec *dest,
{
freez(dest->string[i]);
dest->string[i] = strdup(str);
- if (NULL == dest->string[i])
- {
- return JB_ERR_MEMORY;
- }
}
}
@@ -269,10 +193,10 @@ jb_err merge_actions (struct action_spec *dest,
if (src->multi_remove_all[i])
{
/* Remove everything from dest */
- list_remove_all(dest->multi_remove[i]);
+ destroy_list(dest->multi_remove[i]);
+ destroy_list(dest->multi_add[i]);
dest->multi_remove_all[i] = 1;
-
- err = list_duplicate(dest->multi_add[i], src->multi_add[i]);
+ list_duplicate(dest->multi_add[i], src->multi_add[i]);
}
else if (dest->multi_remove_all[i])
{
@@ -281,23 +205,16 @@ jb_err merge_actions (struct action_spec *dest,
* about what we add.
*/
list_remove_list(dest->multi_add[i], src->multi_remove[i]);
- err = list_append_list_unique(dest->multi_add[i], src->multi_add[i]);
+ list_append_list_unique(dest->multi_add[i], src->multi_add[i]);
}
else
{
/* No "remove all"s to worry about. */
list_remove_list(dest->multi_add[i], src->multi_remove[i]);
- err = list_append_list_unique(dest->multi_remove[i], src->multi_remove[i]);
- if (!err) err = list_append_list_unique(dest->multi_add[i], src->multi_add[i]);
- }
-
- if (err)
- {
- return err;
+ list_append_list_unique(dest->multi_remove[i], src->multi_remove[i]);
+ list_append_list_unique(dest->multi_add[i], src->multi_add[i]);
}
}
-
- return JB_ERR_OK;
}
@@ -307,8 +224,6 @@ jb_err merge_actions (struct action_spec *dest,
*
* Description : Copy an action_specs.
* Similar to "cur_action = new_action".
- * Note that dest better not contain valid data
- * - it's overwritten, not freed.
*
* Parameters :
* 1 : dest = Destination of copy.
@@ -317,13 +232,10 @@ jb_err merge_actions (struct action_spec *dest,
* Returns : N/A
*
*********************************************************************/
-jb_err copy_action (struct action_spec *dest,
- const struct action_spec *src)
+void copy_action (struct action_spec *dest,
+ const struct action_spec *src)
{
int i;
- jb_err err = JB_ERR_OK;
-
- memset(dest, '\0', sizeof(*dest));
dest->mask = src->mask;
dest->add = src->add;
@@ -331,32 +243,15 @@ jb_err copy_action (struct action_spec *dest,
for (i = 0; i < ACTION_STRING_COUNT; i++)
{
char * str = src->string[i];
- if (str)
- {
- str = strdup(str);
- if (!str)
- {
- return JB_ERR_MEMORY;
- }
- dest->string[i] = str;
- }
+ dest->string[i] = (str ? strdup(str) : NULL);
}
for (i = 0; i < ACTION_MULTI_COUNT; i++)
{
dest->multi_remove_all[i] = src->multi_remove_all[i];
- err = list_duplicate(dest->multi_remove[i], src->multi_remove[i]);
- if (err)
- {
- return err;
- }
- err = list_duplicate(dest->multi_add[i], src->multi_add[i]);
- if (err)
- {
- return err;
- }
+ list_duplicate(dest->multi_remove[i], src->multi_remove[i]);
+ list_duplicate(dest->multi_add[i], src->multi_add[i]);
}
- return err;
}
@@ -364,9 +259,7 @@ jb_err copy_action (struct action_spec *dest,
*
* Function : free_action
*
- * Description : Destroy an action_spec. Frees memory used by it,
- * except for the memory used by the struct action_spec
- * itself.
+ * Description : Free an action_specs.
*
* Parameters :
* 1 : src = Source to free.
@@ -378,11 +271,6 @@ void free_action (struct action_spec *src)
{
int i;
- if (src == NULL)
- {
- return;
- }
-
for (i = 0; i < ACTION_STRING_COUNT; i++)
{
freez(src->string[i]);
@@ -418,14 +306,14 @@ void free_action (struct action_spec *src)
* we found an action.
* 2 : name = [out] Start of action name, null
* terminated. NULL on EOL
- * 3 : value = [out] Start of action value, null
+ * 3 : value = [out] Start of action value, null
* terminated. NULL if none or EOL.
*
- * Returns : JB_ERR_OK => Ok
- * JB_ERR_PARSE => Mismatched {} (line was trashed anyway)
+ * Returns : 0 => Ok
+ * nonzero => Mismatched {} (line was trashed anyway)
*
*********************************************************************/
-jb_err get_action_token(char **line, char **name, char **value)
+int get_action_token(char **line, char **name, char **value)
{
char * str = *line;
char ch;
@@ -449,19 +337,19 @@ jb_err get_action_token(char **line, char **name, char **value)
if (*str == '{')
{
/* null name, just value is prohibited */
- return JB_ERR_PARSE;
+ return 1;
}
*name = str;
/* parse option */
- while (((ch = *str) != '\0') &&
+ while (((ch = *str) != '\0') &&
(ch != ' ') && (ch != '\t') && (ch != '{'))
{
if (ch == '}')
{
- /* error, '}' without '{' */
- return JB_ERR_PARSE;
+ /* error */
+ return 1;
}
str++;
}
@@ -480,7 +368,7 @@ jb_err get_action_token(char **line, char **name, char **value)
/* More to parse next time. */
*line = str + 1;
}
- return JB_ERR_OK;
+ return 0;
}
str++;
@@ -491,7 +379,7 @@ jb_err get_action_token(char **line, char **name, char **value)
{
/* error */
*value = NULL;
- return JB_ERR_PARSE;
+ return 1;
}
/* got value */
@@ -500,7 +388,7 @@ jb_err get_action_token(char **line, char **name, char **value)
chomp(*value);
- return JB_ERR_OK;
+ return 0;
}
@@ -517,17 +405,15 @@ jb_err get_action_token(char **line, char **name, char **value)
* 3 : cur_action = Where to store the action. Caller
* allocates memory.
*
- * Returns : JB_ERR_OK => Ok
- * JB_ERR_PARSE => Parse error (line was trashed anyway)
- * nonzero => Out of memory (line was trashed anyway)
+ * Returns : 0 => Ok
+ * nonzero => Error (line was trashed anyway)
*
*********************************************************************/
-jb_err get_actions(char *line,
- struct action_alias * alias_list,
- struct action_spec *cur_action)
+static int get_actions(char *line,
+ struct action_alias * alias_list,
+ struct action_spec *cur_action)
{
- jb_err err;
- init_action(cur_action);
+ memset(cur_action, '\0', sizeof(*cur_action));
cur_action->mask = ACTION_MASK_ALL;
while (line)
@@ -535,16 +421,15 @@ jb_err get_actions(char *line,
char * option = NULL;
char * value = NULL;
- err = get_action_token(&line, &option, &value);
- if (err)
+ if (get_action_token(&line, &option, &value))
{
- return err;
+ return 1;
}
if (option)
{
/* handle option in 'option' */
-
+
/* Check for standard action name */
const struct action_name * action = action_names;
@@ -570,15 +455,11 @@ jb_err get_actions(char *line,
if ((value == NULL) || (*value == '\0'))
{
- return JB_ERR_PARSE;
+ return 1;
}
/* FIXME: should validate option string here */
freez (cur_action->string[action->index]);
cur_action->string[action->index] = strdup(value);
- if (NULL == cur_action->string[action->index])
- {
- return JB_ERR_MEMORY;
- }
break;
}
case AV_REM_STRING:
@@ -592,28 +473,24 @@ jb_err get_actions(char *line,
{
/* append multi string. */
- struct list * remove_p = cur_action->multi_remove[action->index];
- struct list * add_p = cur_action->multi_add[action->index];
+ struct list * remove = cur_action->multi_remove[action->index];
+ struct list * add = cur_action->multi_add[action->index];
if ((value == NULL) || (*value == '\0'))
{
- return JB_ERR_PARSE;
+ return 1;
}
- list_remove_item(remove_p, value);
- err = enlist_unique(add_p, value, 0);
- if (err)
- {
- return err;
- }
+ list_remove_item(remove, value);
+ enlist_unique(add, value, 0);
break;
}
case AV_REM_MULTI:
{
/* remove multi string. */
- struct list * remove_p = cur_action->multi_remove[action->index];
- struct list * add_p = cur_action->multi_add[action->index];
+ struct list * remove = cur_action->multi_remove[action->index];
+ struct list * add = cur_action->multi_add[action->index];
if ( (value == NULL) || (*value == '\0')
|| ((*value == '*') && (value[1] == '\0')) )
@@ -623,8 +500,8 @@ jb_err get_actions(char *line,
*
* Remove *ALL*.
*/
- list_remove_all(remove_p);
- list_remove_all(add_p);
+ destroy_list(remove);
+ destroy_list(add);
cur_action->multi_remove_all[action->index] = 1;
}
else
@@ -634,27 +511,22 @@ jb_err get_actions(char *line,
if ( !cur_action->multi_remove_all[action->index] )
{
/* there isn't a catch-all in the remove list already */
- err = enlist_unique(remove_p, value, 0);
- if (err)
- {
- return err;
- }
+ enlist_unique(remove, value, 0);
}
- list_remove_item(add_p, value);
+ list_remove_item(add, value);
}
break;
}
default:
/* Shouldn't get here unless there's memory corruption. */
- assert(0);
- return JB_ERR_PARSE;
+ return 1;
}
}
else
{
/* try user aliases. */
const struct action_alias * alias = alias_list;
-
+
while ( (alias != NULL) && (0 != strcmpic(alias->name, option)) )
{
alias = alias->next;
@@ -667,51 +539,187 @@ jb_err get_actions(char *line,
else
{
/* Bad action name */
- return JB_ERR_PARSE;
+ return 1;
}
}
}
}
- return JB_ERR_OK;
+ return 0;
}
/*********************************************************************
*
- * Function : init_current_action
+ * Function : actions_to_text
*
- * Description : Zero out an action.
+ * Description : Converts a actionsfile entry from numeric form
+ * ("mask" and "add") to text.
*
* Parameters :
- * 1 : dest = An uninitialized current_action_spec.
+ * 1 : mask = As from struct url_actions
+ * 2 : add = As from struct url_actions
*
- * Returns : N/A
+ * Returns : A string. Caller must free it.
*
*********************************************************************/
-void init_current_action (struct current_action_spec *dest)
+char * actions_to_text(struct action_spec *action)
{
- memset(dest, '\0', sizeof(*dest));
+ unsigned mask = action->mask;
+ unsigned add = action->add;
+ char * result = strdup("");
+ struct list * lst;
- dest->flags = ACTION_MOST_COMPATIBLE;
+ /* sanity - prevents "-feature +feature" */
+ mask |= add;
+
+
+#define DEFINE_ACTION_BOOL(__name, __bit) \
+ if (!(mask & __bit)) \
+ { \
+ result = strsav(result, " -" __name); \
+ } \
+ else if (add & __bit) \
+ { \
+ result = strsav(result, " +" __name); \
+ }
+
+#define DEFINE_ACTION_STRING(__name, __bit, __index) \
+ if (!(mask & __bit)) \
+ { \
+ result = strsav(result, " -" __name); \
+ } \
+ else if (add & __bit) \
+ { \
+ result = strsav(result, " +" __name "{"); \
+ result = strsav(result, action->string[__index]); \
+ result = strsav(result, "}"); \
+ }
+
+#define DEFINE_ACTION_MULTI(__name, __index) \
+ if (action->multi_remove_all[__index]) \
+ { \
+ result = strsav(result, " -" __name "{*}"); \
+ } \
+ else \
+ { \
+ lst = action->multi_remove[__index]->next; \
+ while (lst) \
+ { \
+ result = strsav(result, " -" __name "{"); \
+ result = strsav(result, lst->str); \
+ result = strsav(result, "}"); \
+ lst = lst->next; \
+ } \
+ } \
+ lst = action->multi_add[__index]->next; \
+ while (lst) \
+ { \
+ result = strsav(result, " +" __name "{"); \
+ result = strsav(result, lst->str); \
+ result = strsav(result, "}"); \
+ lst = lst->next; \
+ }
+
+#define DEFINE_ACTION_ALIAS 0 /* No aliases for output */
+
+#include "actionlist.h"
+
+#undef DEFINE_ACTION_MULTI
+#undef DEFINE_ACTION_STRING
+#undef DEFINE_ACTION_BOOL
+#undef DEFINE_ACTION_ALIAS
+
+ return result;
}
/*********************************************************************
*
- * Function : init_action
+ * Function : current_actions_to_text
+ *
+ * Description : Converts a actionsfile entry to text.
+ *
+ * Parameters :
+ * 1 : action = Action
+ *
+ * Returns : A string. Caller must free it.
+ *
+ *********************************************************************/
+char * current_action_to_text(struct current_action_spec *action)
+{
+ unsigned flags = action->flags;
+ char * result = strdup("");
+ struct list * lst;
+
+#define DEFINE_ACTION_BOOL(__name, __bit) \
+ if (flags & __bit) \
+ { \
+ result = strsav(result, " +" __name); \
+ } \
+ else \
+ { \
+ result = strsav(result, " -" __name); \
+ }
+
+#define DEFINE_ACTION_STRING(__name, __bit, __index) \
+ if (flags & __bit) \
+ { \
+ result = strsav(result, " +" __name "{"); \
+ result = strsav(result, action->string[__index]); \
+ result = strsav(result, "}"); \
+ } \
+ else \
+ { \
+ result = strsav(result, " -" __name); \
+ }
+
+#define DEFINE_ACTION_MULTI(__name, __index) \
+ lst = action->multi[__index]->next; \
+ if (lst == NULL) \
+ { \
+ result = strsav(result, " -" __name); \
+ } \
+ else \
+ { \
+ while (lst) \
+ { \
+ result = strsav(result, " +" __name "{"); \
+ result = strsav(result, lst->str); \
+ result = strsav(result, "}"); \
+ lst = lst->next; \
+ } \
+ }
+
+#define DEFINE_ACTION_ALIAS 0 /* No aliases for output */
+
+#include "actionlist.h"
+
+#undef DEFINE_ACTION_MULTI
+#undef DEFINE_ACTION_STRING
+#undef DEFINE_ACTION_BOOL
+#undef DEFINE_ACTION_ALIAS
+
+ return result;
+}
+
+
+/*********************************************************************
+ *
+ * Function : init_current_action
*
* Description : Zero out an action.
*
* Parameters :
- * 1 : dest = An uninitialized action_spec.
+ * 1 : dest = An uninitialized current_action_spec.
*
* Returns : N/A
*
*********************************************************************/
-void init_action (struct action_spec *dest)
+void init_current_action (struct current_action_spec *dest)
{
memset(dest, '\0', sizeof(*dest));
+ dest->flags = ACTION_MOST_COMPATIBLE;
}
@@ -725,7 +733,7 @@ void init_action (struct action_spec *dest)
* is that this one doesn't allocate memory for
* strings (so "src" better be in memory for at least
* as long as "dest" is, and you'd better free
- * "dest" using "free_current_action").
+ * "dest" using "current_free_action").
* Also, there is no mask or remove lists in dest.
* (If we're applying it to a URL, we don't need them)
*
@@ -733,15 +741,13 @@ void init_action (struct action_spec *dest)
* 1 : dest = Current actions, to modify.
* 2 : src = Action to add.
*
- * Returns 0 : no error
- * !=0 : error, probably JB_ERR_MEMORY.
+ * Returns : N/A
*
*********************************************************************/
-jb_err merge_current_action (struct current_action_spec *dest,
- const struct action_spec *src)
+void merge_current_action (struct current_action_spec *dest,
+ const struct action_spec *src)
{
int i;
- jb_err err = JB_ERR_OK;
dest->flags &= src->mask;
dest->flags |= src->add;
@@ -751,13 +757,8 @@ jb_err merge_current_action (struct current_action_spec *dest,
char * str = src->string[i];
if (str)
{
- str = strdup(str);
- if (!str)
- {
- return JB_ERR_MEMORY;
- }
freez(dest->string[i]);
- dest->string[i] = str;
+ dest->string[i] = strdup(str);
}
}
@@ -765,24 +766,16 @@ jb_err merge_current_action (struct current_action_spec *dest,
{
if (src->multi_remove_all[i])
{
- /* Remove everything from dest, then add src->multi_add */
- err = list_duplicate(dest->multi[i], src->multi_add[i]);
- if (err)
- {
- return err;
- }
+ /* Remove everything from dest */
+ destroy_list(dest->multi[i]);
+ list_duplicate(dest->multi[i], src->multi_add[i]);
}
else
{
list_remove_list(dest->multi[i], src->multi_remove[i]);
- err = list_append_list_unique(dest->multi[i], src->multi_add[i]);
- if (err)
- {
- return err;
- }
+ list_append_list_unique(dest->multi[i], src->multi_add[i]);
}
}
- return err;
}
@@ -790,8 +783,7 @@ jb_err merge_current_action (struct current_action_spec *dest,
*
* Function : free_current_action
*
- * Description : Free memory used by a current_action_spec.
- * Does not free the current_action_spec itself.
+ * Description : Free a current_action_spec.
*
* Parameters :
* 1 : src = Source to free.
@@ -817,33 +809,6 @@ void free_current_action (struct current_action_spec *src)
}
-static struct file_list *current_actions_file = NULL;
-
-
-#ifdef FEATURE_GRACEFUL_TERMINATION
-/*********************************************************************
- *
- * Function : unload_current_actions_file
- *
- * Description : Unloads current actions file - reset to state at
- * beginning of program.
- *
- * Parameters : None
- *
- * Returns : N/A
- *
- *********************************************************************/
-void unload_current_actions_file(void)
-{
- if (current_actions_file)
- {
- current_actions_file->unloader = unload_actions_file;
- current_actions_file = NULL;
- }
-}
-#endif /* FEATURE_GRACEFUL_TERMINATION */
-
-
/*********************************************************************
*
* Function : unload_actions_file
@@ -864,8 +829,7 @@ void unload_actions_file(void *file_data)
while (cur != NULL)
{
next = cur->next;
- free_url_spec(cur->url);
- free_action(cur->action);
+ free_url(cur->url);
freez(cur);
cur = next;
}
@@ -873,32 +837,6 @@ void unload_actions_file(void *file_data)
}
-/*********************************************************************
- *
- * Function : free_alias_list
- *
- * Description : Free memory used by a list of aliases.
- *
- * Parameters :
- * 1 : alias_list = Linked list to free.
- *
- * Returns : N/A
- *
- *********************************************************************/
-void free_alias_list(struct action_alias *alias_list)
-{
- while (alias_list != NULL)
- {
- struct action_alias * next = alias_list->next;
- alias_list->next = NULL;
- freez(alias_list->name);
- free_action(alias_list->action);
- free(alias_list);
- alias_list = next;
- }
-}
-
-
/*********************************************************************
*
* Function : load_actions_file
@@ -914,29 +852,22 @@ void free_alias_list(struct action_alias *alias_list)
*********************************************************************/
int load_actions_file(struct client_state *csp)
{
-
- /*
- * Parser mode.
- * Note: Keep these in the order they occur in the file, they are
- * sometimes tested with <=
- */
-#define MODE_START_OF_FILE 1
-#define MODE_SETTINGS 2
-#define MODE_DESCRIPTION 3
-#define MODE_ALIAS 4
-#define MODE_ACTIONS 5
-
- int mode = MODE_START_OF_FILE;
+ static struct file_list *current_actions_file = NULL;
FILE *fp;
+
struct url_actions *last_perm;
struct url_actions *perm;
char buf[BUFFER_SIZE];
struct file_list *fs;
- struct action_spec * cur_action = NULL;
- int cur_action_used = 0;
+#define MODE_START_OF_FILE 1
+#define MODE_ACTIONS 2
+#define MODE_ALIAS 3
+ int mode = MODE_START_OF_FILE;
+ struct action_spec cur_action[1];
struct action_alias * alias_list = NULL;
- unsigned long linenum = 0;
+
+ memset(cur_action, '\0', sizeof(*cur_action));
if (!check_file_changed(current_actions_file, csp->config->actions_file, &fs))
{
@@ -969,7 +900,7 @@ int load_actions_file(struct client_state *csp)
return 1; /* never get here */
}
- while (read_config_line(buf, sizeof(buf), fp, &linenum) != NULL)
+ while (read_config_line(buf, sizeof(buf), fp, fs) != NULL)
{
if (*buf == '{')
{
@@ -984,9 +915,9 @@ int load_actions_file(struct client_state *csp)
{
/* too short */
fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid line (%lu): %s",
- csp->config->actions_file, linenum, buf);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': invalid line: %s",
+ csp->config->actions_file, buf);
return 1; /* never get here */
}
@@ -998,87 +929,25 @@ int load_actions_file(struct client_state *csp)
{
/* too short */
fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid line (%lu): {{ }}",
- csp->config->actions_file, linenum);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': invalid line: {{ }}",
+ csp->config->actions_file);
return 1; /* never get here */
}
- /*
- * An actionsfile can optionally contain the following blocks.
- * They *MUST* be in this order, to simplify processing:
- *
- * {{settings}}
- * name=value...
- *
- * {{description}}
- * ...free text, format TBD, but no line may start with a '{'...
- *
- * {{alias}}
- * name=actions...
- *
- * The actual actions must be *after* these special blocks.
- * None of these special blocks may be repeated.
- *
- */
- if (0 == strcmpic(start, "settings"))
- {
- /* it's a {{settings}} block */
- if (mode >= MODE_SETTINGS)
- {
- /* {{settings}} must be first thing in file and must only
- * appear once.
- */
- fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': line %lu: {{settings}} must only appear once, and it must be before anything else.",
- csp->config->actions_file, linenum);
- }
- mode = MODE_SETTINGS;
- }
- else if (0 == strcmpic(start, "description"))
- {
- /* it's a {{description}} block */
- if (mode >= MODE_DESCRIPTION)
- {
- /* {{description}} is a singleton and only {{settings}} may proceed it
- */
- fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': line %lu: {{description}} must only appear once, and only a {{settings}} block may be above it.",
- csp->config->actions_file, linenum);
- }
- mode = MODE_DESCRIPTION;
- }
- else if (0 == strcmpic(start, "alias"))
+ if (0 == strcmpic(start, "alias"))
{
/* it's an {{alias}} block */
- if (mode >= MODE_ALIAS)
- {
- /* {{alias}} must be first thing in file, possibly after
- * {{settings}} and {{description}}
- *
- * {{alias}} must only appear once.
- *
- * Note that these are new restrictions introduced in
- * v2.9.10 in order to make actionsfile editing simpler.
- * (Otherwise, reordering actionsfile entries without
- * completely rewriting the file becomes non-trivial)
- */
- fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': line %lu: {{alias}} must only appear once, and it must be before all actions.",
- csp->config->actions_file, linenum);
- }
+
mode = MODE_ALIAS;
}
else
{
/* invalid {{something}} block */
fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid line (%lu): {{%s}}",
- csp->config->actions_file, linenum, start);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': invalid line: {{%s}}",
+ csp->config->actions_file, start);
return 1; /* never get here */
}
}
@@ -1093,26 +962,7 @@ int load_actions_file(struct client_state *csp)
mode = MODE_ACTIONS;
/* free old action */
- if (cur_action)
- {
- if (!cur_action_used)
- {
- free_action(cur_action);
- free(cur_action);
- }
- cur_action = NULL;
- }
- cur_action_used = 0;
- cur_action = (struct action_spec *)zalloc(sizeof(*cur_action));
- if (cur_action == NULL)
- {
- fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': out of memory",
- csp->config->actions_file);
- return 1; /* never get here */
- }
- init_action(cur_action);
+ free_action(cur_action);
/* trim { */
strcpy(actions_buf, buf + 1);
@@ -1121,11 +971,11 @@ int load_actions_file(struct client_state *csp)
end = actions_buf + strlen(actions_buf) - 1;
if (*end != '}')
{
- /* No closing } */
+ /* too short */
fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid line (%lu): %s",
- csp->config->actions_file, linenum, buf);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': invalid line: %s",
+ csp->config->actions_file, buf);
return 1; /* never get here */
}
*end = '\0';
@@ -1133,48 +983,42 @@ int load_actions_file(struct client_state *csp)
/* trim any whitespace immediately inside {} */
chomp(actions_buf);
+ if (*actions_buf == '\0')
+ {
+ /* too short */
+ fclose(fp);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': invalid line: %s",
+ csp->config->actions_file, buf);
+ return 1; /* never get here */
+ }
+
if (get_actions(actions_buf, alias_list, cur_action))
{
/* error */
fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid line (%lu): %s",
- csp->config->actions_file, linenum, buf);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': invalid line: %s",
+ csp->config->actions_file, buf);
return 1; /* never get here */
}
}
}
- else if (mode == MODE_SETTINGS)
- {
- /*
- * Part of the {{settings}} block.
- * Ignore for now, but we may want to read & check permissions
- * when we go multi-user.
- */
- }
- else if (mode == MODE_DESCRIPTION)
- {
- /*
- * Part of the {{description}} block.
- * Ignore for now.
- */
- }
else if (mode == MODE_ALIAS)
{
- /*
- * define an alias
- */
+ /* define an alias */
char actions_buf[BUFFER_SIZE];
struct action_alias * new_alias;
+ int more = 1;
char * start = strchr(buf, '=');
char * end = start;
if ((start == NULL) || (start == buf))
{
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid alias line (%lu): %s",
- csp->config->actions_file, linenum, buf);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': invalid alias line: %s",
+ csp->config->actions_file, buf);
return 1; /* never get here */
}
@@ -1207,9 +1051,9 @@ int load_actions_file(struct client_state *csp)
}
if (*start == '\0')
{
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid alias line (%lu): %s",
- csp->config->actions_file, linenum, buf);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': invalid alias line: %s",
+ csp->config->actions_file, buf);
return 1; /* never get here */
}
@@ -1221,12 +1065,12 @@ int load_actions_file(struct client_state *csp)
{
/* error */
fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': invalid alias line (%lu): %s = %s",
- csp->config->actions_file, linenum, buf, start);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': invalid alias line: %s = %s",
+ csp->config->actions_file, buf, start);
return 1; /* never get here */
}
-
+
/* add to list */
new_alias->next = alias_list;
alias_list = new_alias;
@@ -1252,9 +1096,9 @@ int load_actions_file(struct client_state *csp)
if (create_url_spec(perm->url, buf))
{
fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': line %lu: cannot create URL pattern from: %s",
- csp->config->actions_file, linenum, buf);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': cannot create URL pattern from: %s",
+ csp->config->actions_file, buf);
return 1; /* never get here */
}
@@ -1266,16 +1110,16 @@ int load_actions_file(struct client_state *csp)
{
/* oops - please have a {} line as 1st line in file. */
fclose(fp);
- log_error(LOG_LEVEL_FATAL,
- "can't load actions file '%s': first needed line (%lu) is invalid: %s",
- csp->config->actions_file, linenum, buf);
+ log_error(LOG_LEVEL_FATAL,
+ "can't load actions file '%s': first line is invalid: %s",
+ csp->config->actions_file, buf);
return 1; /* never get here */
}
else
{
/* How did we get here? This is impossible! */
fclose(fp);
- log_error(LOG_LEVEL_FATAL,
+ log_error(LOG_LEVEL_FATAL,
"can't load actions file '%s': INTERNAL ERROR - mode = %d",
csp->config->actions_file, mode);
return 1; /* never get here */
@@ -1283,10 +1127,24 @@ int load_actions_file(struct client_state *csp)
}
fclose(fp);
-
+
free_action(cur_action);
- free_alias_list(alias_list);
+ while (alias_list != NULL)
+ {
+ struct action_alias * next = alias_list->next;
+ freez((char *)alias_list->name);
+ free_action(alias_list->action);
+ free(alias_list);
+ alias_list = next;
+ }
+
+#ifndef SPLIT_PROXY_ARGS
+ if (!suppress_blocklists)
+ {
+ fs->proxy_args = strsav(fs->proxy_args, "");
+ }
+#endif /* ndef SPLIT_PROXY_ARGS */
/* the old one is now obsolete */
if (current_actions_file)
@@ -1306,290 +1164,3 @@ int load_actions_file(struct client_state *csp)
return(0);
}
-
-
-/*********************************************************************
- *
- * Function : actions_to_text
- *
- * Description : Converts a actionsfile entry from numeric form
- * ("mask" and "add") to text.
- *
- * Parameters :
- * 1 : mask = As from struct url_actions
- * 2 : add = As from struct url_actions
- *
- * Returns : A string. Caller must free it.
- * NULL on out-of-memory error.
- *
- *********************************************************************/
-char * actions_to_text(struct action_spec *action)
-{
- unsigned mask = action->mask;
- unsigned add = action->add;
- char * result = strdup("");
- struct list_entry * lst;
-
- /* sanity - prevents "-feature +feature" */
- mask |= add;
-
-
-#define DEFINE_ACTION_BOOL(__name, __bit) \
- if (!(mask & __bit)) \
- { \
- string_append(&result, " -" __name); \
- } \
- else if (add & __bit) \
- { \
- string_append(&result, " +" __name); \
- }
-
-#define DEFINE_ACTION_STRING(__name, __bit, __index) \
- if (!(mask & __bit)) \
- { \
- string_append(&result, " -" __name); \
- } \
- else if (add & __bit) \
- { \
- string_append(&result, " +" __name "{"); \
- string_append(&result, action->string[__index]); \
- string_append(&result, "}"); \
- }
-
-#define DEFINE_ACTION_MULTI(__name, __index) \
- if (action->multi_remove_all[__index]) \
- { \
- string_append(&result, " -" __name); \
- } \
- else \
- { \
- lst = action->multi_remove[__index]->first; \
- while (lst) \
- { \
- string_append(&result, " -" __name "{"); \
- string_append(&result, lst->str); \
- string_append(&result, "}"); \
- lst = lst->next; \
- } \
- } \
- lst = action->multi_add[__index]->first; \
- while (lst) \
- { \
- string_append(&result, " +" __name "{"); \
- string_append(&result, lst->str); \
- string_append(&result, "}"); \
- lst = lst->next; \
- }
-
-#define DEFINE_ACTION_ALIAS 0 /* No aliases for output */
-
-#include "actionlist.h"
-
-#undef DEFINE_ACTION_MULTI
-#undef DEFINE_ACTION_STRING
-#undef DEFINE_ACTION_BOOL
-#undef DEFINE_ACTION_ALIAS
-
- return result;
-}
-
-
-#ifdef FEATURE_CGI_EDIT_ACTIONS
-/*********************************************************************
- *
- * Function : actions_to_html
- *
- * Description : Converts a actionsfile entry from numeric form
- * ("mask" and "add") to a -seperated HTML string.
- *
- * Parameters :
- * 1 : mask = As from struct url_actions
- * 2 : add = As from struct url_actions
- *
- * Returns : A string. Caller must free it.
- * NULL on out-of-memory error.
- *
- *********************************************************************/
-char * actions_to_html(struct action_spec *action)
-{
- unsigned mask = action->mask;
- unsigned add = action->add;
- char * result = strdup("");
- char * enc_str;
- struct list_entry * lst;
-
- /* sanity - prevents "-feature +feature" */
- mask |= add;
-
-
-#define DEFINE_ACTION_BOOL(__name, __bit) \
- if (!(mask & __bit)) \
- { \
- string_append(&result, "\n -" __name); \
- } \
- else if (add & __bit) \
- { \
- string_append(&result, "\n +" __name); \
- }
-
-#define DEFINE_ACTION_STRING(__name, __bit, __index) \
- if (!(mask & __bit)) \
- { \
- string_append(&result, "\n -" __name); \
- } \
- else if (add & __bit) \
- { \
- string_append(&result, "\n +" __name "{"); \
- if (NULL == result) \
- { \
- return NULL; \
- } \
- enc_str = html_encode(action->string[__index]);\
- if (NULL == enc_str) \
- { \
- free(result); \
- return NULL; \
- } \
- string_append(&result, enc_str); \
- free(enc_str); \
- string_append(&result, "}"); \
- }
-
-#define DEFINE_ACTION_MULTI(__name, __index) \
- if (action->multi_remove_all[__index]) \
- { \
- string_append(&result, "\n -" __name); \
- } \
- else \
- { \
- lst = action->multi_remove[__index]->first; \
- while (lst) \
- { \
- string_append(&result, "\n -" __name "{");\
- if (NULL == result) \
- { \
- return NULL; \
- } \
- enc_str = html_encode(lst->str); \
- if (NULL == enc_str) \
- { \
- free(result); \
- return NULL; \
- } \
- string_append(&result, enc_str); \
- free(enc_str); \
- string_append(&result, "}"); \
- lst = lst->next; \
- } \
- } \
- lst = action->multi_add[__index]->first; \
- while (lst) \
- { \
- string_append(&result, "\n +" __name "{"); \
- if (NULL == result) \
- { \
- return NULL; \
- } \
- enc_str = html_encode(lst->str); \
- if (NULL == enc_str) \
- { \
- free(result); \
- return NULL; \
- } \
- string_append(&result, enc_str); \
- free(enc_str); \
- string_append(&result, "}"); \
- lst = lst->next; \
- }
-
-#define DEFINE_ACTION_ALIAS 0 /* No aliases for output */
-
-#include "actionlist.h"
-
-#undef DEFINE_ACTION_MULTI
-#undef DEFINE_ACTION_STRING
-#undef DEFINE_ACTION_BOOL
-#undef DEFINE_ACTION_ALIAS
-
- /* trim leading */
- if (result && *result)
- {
- char * s = result;
- result = strdup(result + 5);
- free(s);
- }
-
- return result;
-}
-#endif /* def FEATURE_CGI_EDIT_ACTIONS */
-
-
-/*********************************************************************
- *
- * Function : current_actions_to_text
- *
- * Description : Converts a actionsfile entry to text.
- *
- * Parameters :
- * 1 : action = Action
- *
- * Returns : A string. Caller must free it.
- * NULL on out-of-memory error.
- *
- *********************************************************************/
-char * current_action_to_text(struct current_action_spec *action)
-{
- unsigned long flags = action->flags;
- char * result = strdup("");
- struct list_entry * lst;
-
-#define DEFINE_ACTION_BOOL(__name, __bit) \
- if (flags & __bit) \
- { \
- string_append(&result, " +" __name); \
- } \
- else \
- { \
- string_append(&result, " -" __name); \
- }
-
-#define DEFINE_ACTION_STRING(__name, __bit, __index) \
- if (flags & __bit) \
- { \
- string_append(&result, " +" __name "{"); \
- string_append(&result, action->string[__index]); \
- string_append(&result, "}"); \
- } \
- else \
- { \
- string_append(&result, " -" __name); \
- }
-
-#define DEFINE_ACTION_MULTI(__name, __index) \
- lst = action->multi[__index]->first; \
- if (lst == NULL) \
- { \
- string_append(&result, " -" __name); \
- } \
- else \
- { \
- while (lst) \
- { \
- string_append(&result, " +" __name "{"); \
- string_append(&result, lst->str); \
- string_append(&result, "}"); \
- lst = lst->next; \
- } \
- }
-
-#define DEFINE_ACTION_ALIAS 0 /* No aliases for output */
-
-#include "actionlist.h"
-
-#undef DEFINE_ACTION_MULTI
-#undef DEFINE_ACTION_STRING
-#undef DEFINE_ACTION_BOOL
-#undef DEFINE_ACTION_ALIAS
-
- return result;
-}
diff --git a/actions.h b/actions.h
index 04434e28..d71d8c34 100644
--- a/actions.h
+++ b/actions.h
@@ -1,6 +1,6 @@
-#ifndef ACTIONS_H_INCLUDED
-#define ACTIONS_H_INCLUDED
-#define ACTIONS_H_VERSION "$Id: actions.h,v 1.8 2002/03/24 13:25:43 swa Exp $"
+#ifndef _ACTIONS_H
+#define _ACTIONS_H
+#define ACTIONS_H_VERSION "$Id: actions.h,v ??? $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.h,v $
@@ -9,7 +9,7 @@
* Functions declared include: FIXME
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -35,46 +35,6 @@
*
* Revisions :
* $Log: actions.h,v $
- * Revision 1.8 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.7 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.6 2001/10/23 21:30:30 jongfoster
- * Adding error-checking to selected functions.
- *
- * Revision 1.5 2001/10/14 21:58:22 jongfoster
- * Adding support for the CGI-based editor:
- * - Exported get_actions()
- * - Added new function free_alias_list()
- * - Added support for {{settings}} and {{description}} blocks
- * in the actions file. They are currently ignored.
- * - Added restriction to only one {{alias}} block which must appear
- * first in the file, to simplify the editor's rewriting rules.
- * - Note that load_actions_file() is no longer used by the CGI-based
- * editor, but some of the other routines in this file are.
- *
- * Revision 1.4 2001/09/16 15:47:37 jongfoster
- * First version of CGI-based edit interface. This is very much a
- * work-in-progress, and you can't actually use it to edit anything
- * yet. You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
- * to have any effect.
- *
- * Revision 1.3 2001/09/14 00:17:32 jongfoster
- * Tidying up memory allocation. New function init_action().
- *
- * Revision 1.2 2001/07/29 19:01:11 jongfoster
- * Changed _FILENAME_H to FILENAME_H_INCLUDED.
- * Added forward declarations for needed structures.
- *
- * Revision 1.1 2001/05/31 21:16:46 jongfoster
- * Moved functions to process the action list into this new file.
- *
*
*********************************************************************/
@@ -84,51 +44,23 @@ extern "C" {
#endif
-struct action_spec;
-struct current_action_spec;
-struct client_state;
-
-
-
-/* This structure is used to hold user-defined aliases */
-struct action_alias
-{
- const char * name;
- struct action_spec action[1];
- struct action_alias * next;
-};
-
-
-extern jb_err get_actions (char *line,
- struct action_alias * alias_list,
- struct action_spec *cur_action);
-extern void free_alias_list(struct action_alias *alias_list);
-
-extern void init_action(struct action_spec *dest);
-extern void free_action(struct action_spec *src);
-extern jb_err merge_actions (struct action_spec *dest,
- const struct action_spec *src);
-extern jb_err copy_action (struct action_spec *dest,
+extern void merge_actions (struct action_spec *dest,
const struct action_spec *src);
+extern void copy_action (struct action_spec *dest,
+ const struct action_spec *src);
+extern void free_action (struct action_spec *src);
extern char * actions_to_text (struct action_spec *action);
-#ifdef FEATURE_CGI_EDIT_ACTIONS
-extern char * actions_to_html (struct action_spec *action);
-#endif /* def FEATURE_CGI_EDIT_ACTIONS */
extern void init_current_action (struct current_action_spec *dest);
-extern void free_current_action (struct current_action_spec *src);
-extern jb_err merge_current_action (struct current_action_spec *dest,
+extern void merge_current_action (struct current_action_spec *dest,
const struct action_spec *src);
+extern void free_current_action (struct current_action_spec *src);
extern char * current_action_to_text(struct current_action_spec *action);
-extern jb_err get_action_token(char **line, char **name, char **value);
+extern int get_action_token(char **line, char **name, char **value);
extern void unload_actions_file(void *file_data);
extern int load_actions_file(struct client_state *csp);
-#ifdef FEATURE_GRACEFUL_TERMINATION
-void unload_current_actions_file(void);
-#endif
-
/* Revision control strings from this header and associated .c file */
extern const char actions_rcs[];
@@ -138,7 +70,7 @@ extern const char actions_h_rcs[];
} /* extern "C" */
#endif
-#endif /* ndef ACTIONS_H_INCLUDED */
+#endif /* ndef _ERRLOG_H */
/*
Local Variables:
diff --git a/default.action b/actionsfile
old mode 100644
new mode 100755
similarity index 76%
rename from default.action
rename to actionsfile
index b2c85ef5..d3e14d4a
--- a/default.action
+++ b/actionsfile
@@ -1,43 +1,10 @@
-######################################################################
-#
-# File : $Source: /cvsroot/ijbswa/current/basic.action,v $
-#
-# $Id: basic.action,v 1.3 2002/03/26 22:29:54 swa Exp $
+#############################################################################
+# Sample actions file for the Internet Junkbuster 2.9.x
#
-# Purpose : Default actions file, see
-# http://www.privoxy.org/faq/questions.html#CONFIGFILES
+# For information, see http://ijbswa.sourceforge.net/
#
-# Copyright : Written by and Copyright
-# Privoxy team. http://www.privoxy.org/
+# $Id: actionsfile,v 1.2 2001/06/29 21:45:41 oes Exp $
#
-# Based on the Internet Junkbuster originally written
-# by and Copyright (C) 1997 Anonymous Coders and
-# Junkbusters Corporation. http://www.junkbusters.com
-#
-# We value your feedback. However, to provide you with the best support,
-# please note:
-#
-# * Use the support forum to get help:
-# http://sourceforge.net/tracker/?group_id=11118&atid=211118
-# * Submit bugs only thru our bug forum:
-# http://sourceforge.net/tracker/?group_id=11118&atid=111118
-# Make sure that the bug has not already been submitted. Please try
-# to verify that it is a Junkbuster bug, and not a browser or site
-# bug first. If you are using your own custom configuration, please
-# try the stock configs to see if the problem is a configuration
-# related bug. And if not using the latest development snapshot,
-# please try the latest one. Or even better, CVS sources.
-# * Submit feature requests only thru our feature request forum:
-# http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse
-#
-# For any other issues, feel free to use the mailing lists:
-# http://sourceforge.net/mail/?group_id=11118
-#
-# Anyone interested in actively participating in development and related
-# discussions can join the appropriate mailing list here:
-# http://sourceforge.net/mail/?group_id=11118. Archives are available
-# here too.
-#
#############################################################################
# Syntax
#############################################################################
@@ -65,7 +32,7 @@
# is a domain-only pattern and will match any request to www.yahoo.com
#
# www.example.com/
-# means exactly the same (but is slightly less efficient)
+# means exactly the same
#
# www.example.com/index.html
# matches only the document /index.html on www.example.com
@@ -125,16 +92,12 @@
# details.
#
# Please note that matching in the path is CASE INSENSITIVE by default, but
-# you can switch to case sensitive by starting the pattern with the "(?-i)"
-# switch:
+# you can switch to case sensitive at any point in the pattern by using
+# the "(?-i)" switch:
#
# www.example.com/(?-i)PaTtErN.*
# will match only documents whose path starts with PaTtErN in exactly this
# capitalization.
-#
-# Partially case-sensetive and partially case-insensitive patterns are
-# possible, but the rules about splitting them up are extremely complex
-# - see the PCRE documentation for more information.
#
#############################################################################
# Action Syntax
@@ -186,11 +149,6 @@
# most banner animations, but also has the risk of not showing the
# entire last frame (if it is only a delta to an earlier frame).
#
-# +downgrade
-# Downgrade HTTP/1.1 client requests to HTTP/1.0 and downgrade the
-# responses as well. Use this action for servers that use HTTP/1.1
-# protocol features that Junkbuster currently can't handle yet.
-#
# +fast-redirects
# Many sites, like yahoo.com, don't just link to other sites.
# Instead, they will link to some script on their own server,
@@ -212,23 +170,9 @@
# request and send a local redirect back to your browser without
# contacting the remote site.
#
-# +filter{name}
-# Filter the website through one or more regular expression filters.
-# Repeat for multiple filters.
-#
-# Filters predefined in the supplied re_filterfile include:
-#
-# html-annoyances: Get rid of particularly annoying HTML abuse
-# js-annoyances: Get rid of particularly annoying JavaScript abuse
-# no-poups: Kill all popups in JS and HTML
-# frameset-borders: Give frames a border
-# webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
-# no-refresh: Automatic refresh sucks on auto-dialup lines
-# fun: Text replacements for subversive browsing fun!
-# nimda: Remove (virus) Nimda code.
-# banners-by-size: Kill banners by size
-# crude-parental: Kill all web pages that contain the words "sex" or "warez"
-#
+# +filter
+# Filter the website through the re_filterfile
+# FIXME: The syntax should be +filter{filename}
#
# +hide-forwarded
# Block any existing X-Forwarded-for header, and do not add a new one.
@@ -267,50 +211,17 @@
# in which case a "blocked" image can be sent rather than a HTML page.
# See +image-blocker{} for the control over what is actually sent.
#
+# +image-blocker{logo}
# +image-blocker{blank}
-# +image-blocker{pattern}
-# +image-blocker{} with being any valid image URL
+# +image-blocker{http://i.j.b/send-banner}
# Decides what to do with URLs that end up tagged with {+block +image}.
-# There are 4 options:
-# * "-image-blocker" will send a HTML "blocked" page, usually
-# resulting in a "broken image" icon.
-# * "+image-blocker{blank}" will send a 1x1 transparent image
-# * "+image-blocker{pattern}" will send a 4x4 grey/white pattern
-# which is less intrusive than the logo but easier to recognize
-# than the transparent one.
-# * "+image-blocker{}" will send a HTTP temporary redirect
-# to the specified image URL.
-#
-#
-# +limit-connect{portlist}
-# The CONNECT methods exists in HTTP to allow access to secure websites
-# (https:// URLs) through proxies. It works very simply: The proxy
-# connects to the server on the specified port, and then short-circuits
-# its connections to the cliant and to the remote proxy.
-# This can be a big security hole, since CONNECT-enabled proxies can
-# be abused as TCP relays very easily.
-# By default, i.e. in the absence of a +limit-connect action, Junkbuster
-# will only allow CONNECT requests to port 443, which is the standard port
-# for https.
-# If you want to allow CONNECT for more ports than that, or want to forbid
-# CONNECT altogether, you can specify a comma separated list of ports and port
-# ranges (the latter using dashes, with the minimum defaulting to 0 and max to 65K):
-#
-# +limit-connect{443} # This is the default and need no be specified.
-# +limit-connect{80,443} # Ports 80 and 443 are OK.
-# +limit-connect{-3, 7, 20-100, 500-} # Port less than 3, 7, 20 to 100, and above 500 are OK.
-#
-# +no-compression
-# Prevent the website from compressing the data. Some websites do
-# that, which is a problem for junkbuster, since +filter, +no-popup
-# and +gif-deanimate will not work on compressed data. Will slow down
-# connections to those websites, though.
-#
-# +no-cookies-keep
-# If the website sets cookies, make sure they are erased when you exit
-# and restart your web browser. This makes profiling cookies useless,
-# but won't break sites which require cookies so that you can log in
-# or for transactions.
+# There are 4 options. "-image-blocker" will send a HTML "blocked" page,
+# usually resulting in a "broken image" icon. "+image-blocker{logo}"
+# will send a "JunkBuster" image. "+image-blocker{blank}" will send
+# a 1x1 transparent GIF. And finally, "+image-blocker{http://xyz.com}"
+# will send a HTTP temporary redirect to the specified image - this
+# has the advantage of the icon being beeing cached by the browser,
+# which will speed up the display.
#
# +no-cookies-read
# Prevent the website from reading cookies
@@ -364,130 +275,86 @@
# Useful aliases
+no-cookies = +no-cookies-set +no-cookies-read
-no-cookies = -no-cookies-set -no-cookies-read
+fragile = -block -no-cookies -filter -fast-redirects -hide-referer -no-popups
+shop = -no-cookies -filter -fast-redirects
+imageblock = +block +image
-# Fragile sites should have the minimum changes
-fragile = -block -deanimate-gifs -fast-redirects -filter -hide-referer -no-cookies -no-popups
-
-# Shops should be allowed to set persistent cookies
-shop = -filter -no-cookies -no-cookies-keep
-
-# Your favourite blend of filters:
-#
-myfilters = +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}\
- +filter{webbugs} +filter{nimda} +filter{banners-by-size}
-
+#For people who don't like to type too much: ;-)
+c0 = +no-cookies
+c1 = -no-cookies
+c2 = -no-cookies-set +no-cookies-read
+c3 = +no-cookies-set -no-cookies-read
#... etc. Customize to your heart's content.
#############################################################################
# Defaults
#############################################################################
{\
--add-header \
-block \
--deanimate-gifs \
--downgrade \
+fast-redirects \
-myfilters \
-+no-compression \
-+no-cookies-keep \
++filter \
+hide-forwarded \
+hide-from{block} \
+hide-referer{forge} \
-hide-user-agent \
-image \
-+image-blocker{http://config.privoxy.org/send-banner} \
-+no-cookies-keep \
--no-cookies-read \
--no-cookies-set \
++image-blocker{http://i.j.b/send-banner} \
++no-cookies-read \
++no-cookies-set \
+no-popups \
--vanilla-wafer \
--wafer \
++vanilla-wafer \
}
/ # Match all URLs
-
#############################################################################
# A useful site for testing - shows all headers:
# http://privacy.net/analyze/
#############################################################################
-{+add-header{X-Privacy: Yes please} \
+{+add-header{X-Privacy: Yes please} #-add-header{*} \
+add-header{X-User-Tracking: No thanks!} -filter}
privacy.net
-
#############################################################################
-# Test for new GIF deanimation feature.
-# Just try http://www.oesterhelt.org/deanimate-demo with and without it.
+# Permissions list
#############################################################################
-{+deanimate-gifs{last}}
-www.oesterhelt.org/deanimate-demo
-
-#############################################################################
# Sites that need cookies
-#
-# FIXME: Now cookies are allowed by default, do any of these sites
-# need persistent cookies?
-#############################################################################
+{-no-cookies}
+.javasoft.com
+.sun.com
+.yahoo.com
+.msdn.microsoft.com
-#{-no-cookies}
-#.javasoft.com
-#.sun.com
-#.yahoo.com
-#.msdn.microsoft.com
-#.sourceforge.net
-#.sf.net
-#www.nexgo.de
-#.myrealbox.com
-#mail.uni.de
-#e-tools.freenet.de
-#office.freenet.de
+# Alternative way of saying the same thing
+{-no-cookies-set -no-cookies-read}
+.sourceforge.net
+.sf.net
-#############################################################################
# These sites are very complex and require
# minimal interference.
-#############################################################################
{fragile}
.office.microsoft.com
.windowsupdate.microsoft.com
-.deutsche-bank-24.de
-#############################################################################
# Shopping sites - still want to block ads.
-#############################################################################
{shop}
.quietpc.com
.worldpay.com # for quietpc.com
.jungle.com
.scan.co.uk
-#############################################################################
# These shops require pop-ups
-#############################################################################
{shop -no-popups}
.dabs.com
.overclockers.co.uk
-#############################################################################
-# Sometimes fast-redirects catches things by mistake
-#############################################################################
{-fast-redirects}
www.ukc.ac.uk/cgi-bin/wac\.cgi\?
login.yahoo.com
-edit.europe.yahoo.com
-.google.com
-.altavista.com/.*(like|url|link):http
-.altavista.com/trans.*urltext=http
-.speedfind.de
-.nytimes.com
-#############################################################################
# Please don't re_filter code!
-#############################################################################
{-filter}
-.sourceforge.net
-
+.cvs.sourceforge.net
#############################################################################
# Imagelist:
@@ -517,18 +384,13 @@ www.carbuyer.com/cgi-carbuyer/getimage.cgi
*.fxweb.com/v2-trackrun\.cgi
195.63.104.61
195.63.104.222
-213.165.64.3[4-9]
-213.165.64.4[0-4]
+213.165.64.3[89]
+213.165.64.4[1-4]
194.221.183.22[1-7]
-a196.g.akamai.net/7/196/2670/000[1-3]/images\.gmx\.net/.*images/.*/.*/
-/cgi-bin/ivw/CP/
+a196.g.akamai.net/7/196/2670/000[12]/images.gmx.net/i4/images/.*/
+/cgi-bin/ivw/CP/CGI
151.189.8.213/Adimg
151.189.8.193/Media
-.smartclicks.com/.*/smart(img|banner|host|bar|site)
-.linkexchange.com/.*/showl(ogo|e)
-MoneyBanner.de
-pixel.intares.net/cgi-bin/janus
-ar.atwola.com # This serves all ads for CNN and AOL
#############################################################################
# Blocklist:
@@ -544,48 +406,49 @@ ar.atwola.com # This serves all ads for CNN and AOL
###/*.*/(sponsor|banner)s?[0-9]?/
###/*.*/.*banner([-_]?[a-z0-9]+)?\.(gif|jpg)
-/?.*/_?(plain|live)?ads?(-banners)?/
-/?.*/abanners/
-/?.*/ad(sdna_image|gifs?)/
-/?.*/ad(server|stream|juggler)\.(cgi|pl|dll|exe)
-/?.*/adbanners/
-/?.*/ad_banner/
-/?.*/adserver
-/?.*/adstream\.cgi
-/?.*/adv((er)?ts?|ertis(ing|ements?))?/
-/?.*/anzei(gen)?/?
-/?.*/ban[-_]cgi/
-/?.*/banner_?ads/
-/?.*/banner_?anzeigen
-/?.*/bannerimage/
-/?.*/banners?/
-/?.*/banners?\.cgi/
-/?.*/cgi-bin/centralad/getimage
-/?.*/images/addver\.gif
-/?.*/images/advert\.gif
-/?.*/images/marketing/.*\.(gif|jpe?g)
-/?.*/place-ads
-/?.*/popupads/
-/?.*/promobar.*
-/?.*/publicite/
-/?.*/randomads/.*\.(gif|jpe?g)
-/?.*/rekla(ma|me|am)/.*\.(gif|jpe?g)
-/?.*/siteads/
-/?.*/sponsor.*\.gif
-/?.*/sponsors?[0-9]?/
-/?.*/ucbandeimg/
-/?.*/werb\..*
-/?.*/werbebanner/
-/?.*/werbung/.*\.(gif|jpe?g)
-/?.*/adv\. # www.telegraaf.nl
-/?.*/advert[0-9]+\.jpg
-/?.*bann\.gif
-/?.*/ads/
+/.*/_?(plain|live)?ads?(-banners)?/
+/.*/abanners/
+/.*/ad(sdna_image|gifs?)/
+/.*/ad(server|stream|juggler)\.(cgi|pl|dll|exe)
+/.*/adbanners/
+/.*/adserver
+/.*/adstream\.cgi
+/.*/adv((er)?ts?|ertis(ing|ements?))?/
+/.*/anzei(gen)?/?
+/.*/ban[-_]cgi/
+/.*/banner_?ads/
+/.*/banner_?anzeigen
+/.*/bannerimage/
+/.*/banners?/
+/.*/banners?\.cgi/
+/.*/cgi-bin/centralad/getimage
+/.*/images/addver\.gif
+/.*/images/advert\.gif
+/.*/images/marketing/.*\.(gif|jpe?g)
+/.*/place-ads
+/.*/popupads/
+/.*/promobar.*
+/.*/publicite/
+/.*/randomads/.*\.(gif|jpe?g)
+/.*/reklama/.*\.(gif|jpe?g)
+/.*/reklame/.*\.(gif|jpe?g)
+/.*/reklaam/.*\.(gif|jpe?g)
+/.*/siteads/
+/.*/sponsor.*\.gif
+/.*/sponsors?[0-9]?/
+/.*/ucbandeimg/
+/.*/werb\..*
+/.*/werbebanner/
+/.*/werbung/.*\.(gif|jpe?g)
+/.*/adv\. # www.telegraaf.nl
+/.*/advert[0-9]+\.jpg
+/.*bann\.gif
/Media/Images/Adds/
/_banner/
/ad_images/
/adgenius/
/adimages/
+/.*/ads/
/viewad/
/adserve/
/adverts/
@@ -624,24 +487,24 @@ ar.atwola.com # This serves all ads for CNN and AOL
/worldnet/ad\.cgi
/zhp/auktion/img/
/cgi-bin/nph-adclick.exe/
-/?.*/Image/BannerAdvertising/
-/?.*/ad-bin/
-/?.*/adlib/server\.cgi
-/?.*/gsa_bs/gsa_bs.cmdl
+/.*/Image/BannerAdvertising/
+/.*/ad-bin/
+/.*/adlib/server\.cgi
+/.*/gsa_bs/gsa_bs.cmdl
/autoads/
/anz/pics/
# for our finnish friends, by Kai Puolamaki
-/?.*/mainos/*.*/.*\.gif
-/?.*/mainos/*.*/.*\.jpe?g
+/.*/mainos/*.*/.*\.gif
+/.*/mainos/*.*/.*\.jpe?g
# more from a finnish friend Petri Haapio
cgi.tietovalta.fi
.keltaisetsivut.fi/web/img/\.*gif
.haku.net/pics/pana\.*gif
.www.fi/guvat/\.*gif
-/?.*/(.*[-_.].*)?maino(kset|nta|s).*(/|\.(gif|html?|jpe?g|png))
-/?.*/(ilm(oitus)?|kampanja)(hallinta|kuvat?)(/|\.(gif|html?|jpe?g|png))
+/.*/(.*[-_.].*)?maino(kset|nta|s).*(/|\.(gif|html?|jpe?g|png))
+/.*/(ilm(oitus)?|kampanja)(hallinta|kuvat?)(/|\.(gif|html?|jpe?g|png))
# and even more from a finnish friend Hannu Napari
194.251.243.50/cgi-bin/banner
@@ -652,21 +515,21 @@ www.iltalehti.fi/ilmkuvat
www.mtv3.fi/mainoskuvat
#
-/?.*/adfinity
-/?.*/[?]adserv
-/?.*/bizgrphx/
-/?.*/smallad2\.gif
-/?.*/ana2ad\.gif
-/?.*/adimg/
-/?.*/.*counter\.pl
-/?.*/spin_html/
-/?.*/images/topics/topicgimp\.gif
+/.*/adfinity
+/.*/[?]adserv
+/.*/bizgrphx/
+/.*/smallad2\.gif
+/.*/ana2ad\.gif
+/.*/adimg/
+/.*/.*counter\.pl
+/.*/spin_html/
+/.*/images/topics/topicgimp\.gif
.discovery.com/.*banner_id
-/?.*/.*bannr\.gif
+/.*/.*bannr\.gif
.cruel.com/images/
.idrink.com/frm_bottom.htm
-/?.*/.*pb_ihtml\.gif
-/?.*/ph-ad.*\.focalink\.com
+/.*/.*pb_ihtml\.gif
+/.*/ph-ad.*\.focalink\.com
/cgi-bin/adjuggler
/we_ba/ # hausfrauenseite.de *bwhahahaaaaa*
@@ -699,38 +562,38 @@ www.mtv3.fi/mainoskuvat
/.*s_msn\.gif
/.*addchannel\.gif
/.*adddesktop\.gif
-/?.*/ns4\.gif
-/?.*/v3sban\.gif
-/?.*/?FPCreated\.gif
-/?.*/opera35\.gif
-/?.*/opera13\.gif
-/?.*/opera_b\.gif
-/?.*/ie_horiz\.gif
-/?.*/ie_logo\.gif
+/.*/ns4\.gif
+/.*/v3sban\.gif
+/.*/?FPCreated\.gif
+/.*/opera35\.gif
+/.*/opera13\.gif
+/.*/opera_b\.gif
+/.*/ie_horiz\.gif
+/.*/ie_logo\.gif
# ... and even more!
-/?.*/favicon\.ico
+/.*/favicon\.ico
# generally useless information and promo stuff (commented out)
#/.*/(counter|getpcbutton|BuiltByNOF|netscape|hotmail|vcr(rated)?|rsaci(rated)?|freeloader|cache_now(_anim)?|apache_pb|now_(anim_)?button|ie_?(buttonlogo|static?|.*ani.*)?)\.(gif|jpe?g)
-/?.*/images/na/us/brand/
-/?.*/advantage\.(gif|jpg)
-/?.*/advanbar\.(gif|jpg)
-/?.*/advanbtn\.(gif|jpg)
-/?.*/biznetsmall\.(gif|jpg)
-/?.*/utopiad\.(gif|jpg)
-/?.*/epipo\.(gif|jpg)
-/?.*/amazon([a-zA-Z0-9]+)\.(gif|jpg)
-/?.*/bnlogo.(gif|jpg)
-/?.*/buynow([a-zA-Z0-9]+)\.(gif|jpg)
+/.*/images/na/us/brand/
+/.*/advantage\.(gif|jpg)
+/.*/advanbar\.(gif|jpg)
+/.*/advanbtn\.(gif|jpg)
+/.*/biznetsmall\.(gif|jpg)
+/.*/utopiad\.(gif|jpg)
+/.*/epipo\.(gif|jpg)
+/.*/amazon([a-zA-Z0-9]+)\.(gif|jpg)
+/.*/bnlogo.(gif|jpg)
+/.*/buynow([a-zA-Z0-9]+)\.(gif|jpg)
/p/d/publicid
# for the dutch folks by a dutch friend gertjan@west.nl
-/?.*/Advertenties/
-/?.*/Adverteerders/
+/.*/Advertenties/
+/.*/Adverteerders/
.netdirect.nl/nd_servlet/___
# --------------------------------------------------------------------------
@@ -1039,8 +902,8 @@ www.forbes.com/tool/images/frontend/
www.zserver.com
www.spinbox.com
.pathfinder.com/shopping/marketplace/images/
-/?.*/adbanner*
-/?.*/adgraphic*
+/.*/adbanner*
+/.*/adgraphic*
static.wired.com/images
.perso.estat.com/cgi-bin/perso/
#dinoadserver1.roka.net
@@ -1086,11 +949,11 @@ home.talkcity.com/homepopup.html.*
# Banners from Freeserve
#banner.freeservers.com/cgi-bin/fs_adbar # fixed by above regexp
# And those nasty va-popups !
-/?.*/?va_banner.html
+/.*/?va_banner.html
# And an all-around hit against advert*.jpg
-/?.*/advert[0-9]+\.jpg
+/.*/advert[0-9]+\.jpg
# And yet another Internet Explorer gif ...
-/?.*/ie_horiz\.gif
+/.*/ie_horiz\.gif
# Some uninteresting buttons I think...
.mircx.com/images/buttons/
services.mircx.com/.*\.gif
@@ -1309,10 +1172,6 @@ www.linux-magazin.de/banner
# The Register ads - oh, and all images in Register stories (sigh).
www.theregister.co.uk/media/
-# Used on http://www.theregister.co.uk/
-# Sample advert URL:
-# http://secure.webconnect.net/cgi-bin/webconnecthome.dll?F467
-.webconnect.net
# Dilbert:
www.dilbert.com/comics/dilbert/images/.*_140x800.*\.gif
@@ -1326,11 +1185,11 @@ www.stattrack.com/stats/
#Now they're Yahoo GeoCities, their junk is in a different place.
##geo.yahoo.com/serv
##visit.geocities.com/visit.gif
-.yimg.com/?.*/www.geocities.com/js_source
+.yimg.com/.*/www.geocities.com/js_source
#http://us.toto.geo.yahoo.com/toto?s=76001086
.geo.yahoo.com
.visit.geocities.com
-.yimg.com/?.*/www.geocities.com/
+.yimg.com/.*/www.geocities.com/
#http://counter16.bravenet.com/counter.php
counter*.
@@ -1366,7 +1225,7 @@ logout.gmx.net
logout.tvspielfilm.de
gmx.tvspielfilm.de
www.freenet.de/customerindex\.html
-/?.*/phpAds
+/.*/phpAds
.fxweb.com/v2-trackrun\.cgi
rtldating.peopleunited.de
.advertising.com
@@ -1378,13 +1237,12 @@ fourohfour.nbci.com/Members404Error.php3
.adlink.de
www.fair-ist-mehr.de/cgi-bin/bt.pl
.linkexchange.
-/?.*/adpage.asp
+/.*/adpage.asp
/ADS
.net-on.net
rstrip.namezero.com
62.26.220.2
.doubleclick.net
-.adserver.yahoo.com
#############################################################################
{-block}
@@ -1392,7 +1250,6 @@ rstrip.namezero.com
include.ebay.com
cpan.valueclick.com
www.userfriendly.org/images/banners/banner_dp_heart\.gif
-advogato.org
#Why were these in the Waldherr blockfile?
#www.hitbox.com
@@ -1497,8 +1354,10 @@ www.iez-auktion.de
# Jon's addition: MSDN
+
.msdn.microsoft.com
+
#js
.adbusters.com
.freemail*.web.de/online/ordner/anzeigen
@@ -1506,8 +1365,10 @@ foggy.sda.t-online.de
.us.i1.yimg.com/us.yimg.com/i/pim/ad2.gif
www.nexgo.de/.*/bg_banner.jpg
-# .*ads. matches prdownloads.sourceforge.net and many other download sites
-# The fix is:
-.*downloads.
+# New GIF deanimation feature. Just try http://www.oesterhelt.org/deanimate-demo
+# with and without it.
+#
+{+deanimate-gifs{last}}
+www.oesterhelt.org/deanimate-demo
# End of file
diff --git a/advanced.action b/advanced.action
deleted file mode 100644
index 02855034..00000000
--- a/advanced.action
+++ /dev/null
@@ -1,90 +0,0 @@
-######################################################################
-#
-# File : $Source: /cvsroot/ijbswa/current/advanced.action,v $
-#
-# $Id: advanced.action,v 1.3 2002/03/26 22:29:54 swa Exp $
-#
-# Purpose : Most agressive actions file, see
-# http://www.privoxy.org/faq/questions.html#CONFIGFILES
-#
-# Copyright : Written by and Copyright
-# Privoxy team. http://www.privoxy.org/
-#
-# Based on the Internet Junkbuster originally written
-# by and Copyright (C) 1997 Anonymous Coders and
-# Junkbusters Corporation. http://www.junkbusters.com
-#
-# We value your feedback. However, to provide you with the best support,
-# please note:
-#
-# * Use the support forum to get help:
-# http://sourceforge.net/tracker/?group_id=11118&atid=211118
-# * Submit bugs only thru our bug forum:
-# http://sourceforge.net/tracker/?group_id=11118&atid=111118
-# Make sure that the bug has not already been submitted. Please try
-# to verify that it is a Junkbuster bug, and not a browser or site
-# bug first. If you are using your own custom configuration, please
-# try the stock configs to see if the problem is a configuration
-# related bug. And if not using the latest development snapshot,
-# please try the latest one. Or even better, CVS sources.
-# * Submit feature requests only thru our feature request forum:
-# http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse
-#
-# For any other issues, feel free to use the mailing lists:
-# http://sourceforge.net/mail/?group_id=11118
-#
-# Anyone interested in actively participating in development and related
-# discussions can join the appropriate mailing list here:
-# http://sourceforge.net/mail/?group_id=11118. Archives are available
-# here too.
-#
-######################################################################
-
-######################################################################
-# Aliases
-######################################################################
-
-######################################################################
-# Defaults
-######################################################################
-
-######################################################################
-# Specials
-######################################################################
-
-######################################################################
-# Imagelist:
-######################################################################
-
-######################################################################
-# Blocklist:
-######################################################################
-
-######################################################################
-#
-# Copyright : Written by and Copyright (C) 2001 the SourceForge
-# Privoxy team. http://www.privoxy.org/
-#
-# Based on the Internet Junkbuster originally written
-# by and Copyright (C) 1997 Anonymous Coders and
-# Junkbusters Corporation. http://www.junkbusters.com
-#
-# 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.
-#
-######################################################################
diff --git a/amiga.c b/amiga.c
index 493a00eb..789fd085 100644
--- a/amiga.c
+++ b/amiga.c
@@ -1,4 +1,4 @@
-const char amiga_rcs[] = "$Id: amiga.c,v 1.8 2002/03/25 19:32:15 joergs Exp $";
+const char amiga_rcs[] = "$Id: amiga.c,v 1.1.1.1 2001/05/15 13:58:46 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/amiga.c,v $
@@ -6,7 +6,7 @@ const char amiga_rcs[] = "$Id: amiga.c,v 1.8 2002/03/25 19:32:15 joergs Exp $";
* Purpose : Amiga-specific declarations.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -28,48 +28,6 @@ const char amiga_rcs[] = "$Id: amiga.c,v 1.8 2002/03/25 19:32:15 joergs Exp $";
*
* Revisions :
* $Log: amiga.c,v $
- * Revision 1.8 2002/03/25 19:32:15 joergs
- * Name in version string changed from junkbuster to Privoxy.
- *
- * Revision 1.7 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.6 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.5 2002/03/03 09:18:03 joergs
- * Made jumbjuster work on AmigaOS again.
- *
- * Revision 1.4 2001/10/07 15:35:13 oes
- * Replaced 6 boolean members of csp with one bitmap (csp->flags)
- *
- * Revision 1.3 2001/09/12 22:54:51 joergs
- * Stacksize of main thread increased.
- *
- * Revision 1.2 2001/05/23 00:13:58 joergs
- * AmigaOS support fixed.
- *
* Revision 1.1.1.1 2001/05/15 13:58:46 oes
* Initial import of version 2.9.3 source tree
*
@@ -88,8 +46,8 @@ const char amiga_rcs[] = "$Id: amiga.c,v 1.8 2002/03/25 19:32:15 joergs Exp $";
const char amiga_h_rcs[] = AMIGA_H_VERSION;
-unsigned long __stack = 100*1024;
-static char ver[] = "$VER: Privoxy " __AMIGAVERSION__ " (" __AMIGADATE__ ")";
+unsigned long __stack = 20*1024;
+static char ver[] = "$VER: junkbuster " __AMIGAVERSION__ " (" __AMIGADATE__ ")";
struct Task *main_task = NULL;
int childs = 0;
@@ -109,32 +67,29 @@ __saveds ULONG server_thread(void)
{
SetErrnoPtr(&(UserData.eno),sizeof(int));
local_csp->cfd=ObtainSocket(local_csp->cfd, AF_INET, SOCK_STREAM, 0);
- if(JB_INVALID_SOCKET!=local_csp->cfd)
+ if(-1!=local_csp->cfd)
{
Signal(main_task,SIGF_SINGLE);
serve((struct client_state *) local_csp);
} else {
- local_csp->flags &= ~CSP_FLAG_ACTIVE;
+ local_csp->active = 0;
Signal(main_task,SIGF_SINGLE);
}
CloseLibrary(SocketBase);
} else {
- local_csp->flags &= ~CSP_FLAG_ACTIVE;
+ local_csp->active = 0;
Signal(main_task,SIGF_SINGLE);
}
childs--;
return 0;
}
-static BPTR olddir;
-
void amiga_exit(void)
{
if(SocketBase)
{
CloseLibrary(SocketBase);
}
- CurrentDir(olddir);
}
static struct SignalSemaphore memsem;
@@ -162,13 +117,12 @@ void InitAmiga(void)
InitSemaphore(&memsem);
memsemptr = &memsem;
- olddir=CurrentDir(GetProgramDir());
atexit(amiga_exit);
}
#ifdef __GNUC__
#ifdef libnix
-/* multithreadingsafe libnix replacements */
+/* multitaskingsafe libnix replacements */
static void *memPool=NULL;
void *malloc (size_t s)
@@ -277,7 +231,7 @@ ADD2EXIT(__memCleanUp,-50);
#error No libnix and no ixemul!?
#endif /* libnix */
#else
-#error Only GCC is supported, multithreading safe malloc/free required.
+#error Only GCC is supported, multitasking safe malloc/free required.
#endif /* __GNUC__ */
#endif /* def AMIGA */
diff --git a/amiga.h b/amiga.h
index 580dc32d..53933048 100644
--- a/amiga.h
+++ b/amiga.h
@@ -1,7 +1,7 @@
#ifdef AMIGA
-#ifndef AMIGA_H_INCLUDED
-#define AMIGA_H_INCLUDED
-#define AMIGA_H_VERSION "$Id: amiga.h,v 1.8 2002/03/24 13:25:43 swa Exp $"
+#ifndef _AMIGA_H
+#define _AMIGA_H
+#define AMIGA_H_VERSION "$Id: amiga.h,v 1.3 2001/05/25 21:53:27 jongfoster Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/amiga.h,v $
@@ -9,7 +9,7 @@
* Purpose : Amiga-specific declarations.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -31,23 +31,6 @@
*
* Revisions :
* $Log: amiga.h,v $
- * Revision 1.8 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.7 2002/03/03 09:18:03 joergs
- * Made jumbjuster work on AmigaOS again.
- *
- * Revision 1.6 2001/10/13 12:46:08 joergs
- * Added #undef EINTR to avoid warnings
- *
- * Revision 1.5 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.4 2001/05/29 20:05:06 joergs
- * Fixed exit() macro not exiting if called before InitAmiga()
- * (junkbuster --help and --version).
- *
* Revision 1.3 2001/05/25 21:53:27 jongfoster
* Fixing indentation
*
@@ -70,7 +53,6 @@
#undef __NOLIBBASE__
#define __CONSTLIBBASEDECL__ const
-#define DEVICES_TIMER_H
#include
#include
#include
@@ -116,8 +98,7 @@ __saveds ULONG server_thread(void);
} \
}
-#undef EINTR
#define EINTR 0
-#endif /* ndef AMIGA_H_INCLUDED */
+#endif /* ndef _AMIGA_H */
#endif /* def AMIGA */
diff --git a/basic.action b/basic.action
deleted file mode 100644
index 567f6b93..00000000
--- a/basic.action
+++ /dev/null
@@ -1,377 +0,0 @@
-######################################################################
-#
-# File : $Source: /cvsroot/ijbswa/current/basic.action,v $
-#
-# $Id: basic.action,v 1.3 2002/03/26 22:29:54 swa Exp $
-#
-# Purpose : Very basic actions file, see
-# http://www.privoxy.org/faq/questions.html#CONFIGFILES
-#
-# Copyright : Written by and Copyright
-# Privoxy team. http://www.privoxy.org/
-#
-# Based on the Internet Junkbuster originally written
-# by and Copyright (C) 1997 Anonymous Coders and
-# Junkbusters Corporation. http://www.junkbusters.com
-#
-# We value your feedback. However, to provide you with the best support,
-# please note:
-#
-# * Use the support forum to get help:
-# http://sourceforge.net/tracker/?group_id=11118&atid=211118
-# * Submit bugs only thru our bug forum:
-# http://sourceforge.net/tracker/?group_id=11118&atid=111118
-# Make sure that the bug has not already been submitted. Please try
-# to verify that it is a Junkbuster bug, and not a browser or site
-# bug first. If you are using your own custom configuration, please
-# try the stock configs to see if the problem is a configuration
-# related bug. And if not using the latest development snapshot,
-# please try the latest one. Or even better, CVS sources.
-# * Submit feature requests only thru our feature request forum:
-# http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse
-#
-# For any other issues, feel free to use the mailing lists:
-# http://sourceforge.net/mail/?group_id=11118
-#
-# Anyone interested in actively participating in development and related
-# discussions can join the appropriate mailing list here:
-# http://sourceforge.net/mail/?group_id=11118. Archives are available
-# here too.
-#
-######################################################################
-
-######################################################################
-# Aliases
-######################################################################
-{{alias}}
-+imageblock = +block +image
-
-######################################################################
-# Defaults
-######################################################################
-{\
-+deanimate-gifs{last} \
-+image-blocker{trans} \
-+hide-referer{forge} \
-+no-cookies-keep \
--filter \
-}
-/ # Match all URLs
-
-
-######################################################################
-# Specials
-######################################################################
-{+image}
-#############################################################################
-/.*\.gif
-/.*\.jpe?g
-/.*\.png
-
-#############################################################################
-{+imageblock}
-#############################################################################
-.ad.doubleclick.net
-.adforce.imgis.com
-.focalink.com
-
-######################################################################
-# Blocklist:
-######################################################################
-{+block}
-#############################################################################
-
-# generic hosts (probably most effective)
-ad*.
-.*ads.
-banner.
-
-/.*/(.*[-_.])?ads?[0-9]?(/|[-_.].*|\.(gif|jpe?g))
-/.*/(.*[-_.])?count(er)?(\.cgi|\.dll|\.exe|[?/])
-/.*/(ng)?adclient\.cgi
-/.*/(plain|live|rotate)[-_.]?ads?/
-/.*/(sponsor)s?[0-9]?/
-/?.*/_?(plain|live)?ads?(-banners)?/
-/?.*/abanners/
-/?.*/ad(sdna_image|gifs?)/
-/?.*/ad(server|stream|juggler)\.(cgi|pl|dll|exe)
-/?.*/adbanners/
-/?.*/adserver
-/?.*/adstream\.cgi
-/?.*/adv((er)?ts?|ertis(ing|ements?))?/
-/?.*/anzei(gen)?/?
-/?.*/ban[-_]cgi/
-/?.*/banner_?ads/
-/?.*/banner_?anzeigen
-/?.*/bannerimage/
-/?.*/banners?/
-/?.*/banners?\.cgi/
-/?.*/cgi-bin/centralad/getimage
-/?.*/images/addver\.gif
-/?.*/images/advert\.gif
-/?.*/images/marketing/.*\.(gif|jpe?g)
-/?.*/place-ads
-/?.*/popupads/
-/?.*/promobar.*
-/?.*/publicite/
-/?.*/randomads/.*\.(gif|jpe?g)
-/?.*/rekla(ma|me|am)/.*\.(gif|jpe?g)
-/?.*/siteads/
-/?.*/sponsor.*\.gif
-/?.*/sponsors?[0-9]?/
-/?.*/ucbandeimg/
-/?.*/werb\..*
-/?.*/werbebanner/
-/?.*/werbung/.*\.(gif|jpe?g)
-/?.*/adv\. # www.telegraaf.nl
-/?.*/advert[0-9]+\.jpg
-/?.*bann\.gif
-/?.*/ads/
-/_banner/
-/ad_images/
-/adgenius/
-/adimages/
-/viewad/
-/adserve/
-/adverts/
-/annonser?/
-/bando/
-/bannerad/
-/bannerfarm/
-/bin/getimage.cgi/...\?AD
-/bin/nph-oma.count/ct/default.shtml
-/bin/nph-oma.count/ix/default.html
-/cgi-bin/getimage.cgi/....\?GROUP=
-/cgi-bin/nph-load
-/cgi-bin/webad.dll/ad
-/cwmail/acc\.gif
-/cwmail/amzn-bm1\.gif
-/db_area/banrgifs/
-/gif/teasere/
-/grafikk/annonse/
-/graphics/defaultAd/
-/grf/annonif
-/htmlad/
-/image\.ng/AdType
-/image\.ng/transactionID
-/images/.*/.*_anim\.gif # alvin brattli
-/ip_img/.*\.(gif|jpe?g)
-/marketpl*/
-/minibanners/
-/netscapeworld/nw-ad/
-/promotions/houseads/
-/rotads/
-/rotateads/
-/rotations/
-/torget/jobline/.*\.gif
-/viewad/
-/werbung/
-/worldnet/ad\.cgi
-/zhp/auktion/img/
-/cgi-bin/nph-adclick.exe/
-/?.*/Image/BannerAdvertising/
-/?.*/ad-bin/
-/?.*/adlib/server\.cgi
-/?.*/gsa_bs/gsa_bs.cmdl
-/autoads/
-/anz/pics/
-# for our finnish friends, by Kai Puolamaki
-/?.*/mainos/*.*/.*\.gif
-/?.*/mainos/*.*/.*\.jpe?g
-# more from a finnish friend Petri Haapio
-/?.*/(.*[-_.].*)?maino(kset|nta|s).*(/|\.(gif|html?|jpe?g|png))
-/?.*/(ilm(oitus)?|kampanja)(hallinta|kuvat?)(/|\.(gif|html?|jpe?g|png))
-#
-/?.*/adfinity
-/?.*/[?]adserv
-/?.*/bizgrphx/
-/?.*/smallad2\.gif
-/?.*/ana2ad\.gif
-/?.*/adimg/
-/?.*/.*counter\.pl
-/?.*/spin_html/
-/?.*/images/topics/topicgimp\.gif
-.discovery.com/.*banner_id
-/?.*/.*bannr\.gif
-.cruel.com/images/
-.idrink.com/frm_bottom.htm
-/?.*/.*pb_ihtml\.gif
-/?.*/ph-ad.*\.focalink\.com
-/cgi-bin/adjuggler
-
-# ms sucks !
-/.*(ms)?backoff(ice)?.*\.(gif|jpe?g)
-/.*(/ie4|/ie3|msie|sqlbans|powrbybo|activex|backoffice|explorer|netnow|getpoint|ntbutton|hmlink).*\.(gif|jpe?g)
-/.*activex.*(gif|jpe?g)
-/.*explorer?.(gif|jpe?g)
-/.*freeie\.(gif|jpe?g)
-/.*/ie_?(buttonlogo|static?|anim.*)?\.(gif|jpe?g)
-/.*ie_sm\.(gif|jpe?g)
-/.*msie(30)?\.(gif|jpe?g)
-/.*msnlogo\.(gif|jpe?g)
-/.*office97_ad1\.(gif|jpe?g)
-/.*pbbobansm\.(gif|jpe?g)
-/.*powrbybo\.(gif|jpe?g)
-/.*sqlbans\.(gif|jpe?g)
-/.*exc_ms\.gif
-/.*ie4get_animated\.gif
-/.*ie4_animated\.gif
-/.*n_iemap\.gif
-/.*ieget\.gif
-/.*logo_msnhm_*
-/.*mcsp2\.gif
-/.*msn2\.gif
-/.*add_active\.gif
-/.*n_msnmap\.gif
-/.*Ad00\.gif
-/.*s_msn\.gif
-/.*addchannel\.gif
-/.*adddesktop\.gif
-/?.*/ns4\.gif
-/?.*/v3sban\.gif
-/?.*/?FPCreated\.gif
-/?.*/opera35\.gif
-/?.*/opera13\.gif
-/?.*/opera_b\.gif
-/?.*/ie_horiz\.gif
-/?.*/ie_logo\.gif
-# ... and even more!
-/?.*/favicon\.ico
-
-/?.*/images/na/us/brand/
-/?.*/advantage\.(gif|jpg)
-/?.*/advanbar\.(gif|jpg)
-/?.*/advanbtn\.(gif|jpg)
-/?.*/biznetsmall\.(gif|jpg)
-/?.*/utopiad\.(gif|jpg)
-/?.*/epipo\.(gif|jpg)
-/?.*/amazon([a-zA-Z0-9]+)\.(gif|jpg)
-/?.*/bnlogo.(gif|jpg)
-/?.*/buynow([a-zA-Z0-9]+)\.(gif|jpg)
-
-# for the dutch folks by a dutch friend gertjan@west.nl
-/?.*/Advertenties/
-/?.*/Adverteerders/
-.netdirect.nl/nd_servlet/___
-
-.admaximize.com
-.imgis.com
-
-# wayne@staff.msen.com
-a*.*.*.yimg.com/([0-9]*|\/)*us.yimg.com/*
-
-####################################################
-# Jon's addition:
-#
-# The Register ads - oh, and all images in Register stories (sigh).
-www.theregister.co.uk/media/
-
-# Used on http://www.theregister.co.uk/
-# Sample advert URL:
-# http://secure.webconnect.net/cgi-bin/webconnecthome.dll?F467
-.webconnect.net
-
-# Dilbert:
-www.dilbert.com/comics/dilbert/images/.*_140x800.*\.gif
-
-# stattrack.com
-# Uses URL: http://www.stattrack.com/cgi-bin/stats/image.cgi
-/cgi-bin/stats/
-# And loads JavaScript from http://www.stattrack.com/stats/code
-www.stattrack.com/stats/
-
-#Now they're Yahoo GeoCities, their junk is in a different place.
-##geo.yahoo.com/serv
-##visit.geocities.com/visit.gif
-.yimg.com/?.*/www.geocities.com/js_source
-#http://us.toto.geo.yahoo.com/toto?s=76001086
-.geo.yahoo.com
-.visit.geocities.com
-.yimg.com/?.*/www.geocities.com/
-
-.exitexchange.com
-
-#SourceForge ads.
-sfads.osdn.com
-
-#This site traps the browser
-.webhideout.com
-
-#privacy.net runs ads
-.a.consumer.net
-
-#Lindsay.Marshall@newcastle.ac.uk suggested these, to kill Opera adverts:
-www.qksrv.net
-mirror.qkimg.net
-
-#js
-dinoadserver*.roka.net
-logout.gmx.net
-logout.tvspielfilm.de
-gmx.tvspielfilm.de
-www.freenet.de/customerindex\.html
-/?.*/phpAds
-.fxweb.com/v2-trackrun\.cgi
-rtldating.peopleunited.de
-.advertising.com
-www.zdnet.com/fcgi-bin/
-service.bfast.com/bfast/serve
-199.172.144.25
-fourohfour.nbci.com/Members404Error.php3
-.adtech.de
-.adlink.de
-www.fair-ist-mehr.de/cgi-bin/bt.pl
-.linkexchange.
-/?.*/adpage.asp
-/ADS
-.net-on.net
-rstrip.namezero.com
-62.26.220.2
-.doubleclick.net
-.adserver.yahoo.com
-
-#############################################################################
-{-block}
-#############################################################################
-.admin.
-.edu
-.ac.uk # English Universities too! - Jon
-.uni-*.de # What about Germany? --oes
-# my banking stuff => no ads.
-.comdirekt.de
-.comdirect.de
-.teledata.de
-# Jon's addition: MSDN
-.msdn.microsoft.com
-# .*ads. matches prdownloads.sourceforge.net and many other download sites
-# The fix is:
-.*downloads.
-
-######################################################################
-#
-# Copyright : Written by and Copyright (C) 2001 the SourceForge
-# Privoxy team. http://www.privoxy.org/
-#
-# Based on the Internet Junkbuster originally written
-# by and Copyright (C) 1997 Anonymous Coders and
-# Junkbusters Corporation. http://www.junkbusters.com
-#
-# 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.
-#
-######################################################################
diff --git a/cgi.c b/cgi.c
index a5694414..60806b16 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,18 +1,16 @@
-const char cgi_rcs[] = "$Id: cgi.c,v 1.56 2002/03/24 17:50:46 jongfoster Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.10 2001/07/13 13:53:13 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
*
* Purpose : Declares functions to intercept request, generate
* html or gif answers, and to compose HTTP resonses.
- * This only contains the framework functions, the
- * actual handler functions are declared elsewhere.
*
* Functions declared include:
*
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -38,212 +36,6 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.56 2002/03/24 17:50:46 jongfoster Exp $";
*
* Revisions :
* $Log: cgi.c,v $
- * Revision 1.56 2002/03/24 17:50:46 jongfoster
- * Fixing compile error if actions file editor disabled
- *
- * Revision 1.55 2002/03/24 16:55:06 oes
- * Making GIF checkerboard transparent
- *
- * Revision 1.54 2002/03/24 16:18:15 jongfoster
- * Removing old logo
- *
- * Revision 1.53 2002/03/24 16:06:00 oes
- * Correct transparency for checkerboard PNG. Thanks, Magnus!
- *
- * Revision 1.52 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.51 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.50 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.49 2002/03/13 00:27:04 jongfoster
- * Killing warnings
- *
- * Revision 1.48 2002/03/08 17:47:07 jongfoster
- * Adding comments
- *
- * Revision 1.47 2002/03/08 16:41:33 oes
- * Added GIF images again
- *
- * Revision 1.46 2002/03/07 03:48:38 oes
- * - Changed built-in images from GIF to PNG
- * (with regard to Unisys patent issue)
- * - Added a 4x4 pattern PNG which is less intrusive
- * than the logo but also clearly marks the deleted banners
- *
- * Revision 1.45 2002/03/06 22:54:35 jongfoster
- * Automated function-comment nitpicking.
- *
- * Revision 1.44 2002/03/05 22:43:45 david__schmidt
- * - Better error reporting on OS/2
- * - Fix double-slash comment (oops)
- *
- * Revision 1.43 2002/03/05 21:33:45 david__schmidt
- * - Re-enable OS/2 building after new parms were added
- * - Fix false out of memory report when resolving CGI templates when no IP
- * address is available of failed attempt (a la no such domain)
- *
- * Revision 1.42 2002/01/21 00:33:20 jongfoster
- * Replacing strsav() with the safer string_append() or string_join().
- * Adding map_block_keep() to save a few bytes in the edit-actions-list HTML.
- * Adding missing html_encode() to error message generators.
- * Adding edit-actions-section-swap and many "shortcuts" to the list of CGIs.
- *
- * Revision 1.41 2002/01/17 20:56:22 jongfoster
- * Replacing hard references to the URL of the config interface
- * with #defines from project.h
- *
- * Revision 1.40 2002/01/09 14:26:46 oes
- * Added support for thread-safe gmtime_r call.
- *
- * Revision 1.39 2001/11/16 00:48:13 jongfoster
- * Fixing a compiler warning
- *
- * Revision 1.38 2001/11/13 00:31:21 jongfoster
- * - Adding new CGIs for use by non-JavaScript browsers:
- * edit-actions-url-form
- * edit-actions-add-url-form
- * edit-actions-remove-url-form
- * - Fixing make_menu()'s HTML generation - it now quotes the href parameter.
- * - Fixing || bug.
- *
- * Revision 1.37 2001/11/01 14:28:47 david__schmidt
- * Show enablement/disablement status in almost all templates.
- * There is a little trickiness here: apparent recursive resolution of
- * @if-enabled-then@ caused the toggle template to show status out-of-phase with
- * the actual enablement status. So a similar construct,
- * @if-enabled-display-then@, is used to resolve the status display on non-'toggle'
- * templates.
- *
- * Revision 1.36 2001/10/26 17:33:27 oes
- * marginal bugfix
- *
- * Revision 1.35 2001/10/23 21:48:19 jongfoster
- * Cleaning up error handling in CGI functions - they now send back
- * a HTML error page and should never cause a FATAL error. (Fixes one
- * potential source of "denial of service" attacks).
- *
- * CGI actions file editor that works and is actually useful.
- *
- * Ability to toggle JunkBuster remotely using a CGI call.
- *
- * You can turn off both the above features in the main configuration
- * file, e.g. if you are running a multi-user proxy.
- *
- * Revision 1.34 2001/10/18 22:22:09 david__schmidt
- * Only show "Local support" on templates conditionally:
- * - if either 'admin-address' or 'proxy-info-url' are uncommented in config
- * - if not, no Local support section appears
- *
- * Revision 1.33 2001/10/14 22:28:41 jongfoster
- * Fixing stupid typo.
- *
- * Revision 1.32 2001/10/14 22:20:18 jongfoster
- * - Changes to CGI dispatching method to match CGI names exactly,
- * rather than doing a prefix match.
- * - No longer need to count the length of the CGI handler names by hand.
- * - Adding new handler for 404 error when disptching a CGI, if none of
- * the handlers match.
- * - Adding new handlers for CGI actionsfile editor.
- *
- * Revision 1.31 2001/10/10 10:56:39 oes
- * Failiure to load template now fatal. Before, the user got a hard-to-understand assertion failure from cgi.c
- *
- * Revision 1.30 2001/10/02 15:30:57 oes
- * Introduced show-request cgi
- *
- * Revision 1.29 2001/09/20 15:47:44 steudten
- *
- * Fix BUG: Modify int size to size_t size in fill_template()
- * - removes big trouble on machines where sizeof(int) != sizeof(size_t).
- *
- * Revision 1.28 2001/09/19 18:00:37 oes
- * - Deletef time() FIXME (Can't fail under Linux either, if
- * the argument is guaranteed to be in out address space,
- * which it is.)
- * - Fixed comments
- * - Pointer notation cosmetics
- * - Fixed a minor bug in template_fill(): Failiure of
- * pcrs_execute() now secure.
- *
- * Revision 1.27 2001/09/16 17:08:54 jongfoster
- * Moving simple CGI functions from cgi.c to new file cgisimple.c
- *
- * Revision 1.26 2001/09/16 15:47:37 jongfoster
- * First version of CGI-based edit interface. This is very much a
- * work-in-progress, and you can't actually use it to edit anything
- * yet. You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
- * to have any effect.
- *
- * Revision 1.25 2001/09/16 15:02:35 jongfoster
- * Adding i.j.b/robots.txt.
- * Inlining add_stats() since it's only ever called from one place.
- *
- * Revision 1.24 2001/09/16 11:38:01 jongfoster
- * Splitting fill_template() into 2 functions:
- * template_load() loads the file
- * template_fill() performs the PCRS regexps.
- * This is because the CGI edit interface has a "table row"
- * template which is used many times in the page - this
- * change means it's only loaded from disk once.
- *
- * Revision 1.23 2001/09/16 11:16:05 jongfoster
- * Better error handling in dispatch_cgi() and parse_cgi_parameters()
- *
- * Revision 1.22 2001/09/16 11:00:10 jongfoster
- * New function alloc_http_response, for symmetry with free_http_response
- *
- * Revision 1.21 2001/09/13 23:53:03 jongfoster
- * Support for both static and dynamically generated CGI pages.
- * Correctly setting Last-Modified: and Expires: HTTP headers.
- *
- * Revision 1.20 2001/09/13 23:40:36 jongfoster
- * (Cosmetic only) Indentation correction
- *
- * Revision 1.19 2001/09/13 23:31:25 jongfoster
- * Moving image data to cgi.c rather than cgi.h.
- *
- * Revision 1.18 2001/08/05 16:06:20 jongfoster
- * Modifiying "struct map" so that there are now separate header and
- * "map_entry" structures. This means that functions which modify a
- * map no longer need to return a pointer to the modified map.
- * Also, it no longer reverses the order of the entries (which may be
- * important with some advanced template substitutions).
- *
- * Revision 1.17 2001/08/05 15:57:38 oes
- * Adapted finish_http_response to new list_to_text
- *
- * Revision 1.16 2001/08/01 21:33:18 jongfoster
- * Changes to fill_template() that reduce memory usage without having
- * an impact on performance. I also renamed some variables so as not
- * to clash with the C++ keywords "new" and "template".
- *
- * Revision 1.15 2001/08/01 21:19:22 jongfoster
- * Moving file version information to a separate CGI page.
- *
- * Revision 1.14 2001/08/01 00:19:03 jongfoster
- * New function: map_conditional() for an if-then-else syntax.
- * Changing to use new version of show_defines()
- *
- * Revision 1.13 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.12 2001/07/29 18:47:05 jongfoster
- * Adding missing #include "loadcfg.h"
- *
- * Revision 1.11 2001/07/18 17:24:37 oes
- * Changed to conform to new pcrs interface
- *
* Revision 1.10 2001/07/13 13:53:13 oes
* Removed all #ifdef PCRS and related code
*
@@ -332,7 +124,6 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.56 2002/03/24 17:50:46 jongfoster Exp $";
#include
#include
#include
-#include
#ifdef _WIN32
#define snprintf _snprintf
@@ -343,196 +134,42 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.56 2002/03/24 17:50:46 jongfoster Exp $";
#include "list.h"
#include "encode.h"
#include "ssplit.h"
+#include "jcc.h"
+#include "filters.h"
+#include "actions.h"
#include "errlog.h"
#include "miscutil.h"
-#include "cgisimple.h"
-#ifdef FEATURE_CGI_EDIT_ACTIONS
-#include "cgiedit.h"
-#endif /* def FEATURE_CGI_EDIT_ACTIONS */
-#include "loadcfg.h"
-/* loadcfg.h is for g_bToggleIJB only */
+#include "showargs.h"
const char cgi_h_rcs[] = CGI_H_VERSION;
-static const struct cgi_dispatcher cgi_dispatchers[] = {
- { "",
- cgi_default,
- "Privoxy main page" },
-#ifdef FEATURE_GRACEFUL_TERMINATION
- { "die",
- cgi_die,
- "Shut down - Do not deploy this build in a production environment, this is a one click Denial Of Service attack!!!" },
-#endif
+const struct cgi_dispatcher cgi_dispatcher[] = {
{ "show-status",
- cgi_show_status,
- "Show information about the current configuration" },
- { "show-version",
- cgi_show_version,
- "Show the source code version numbers" },
- { "show-request",
- cgi_show_request,
- "Show the client's request headers." },
+ 11, cgi_show_status,
+ "Show information about the version and configuration" },
{ "show-url-info",
- cgi_show_url_info,
+ 13, cgi_show_url_info,
"Show which actions apply to a URL and why" },
-#ifdef FEATURE_CGI_EDIT_ACTIONS
- { "toggle",
- cgi_toggle,
- "Toggle Privoxy on or off" },
- { "edit-actions",
- cgi_edit_actions,
- "Edit the actions list" },
-
-
- { "eaa", /* Shortcut for edit-actions-add-url-form */
- cgi_edit_actions_add_url_form,
- NULL },
- { "eau", /* Shortcut for edit-actions-url-form */
- cgi_edit_actions_url_form,
- NULL },
- { "ear", /* Shortcut for edit-actions-remove-url-form */
- cgi_edit_actions_remove_url_form,
- NULL },
- { "eas", /* Shortcut for edit-actions-for-url */
- cgi_edit_actions_for_url,
- NULL },
- { "easa", /* Shortcut for edit-actions-section-add */
- cgi_edit_actions_section_add,
- NULL },
- { "easr", /* Shortcut for edit-actions-section-remove */
- cgi_edit_actions_section_remove,
- NULL },
- { "eass", /* Shortcut for edit-actions-section-swap */
- cgi_edit_actions_section_swap,
- NULL },
- { "edit-actions-for-url",
- cgi_edit_actions_for_url,
- NULL /* Edit the actions for (a) specified URL(s) */ },
- { "edit-actions-list",
- cgi_edit_actions_list,
- NULL /* Edit the actions list */ },
- { "edit-actions-submit",
- cgi_edit_actions_submit,
- NULL /* Change the actions for (a) specified URL(s) */ },
- { "edit-actions-url",
- cgi_edit_actions_url,
- NULL /* Change a URL pattern in the actionsfile */ },
- { "edit-actions-url-form",
- cgi_edit_actions_url_form,
- NULL /* Form to change a URL pattern in the actionsfile */ },
- { "edit-actions-add-url",
- cgi_edit_actions_add_url,
- NULL /* Add a URL pattern to the actionsfile */ },
- { "edit-actions-add-url-form",
- cgi_edit_actions_add_url_form,
- NULL /* Form to add a URL pattern to the actionsfile */ },
- { "edit-actions-remove-url",
- cgi_edit_actions_remove_url,
- NULL /* Remove a URL pattern from the actionsfile */ },
- { "edit-actions-remove-url-form",
- cgi_edit_actions_remove_url_form,
- NULL /* Form to remove a URL pattern from the actionsfile */ },
- { "edit-actions-section-add",
- cgi_edit_actions_section_add,
- NULL /* Remove a section from the actionsfile */ },
- { "edit-actions-section-remove",
- cgi_edit_actions_section_remove,
- NULL /* Remove a section from the actionsfile */ },
- { "edit-actions-section-swap",
- cgi_edit_actions_section_swap,
- NULL /* Swap two sections in the actionsfile */ },
-#endif /* def FEATURE_CGI_EDIT_ACTIONS */
- { "robots.txt",
- cgi_robots_txt,
- NULL /* Sends a robots.txt file to tell robots to go away. */ },
{ "send-banner",
- cgi_send_banner,
- NULL /* Send a built-in image */ },
- { "t",
- cgi_transparent_image,
- NULL /* Send a transparent image (short name) */ },
- { NULL, /* NULL Indicates end of list and default page */
- cgi_error_404,
- NULL /* Unknown CGI page */ }
+ 11, cgi_send_banner,
+ "HIDE Send the transparent or \"Junkbuster\" gif" },
+ { "",
+ 0, cgi_default,
+ "Junkbuster main page" },
+ { NULL, 0, NULL, NULL }
};
-/*
- * Bulit-in images for ad replacement
- *
- * Hint: You can encode your own images like this:
- * cat your-image | perl -e 'while (read STDIN, $c, 1) { printf("\\%.3o", unpack("C", $c)); }'
- */
-
-#ifdef FEATURE_NO_GIFS
-
-/*
- * Checkerboard pattern, as a PNG.
- */
-const char image_pattern_data[] =
- "\211\120\116\107\015\012\032\012\000\000\000\015\111\110\104"
- "\122\000\000\000\004\000\000\000\004\010\002\000\000\000\046"
- "\223\011\051\000\000\000\006\142\113\107\104\000\310\000\310"
- "\000\310\052\045\225\037\000\000\000\032\111\104\101\124\170"
- "\332\143\070\161\342\304\377\377\377\041\044\003\234\165\342"
- "\304\011\006\234\062\000\125\200\052\251\125\174\360\223\000"
- "\000\000\000\111\105\116\104\256\102\140\202";
-
-/*
- * 1x1 transparant PNG.
- */
-const char image_blank_data[] =
- "\211\120\116\107\015\012\032\012\000\000\000\015\111\110\104\122"
- "\000\000\000\004\000\000\000\004\010\006\000\000\000\251\361\236"
- "\176\000\000\000\007\164\111\115\105\007\322\003\013\020\073\070"
- "\013\025\036\203\000\000\000\011\160\110\131\163\000\000\013\022"
- "\000\000\013\022\001\322\335\176\374\000\000\000\004\147\101\115"
- "\101\000\000\261\217\013\374\141\005\000\000\000\033\111\104\101"
- "\124\170\332\143\070\161\342\304\207\377\377\377\347\302\150\006"
- "\144\016\210\146\040\250\002\000\042\305\065\221\270\027\131\110"
- "\000\000\000\000\111\105\116\104\256\102\140\202";
-#else
-
-/*
- * Checkerboard pattern, as a GIF.
- */
-const char image_pattern_data[] =
- "\107\111\106\070\071\141\004\000\004\000\200\000\000\310\310"
- "\310\377\377\377\041\376\016\111\040\167\141\163\040\141\040"
- "\142\141\156\156\145\162\000\041\371\004\001\012\000\001\000"
- "\054\000\000\000\000\004\000\004\000\000\002\005\104\174\147"
- "\270\005\000\073";
-
-/*
- * 1x1 transparant GIF.
- */
-const char image_blank_data[] =
- "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;";
-#endif
-
-const size_t image_pattern_length = sizeof(image_pattern_data) - 1;
-const size_t image_blank_length = sizeof(image_blank_data) - 1;
-
-
-static struct http_response cgi_error_memory_response[1];
-
-static struct http_response *dispatch_known_cgi(struct client_state * csp,
- const char * path);
-static struct map *parse_cgi_parameters(char *argstring);
-
-
/*********************************************************************
*
* Function : dispatch_cgi
*
- * Description : Checks if a request URL has either the magical
- * hostname CGI_SITE_1_HOST (usully http://i.j.b/) or
- * matches CGI_SITE_2_HOST CGI_SITE_2_PATH (usually
- * http://ijbswa.sourceforge.net/config). If so, it passes
- * the (rest of the) path onto dispatch_known_cgi, which
- * calls the relevant CGI handler function.
+ * Description : Checks if a request URL has either the magical hostname
+ * i.j.b or matches HOME_PAGE_URL/config/. If so, it parses
+ * the (rest of the) path as a cgi name plus query string,
+ * prepares a map that maps CGI parameter names to their values,
+ * initializes the http_response struct, and calls the
+ * relevant CGI handler function.
*
* Parameters :
* 1 : csp = Current client state (buffers, headers, etc...)
@@ -542,47 +179,31 @@ static struct map *parse_cgi_parameters(char *argstring);
*********************************************************************/
struct http_response *dispatch_cgi(struct client_state *csp)
{
- const char *host = csp->http->host;
- const char *path = csp->http->path;
+ char *argstring = NULL;
+ const struct cgi_dispatcher *d;
+ struct map *param_list;
+ struct http_response *rsp;
/*
* Should we intercept ?
*/
- /* Note: "example.com" and "example.com." are equivalent hostnames. */
-
- /* Either the host matches CGI_SITE_1_HOST ..*/
- if ( ( (0 == strcmpic(host, CGI_SITE_1_HOST))
- || (0 == strcmpic(host, CGI_SITE_1_HOST ".")))
- && (path[0] == '/') )
+ /* Either the host matches CGI_PREFIX_HOST ..*/
+ if (0 == strcmpic(csp->http->host, CGI_PREFIX_HOST))
{
- /* ..then the path will all be for us. Remove leading '/' */
- path++;
+ /* ..then the path will all be for us */
+ argstring = csp->http->path;
}
- /* Or it's the host part CGI_SITE_2_HOST, and the path CGI_SITE_2_PATH */
- else if ( ( (0 == strcmpic(host, CGI_SITE_2_HOST ))
- || (0 == strcmpic(host, CGI_SITE_2_HOST ".")) )
- && (0 == strncmpic(path, CGI_SITE_2_PATH, strlen(CGI_SITE_2_PATH))) )
+ /* Or it's the host part HOME_PAGE_URL, and the path /config ? */
+ else if ( (0 == strcmpic(csp->http->host, HOME_PAGE_URL + 7 ))
+ && (0 == strncmpic(csp->http->path,"/config", 7))
+ && ((csp->http->path[7] == '/') || (csp->http->path[7] == '\0')))
{
- /* take everything following CGI_SITE_2_PATH */
- path += strlen(CGI_SITE_2_PATH);
- if (*path == '/')
- {
- /* skip the forward slash after CGI_SITE_2_PATH */
- path++;
- }
- else if (*path != '\0')
- {
- /*
- * wierdness: URL is /configXXX, where XXX is some string
- * Do *NOT* intercept.
- */
- return NULL;
- }
+ /* then it's everything following "/config" */
+ argstring = csp->http->path + 7;
}
else
{
- /* Not a CGI */
return NULL;
}
@@ -590,74 +211,16 @@ struct http_response *dispatch_cgi(struct client_state *csp)
* This is a CGI call.
*/
- return dispatch_known_cgi(csp, path);
-}
-
-
-/*********************************************************************
- *
- * Function : dispatch_known_cgi
- *
- * Description : Processes a CGI once dispatch_cgi has determined that
- * it matches one of the magic prefixes. Parses the path
- * as a cgi name plus query string, prepares a map that
- * maps CGI parameter names to their values, initializes
- * the http_response struct, and calls the relevant CGI
- * handler function.
- *
- * Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- * 2 : path = Path of CGI, with the CGI prefix removed.
- * Should not have a leading "/".
- *
- * Returns : http_response, or NULL on handler failure or out of
- * memory.
- *
- *********************************************************************/
-static struct http_response *dispatch_known_cgi(struct client_state * csp,
- const char * path)
-{
- const struct cgi_dispatcher *d;
- struct map *param_list;
- struct http_response *rsp;
- char *query_args_start;
- char *path_copy;
- jb_err err;
-
- if (NULL == (path_copy = strdup(path)))
- {
- return cgi_error_memory();
- }
-
- query_args_start = path_copy;
- while (*query_args_start && *query_args_start != '?')
- {
- query_args_start++;
- }
- if (*query_args_start == '?')
- {
- *query_args_start++ = '\0';
- }
-
- if (NULL == (param_list = parse_cgi_parameters(query_args_start)))
+ /* Get mem for response or fail*/
+ if (NULL == ( rsp = zalloc(sizeof(*rsp))))
{
- free(path_copy);
- return cgi_error_memory();
+ return NULL;
}
-
- /*
- * At this point:
- * path_copy = CGI call name
- * param_list = CGI params, as map
- */
-
- /* Get mem for response or fail*/
- if (NULL == (rsp = alloc_http_response()))
+ /* Remove leading slash */
+ if (*argstring == '/')
{
- free(path_copy);
- free_map(param_list);
- return cgi_error_memory();
+ argstring++;
}
log_error(LOG_LEVEL_GPC, "%s%s cgi call", csp->http->hostport, csp->http->path);
@@ -665,32 +228,25 @@ static struct http_response *dispatch_known_cgi(struct client_state * csp,
csp->ip_addr_str, csp->http->cmd);
/* Find and start the right CGI function*/
- d = cgi_dispatchers;
- for (;;)
+ for (d = cgi_dispatcher; d->handler; d++)
{
- if ((d->name == NULL) || (strcmp(path_copy, d->name) == 0))
+ if (strncmp(argstring, d->name, d->name_length) == 0)
{
- err = (d->handler)(csp, rsp, param_list);
- free(path_copy);
- free_map(param_list);
- if (err == JB_ERR_CGI_PARAMS)
- {
- err = cgi_error_bad_param(csp, rsp);
- }
- if (!err)
- {
- /* It worked */
- return finish_http_response(rsp);
- }
- else
+ param_list = parse_cgi_parameters(argstring + d->name_length);
+ if ((d->handler)(csp, rsp, param_list))
{
- /* Error in handler, probably out-of-memory */
- free_http_response(rsp);
- return cgi_error_memory();
+ freez(rsp);
}
+
+ free_map(param_list);
+ return(finish_http_response(rsp));
}
- d++;
}
+
+ /* Can't get here, since cgi_default will match all requests */
+ freez(rsp);
+ return(NULL);
+
}
@@ -702,361 +258,513 @@ static struct http_response *dispatch_known_cgi(struct client_state * csp,
* pairs and store them in a struct map list.
*
* Parameters :
- * 1 : string = string to be parsed. Will be trashed.
+ * 1 : string = string to be parsed
*
- * Returns : pointer to param list, or NULL if out of memory.
+ * Returns : poniter to param list, or NULL if failiure
*
*********************************************************************/
-static struct map *parse_cgi_parameters(char *argstring)
+struct map *parse_cgi_parameters(char *argstring)
{
- char *p;
+ char *tmp, *p;
char *vector[BUFFER_SIZE];
int pairs, i;
- struct map *cgi_params;
+ struct map *cgi_params = NULL;
- if (NULL == (cgi_params = new_map()))
- {
- return NULL;
- }
+ if(*argstring == '?') argstring++;
+ tmp = strdup(argstring);
- pairs = ssplit(argstring, "&", vector, SZ(vector), 1, 1);
+ pairs = ssplit(tmp, "&", vector, SZ(vector), 1, 1);
for (i = 0; i < pairs; i++)
{
if ((NULL != (p = strchr(vector[i], '='))) && (*(p+1) != '\0'))
{
*p = '\0';
- if (map(cgi_params, url_decode(vector[i]), 0, url_decode(++p), 0))
- {
- free_map(cgi_params);
- return NULL;
- }
+ cgi_params = map(cgi_params, url_decode(vector[i]), 0, url_decode(++p), 0);
}
}
- return cgi_params;
+ free(tmp);
+ return(cgi_params);
}
/*********************************************************************
*
- * Function : error_response
- *
- * Description : returns an http_response that explains the reason
- * why a request failed.
+ * Function : cgi_default
*
+ * Description : CGI function that is called if no action was given.
+ * Lists menu of available unhidden CGIs.
+ *
* Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- * 2 : templatename = Which template should be used for the answer
- * 3 : sys_err = system error number
+ * 1 : csp = Current client state (buffers, headers, etc...)
+ * 2 : rsp = http_response data structure for output
+ * 3 : parameters = map of cgi parameters
*
- * Returns : A http_response. If we run out of memory, this
- * will be cgi_error_memory().
+ * Returns : 0
*
*********************************************************************/
-struct http_response *error_response(struct client_state *csp,
- const char *templatename,
- int sys_err)
+int cgi_default(struct client_state *csp, struct http_response *rsp,
+ struct map *parameters)
{
- jb_err err;
- struct http_response *rsp;
- struct map * exports = default_exports(csp, NULL);
- if (exports == NULL)
- {
- return cgi_error_memory();
- }
-
- if (NULL == (rsp = alloc_http_response()))
- {
- free_map(exports);
- return cgi_error_memory();
- }
-
- err = map(exports, "host", 1, html_encode(csp->http->host), 0);
- if (!err) err = map(exports, "hostport", 1, html_encode(csp->http->hostport), 0);
- if (!err) err = map(exports, "path", 1, html_encode(csp->http->path), 0);
- if (!err) err = map(exports, "error", 1, html_encode_and_free_original(safe_strerror(sys_err)), 0);
- if (!err)
- {
- err = map(exports, "host-ip", 1, html_encode(csp->http->host_ip_addr_str), 0);
- if (err)
- {
- /* Some failures, like "404 no such domain", don't have an IP address. */
- err = map(exports, "host-ip", 1, html_encode(csp->http->host), 0);
- }
- }
+ char *p, *tmp = NULL;
+ struct map *exports = default_exports(csp, "");
-
- if (err)
+ /* If there were other parameters, export a dump as "cgi-parameters" */
+ if(parameters)
{
- free_map(exports);
- free_http_response(rsp);
- return cgi_error_memory();
+ p = dump_map(parameters);
+ tmp = strsav(tmp, "
What made you think this cgi takes parameters?\n"
+ "Anyway, here they are, in case you're interested:
\n");
+ tmp = strsav(tmp, p);
+ exports = map(exports, "cgi-parameters", 1, tmp, 0);
+ free(p);
}
-
- if (!strcmp(templatename, "no-such-domain"))
- {
- rsp->status = strdup("404 No such domain");
- if (rsp->status == NULL)
- {
- free_map(exports);
- free_http_response(rsp);
- return cgi_error_memory();
- }
- }
- else if (!strcmp(templatename, "connect-failed"))
+ else
{
- rsp->status = strdup("503 Connect failed");
- if (rsp->status == NULL)
- {
- free_map(exports);
- free_http_response(rsp);
- return cgi_error_memory();
- }
+ exports = map(exports, "cgi-parameters", 1, "", 1);
}
- err = template_fill_for_cgi(csp, templatename, exports, rsp);
- if (err)
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
+ rsp->body = fill_template(csp, "default", exports);
+ free_map(exports);
+ return(0);
- return finish_http_response(rsp);
}
/*********************************************************************
*
- * Function : cgi_init_error_messages
+ * Function : cgi_send_banner
*
- * Description : Call at the start of the program to initialize
- * the error message used by cgi_error_memory().
+ * Description : CGI function that returns a banner.
*
- * Parameters : N/A
+ * Parameters :
+ * 1 : csp = Current client state (buffers, headers, etc...)
+ * 2 : rsp = http_response data structure for output
+ * 3 : parameters = map of cgi parameters
*
- * Returns : N/A
+ * CGI Parameters :
+ * type : Selects the type of banner between "trans" and "jb".
+ * Defaults to "jb" if absent or != "trans".
+ *
+ * Returns : 0
*
*********************************************************************/
-void cgi_init_error_messages(void)
+int cgi_send_banner(struct client_state *csp, struct http_response *rsp,
+ struct map *parameters)
{
- memset(cgi_error_memory_response, '\0', sizeof(*cgi_error_memory_response));
- cgi_error_memory_response->head =
- "HTTP/1.0 500 Internal Privoxy Error\r\n"
- "Content-Type: text/html\r\n"
- "\r\n";
- cgi_error_memory_response->body =
- "\r\n"
- "500 Internal Privoxy Error\r\n"
- "\r\n"
- "
500 Internal Privoxy Error
\r\n"
- "
Privoxy ran out of memory while processing your request.
\r\n"
- "
Please contact your proxy administrator, or try again later
\r\n"
- "\r\n"
- "\r\n";
-
- cgi_error_memory_response->head_length =
- strlen(cgi_error_memory_response->head);
- cgi_error_memory_response->content_length =
- strlen(cgi_error_memory_response->body);
-}
+ if(strcmp(lookup(parameters, "type"), "trans"))
+ {
+ rsp->body = bindup(JBGIF, sizeof(JBGIF));
+ rsp->content_length = sizeof(JBGIF);
+ }
+ else
+ {
+ rsp->body = bindup(BLANKGIF, sizeof(BLANKGIF));
+ rsp->content_length = sizeof(BLANKGIF);
+ }
+ enlist(rsp->headers, "Content-Type: image/gif");
-/*********************************************************************
- *
- * Function : cgi_error_memory
- *
- * Description : Called if a CGI function runs out of memory.
- * Returns a statically-allocated error response.
- *
- * Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- * 2 : rsp = http_response data structure for output
- * 3 : template_name = Name of template that could not
- * be loaded.
- *
- * Returns : JB_ERR_OK on success
- * JB_ERR_MEMORY on out-of-memory error.
- *
- *********************************************************************/
-struct http_response *cgi_error_memory(void)
-{
- /* assert that it's been initialized. */
- assert(cgi_error_memory_response->head);
+ return(0);
- return cgi_error_memory_response;
}
/*********************************************************************
*
- * Function : cgi_error_no_template
+ * Function : cgi_show_status
*
- * Description : Almost-CGI function that is called if a templae
- * cannot be loaded. Note this is not a true CGI,
- * it takes a template name rather than a map of
- * parameters.
+ * Description : CGI function that returns a a web page describing the
+ * current status of IJB.
*
* Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- * 2 : rsp = http_response data structure for output
- * 3 : template_name = Name of template that could not
- * be loaded.
+ * 1 : csp = Current client state (buffers, headers, etc...)
+ * 2 : rsp = http_response data structure for output
+ * 3 : parameters = map of cgi parameters
+ *
+ * CGI Parameters :
+ * type : Selects the type of banner between "trans" and "jb".
+ * Defaults to "jb" if absent or != "trans".
*
- * Returns : JB_ERR_OK on success
- * JB_ERR_MEMORY on out-of-memory error.
+ * Returns : 0
*
*********************************************************************/
-jb_err cgi_error_no_template(struct client_state *csp,
- struct http_response *rsp,
- const char *template_name)
+int cgi_show_status(struct client_state *csp, struct http_response *rsp,
+ struct map *parameters)
{
- static const char status[] =
- "500 Internal Privoxy Error";
- static const char body_prefix[] =
- "\r\n"
- "500 Internal Privoxy Error\r\n"
- "\r\n"
- "
500 Internal Privoxy Error
\r\n"
- "
Privoxy encountered an error while processing your request:
\r\n"
- "
Could not load template file ";
- static const char body_suffix[] =
- "
\r\n"
- "
Please contact your proxy administrator.
\r\n"
- "
If you are the proxy administrator, please put the required file "
- "in the (confdir)/templates directory. The "
- "location of the (confdir) directory "
- "is specified in the main Privoxy config "
- "file. (It's typically the Privoxy install directory"
-#ifndef _WIN32
- ", or /etc/privoxy/"
-#endif /* ndef _WIN32 */
- ").
\n");
+ return(ret);
+
}
+#ifdef STATISTICS
/*********************************************************************
*
- * Function : make_menu
+ * Function : add_stats
*
- * Description : Returns an HTML-formatted menu of the available
- * unhidden CGIs, excluding the one given in .
+ * Description : Add the blocking statistics to a given map.
*
- * Parameters : self = name of CGI to leave out, can be NULL
+ * Parameters :
+ * 1 : exports = map to write to.
*
- * Returns : menu string, or NULL on out-of-memory error.
+ * Returns : pointer to extended map
*
*********************************************************************/
-char *make_menu(const char *self)
+struct map *add_stats(struct map *exports)
{
- const struct cgi_dispatcher *d;
- char *result = strdup("");
+ float perc_rej; /* Percentage of http requests rejected */
+ char buf[1000];
+ int local_urls_read = urls_read;
+ int local_urls_rejected = urls_rejected;
- if (self == NULL)
- {
- self = "NO-SUCH-CGI!";
- }
+ /*
+ * Need to alter the stats not to include the fetch of this
+ * page.
+ *
+ * Can't do following thread safely! doh!
+ *
+ * urls_read--;
+ * urls_rejected--; * This will be incremented subsequently *
+ */
- /* List available unhidden CGI's and export as "other-cgis" */
- for (d = cgi_dispatchers; d->name; d++)
+ if (local_urls_read == 0)
{
- if (d->description && strcmp(d->name, self))
- {
- string_append(&result, "
+
+Last modified: Wed Jun 13 16:26:46 CEST 2001
+
-
+
+
diff --git a/doc/webserver/p_doc.css b/doc/webserver/p_doc.css
deleted file mode 100644
index 8eb2159a..00000000
--- a/doc/webserver/p_doc.css
+++ /dev/null
@@ -1,11 +0,0 @@
-hr { width: 95% }
-body { background: #EEEEEE; }
-h1, h2, h3, h4 { font-family: arial, helvetica, sans-serif }
-code { color: green }
-pre { margin-left: 2% }
-# p { margin-left:20px }
-body { margin-left:20px }
-h1 { color: #404; font-size: 175%; margin-left:0px }
-h2 { color: #606; margin-left:0px }
-h3, h4 { color: #806; margin-left:0px }
-ul { list-style-type: square }
diff --git a/doc/webserver/p_web.css b/doc/webserver/p_web.css
deleted file mode 100644
index 8eb2159a..00000000
--- a/doc/webserver/p_web.css
+++ /dev/null
@@ -1,11 +0,0 @@
-hr { width: 95% }
-body { background: #EEEEEE; }
-h1, h2, h3, h4 { font-family: arial, helvetica, sans-serif }
-code { color: green }
-pre { margin-left: 2% }
-# p { margin-left:20px }
-body { margin-left:20px }
-h1 { color: #404; font-size: 175%; margin-left:0px }
-h2 { color: #606; margin-left:0px }
-h3, h4 { color: #806; margin-left:0px }
-ul { list-style-type: square }
diff --git a/doc/webserver/redirect.php b/doc/webserver/redirect.php
index a85b2c64..70d7e0b9 100755
--- a/doc/webserver/redirect.php
+++ b/doc/webserver/redirect.php
@@ -1,11 +1,21 @@
-
+
+// 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.
+//
+//
+// $Log: Makefile.in,v $
+//
diff --git a/doc/webserver/robots.txt b/doc/webserver/robots.txt
deleted file mode 100644
index 790f3ffc..00000000
--- a/doc/webserver/robots.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-# This is the Internet Junkbuster web site.
-#
-# If the robot is connecting through a JunkBuster, then the
-# control interface is at /config. It isn't very useful
-# to index it, and you're likely to break stuff. So go away!
-#
-# Even if you're not connected through a JunkBuster, the
-# one "JunkBuster's not working" page there is not very
-# interesting.
-
-User-agent: *
-Disallow: /config/
-
-
-
diff --git a/doc/webserver/swa.css b/doc/webserver/swa.css
new file mode 100644
index 00000000..22489e52
--- /dev/null
+++ b/doc/webserver/swa.css
@@ -0,0 +1,9 @@
+body { margin-left:0px; margin-right:0px; margin-top:0px; margin-bottom:0px;}
+h1 { margin-left:20px; font-family:Helvetica,Arial; font-size:18pt;}
+h2 { margin-left:25px; font-family:Helvetica,Arial; font-size:14pt; }
+h3 { margin-left:25px; font-family:Helvetica,Arial; font-size:12pt; }
+p { margin-left:27px; margin-right:20px; font-size:10pt; }
+# next definition removes bullets for netscape
+# li { margin-left:27px; margin-right:20px; font-size:10pt; }
+form,pre,ul,ol { margin-left:27px; margin-right:20px; font-size:10pt; }
+div,td,th,address,nobr,b,i { font-size:10pt; }
diff --git a/doc/webserver/testplan.html b/doc/webserver/testplan.html
new file mode 100644
index 00000000..050a66d2
--- /dev/null
+++ b/doc/webserver/testplan.html
@@ -0,0 +1,102 @@
+
+
+
+
+Junkbuster|Testplan
+
+
+
+
+
+
+
+
+
+
Testplan for releases:
+
+
+
Remove any existing rpm with rpm -e
+
Remove any file that was left over. This includes (but is not limited
+ to)
+
+
/var/log/junkbuster
+
/etc/junkbuster
+
/usr/sbin/junkbuster
+
/etc/init.d/junkbuster
+
/usr/doc/junkbuster*
+
+
Install the rpm. Any error messages?
+
start,stop,status junkbuster with the specific script
+ (e.g. /etc/rc.d/init/junkbuster stop). Reboot your machine. Does
+ autostart work?
+
Start browsing. Does the junkbuster work? Logfile written?
+
Remove the rpm. Any error messages? All files removed?
+
+
+
Test reports:
+
+Please submit test reports only with the test form
+at sourceforge. Three simple steps:
+
+
Select category: the distribution you test on.
+
Select group: the version of Junkbuster that we are about to release.
+
Fill the Summary and Detailed Description with something intelligent
+ (keep it short and precise).
+
+
+Do not mail to the mailinglist (we cannot keep track on issues there).
+
+
+
+
+
+Last modified: Wed Jun 13 16:26:43 CEST 2001
+
+
+
+
diff --git a/encode.c b/encode.c
index 09c7b5f7..7e82acd8 100644
--- a/encode.c
+++ b/encode.c
@@ -1,4 +1,4 @@
-const char encode_rcs[] = "$Id: encode.c,v 1.7 2002/03/24 13:25:43 swa Exp $";
+const char encode_rcs[] = "$Id: encode.c,v 1.1.1.1 2001/05/15 13:58:51 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/encode.c,v $
@@ -7,7 +7,7 @@ const char encode_rcs[] = "$Id: encode.c,v 1.7 2002/03/24 13:25:43 swa Exp $";
* encode cookies and HTML text.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -33,27 +33,6 @@ const char encode_rcs[] = "$Id: encode.c,v 1.7 2002/03/24 13:25:43 swa Exp $";
*
* Revisions :
* $Log: encode.c,v $
- * Revision 1.7 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.6 2002/03/13 00:27:04 jongfoster
- * Killing warnings
- *
- * Revision 1.5 2002/03/07 03:46:53 oes
- * Fixed compiler warnings etc
- *
- * Revision 1.4 2002/01/22 23:28:07 jongfoster
- * Adding convenience function html_encode_and_free_original()
- * Making all functions accept NULL paramaters - in this case, they
- * simply return NULL. This allows error-checking to be deferred.
- *
- * Revision 1.3 2001/11/13 00:16:40 jongfoster
- * Replacing references to malloc.h with the standard stdlib.h
- * (See ANSI or K&R 2nd Ed)
- *
- * Revision 1.2 2001/05/17 22:52:35 oes
- * - Cleaned CRLF's from the sources and related files
- *
* Revision 1.1.1.1 2001/05/15 13:58:51 oes
* Initial import of version 2.9.3 source tree
*
@@ -64,8 +43,8 @@ const char encode_rcs[] = "$Id: encode.c,v 1.7 2002/03/24 13:25:43 swa Exp $";
#include "config.h"
#include
-#include
#include
+#include
#include "encode.h"
@@ -176,20 +155,12 @@ static const char * const cookie_code_map[256] = {
*
* Returns : Encoded string, newly allocated on the heap.
* Caller is responsible for freeing it with free().
- * If s is NULL, or on out-of memory, returns NULL.
*
*********************************************************************/
char * html_encode(const char *s)
{
- char * buf;
-
- if (s == NULL)
- {
- return NULL;
- }
-
/* each input char can expand to at most 6 chars */
- buf = (char *) malloc((strlen(s) * 6) + 1);
+ char * buf = (char *) malloc((strlen(s) * 6) + 1);
if (buf)
{
@@ -215,41 +186,6 @@ char * html_encode(const char *s)
return(buf);
}
-
-/*********************************************************************
- *
- * Function : html_encode_and_free_original
- *
- * Description : Encodes a string so it's not interpreted as
- * containing HTML tags or entities.
- * Replaces <, >, &, and " with the appropriate HTML
- * entities. Free()s original string.
- * If original string is NULL, simply returns NULL.
- *
- * Parameters :
- * 1 : s = String to encode. Null-terminated.
- *
- * Returns : Encoded string, newly allocated on the heap.
- * Caller is responsible for freeing it with free().
- * If s is NULL, or on out-of memory, returns NULL.
- *
- *********************************************************************/
-char * html_encode_and_free_original(char *s)
-{
- char * result;
-
- if (s == NULL)
- {
- return NULL;
- }
-
- result = html_encode(s);
- free(s);
-
- return result;
-}
-
-
/*********************************************************************
*
* Function : cookie_encode
@@ -263,20 +199,12 @@ char * html_encode_and_free_original(char *s)
*
* Returns : Encoded string, newly allocated on the heap.
* Caller is responsible for freeing it with free().
- * If s is NULL, or on out-of memory, returns NULL.
*
*********************************************************************/
char * cookie_encode(const char *s)
{
- char * buf;
-
- if (s == NULL)
- {
- return NULL;
- }
-
/* each input char can expand to at most 3 chars */
- buf = (char *) malloc((strlen(s) * 3) + 1);
+ char * buf = (char *) malloc((strlen(s) * 3) + 1);
if (buf)
{
@@ -315,20 +243,12 @@ char * cookie_encode(const char *s)
*
* Returns : Encoded string, newly allocated on the heap.
* Caller is responsible for freeing it with free().
- * If s is NULL, or on out-of memory, returns NULL.
*
*********************************************************************/
char * url_encode(const char *s)
{
- char * buf;
-
- if (s == NULL)
- {
- return NULL;
- }
-
/* each input char can expand to at most 3 chars */
- buf = (char *) malloc((strlen(s) * 3) + 1);
+ char * buf = (char *) malloc((strlen(s) * 3) + 1);
if (buf)
{
@@ -368,7 +288,7 @@ char * url_encode(const char *s)
* Returns : The integer value, or -1 for non-hex characters.
*
*********************************************************************/
-static int xdtoi(const int d)
+static int xdtoi(char d)
{
if ((d >= '0') && (d <= '9'))
{
@@ -406,10 +326,10 @@ static int xtoi(const char *s)
{
int d1, d2;
- d1 = xdtoi(*s);
+ d1 = xdtoi(*s++);
if(d1 >= 0)
{
- d2 = xdtoi(*(s+1));
+ d2 = xdtoi(*s);
if(d2 >= 0)
{
return (d1 << 4) + d2;
@@ -451,7 +371,7 @@ char *url_decode(const char * s)
break;
case '%':
- if ((*q = xtoi(s + 1)) != '\0')
+ if ((*q = xtoi(s + 1)))
{
s += 3;
q++;
diff --git a/encode.h b/encode.h
index 875b9662..ba0b6cf0 100644
--- a/encode.h
+++ b/encode.h
@@ -1,15 +1,15 @@
-#ifndef ENCODE_H_INCLUDED
-#define ENCODE_H_INCLUDED
-#define ENCODE_H_VERSION "$Id: encode.h,v 1.4 2002/03/24 13:25:43 swa Exp $"
+#ifndef _ENCODE_H
+#define _ENCODE_H
+#define ENCODE_H_VERSION "$Id: encode.h,v 1.1 2001/05/13 21:57:06 administrator Exp $"
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/encode.h,v $
+ * File : $Source: /home/administrator/cvs/ijb/encode.h,v $
*
* Purpose : Functions to encode and decode URLs, and also to
* encode cookies and HTML text.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -35,21 +35,6 @@
*
* Revisions :
* $Log: encode.h,v $
- * Revision 1.4 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.3 2002/01/22 23:28:07 jongfoster
- * Adding convenience function html_encode_and_free_original()
- * Making all functions accept NULL paramaters - in this case, they
- * simply return NULL. This allows error-checking to be deferred.
- *
- * Revision 1.2 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.1.1.1 2001/05/15 13:58:51 oes
- * Initial import of version 2.9.3 source tree
- *
*
*********************************************************************/
@@ -63,8 +48,6 @@ extern char * cookie_encode(const char *s);
extern char * url_encode(const char *s);
extern char * url_decode(const char *str);
-extern char * html_encode_and_free_original(char *s);
-
/* Revision control strings from this header and associated .c file */
extern const char encode_rcs[];
extern const char encode_h_rcs[];
@@ -73,7 +56,7 @@ extern const char encode_h_rcs[];
} /* extern "C" */
#endif
-#endif /* ndef ENCODE_H_INCLUDED */
+#endif /* ndef _ENCODE_H */
/*
Local Variables:
diff --git a/errlog.c b/errlog.c
index ec623b8f..f069875c 100644
--- a/errlog.c
+++ b/errlog.c
@@ -1,4 +1,4 @@
-const char errlog_rcs[] = "$Id: errlog.c,v 1.36 2002/03/26 22:29:54 swa Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.13 2001/07/13 13:58:58 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.c,v $
@@ -7,7 +7,7 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.36 2002/03/26 22:29:54 swa Exp $";
* printf-like fashion.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -33,89 +33,6 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.36 2002/03/26 22:29:54 swa Exp $";
*
* Revisions :
* $Log: errlog.c,v $
- * Revision 1.36 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.35 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.34 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.33 2002/03/13 00:27:04 jongfoster
- * Killing warnings
- *
- * Revision 1.32 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.31 2002/03/06 23:02:57 jongfoster
- * Removing tabs
- *
- * Revision 1.30 2002/03/05 22:43:45 david__schmidt
- * - Better error reporting on OS/2
- * - Fix double-slash comment (oops)
- *
- * Revision 1.29 2002/03/04 23:45:13 jongfoster
- * Printing thread ID if using Win32 native threads
- *
- * Revision 1.28 2002/03/04 17:59:59 oes
- * Deleted deletePidFile(), cosmetics
- *
- * Revision 1.27 2002/03/04 02:08:01 david__schmidt
- * Enable web editing of actions file on OS/2 (it had been broken all this time!)
- *
- * Revision 1.26 2002/01/09 19:05:45 steudten
- * Fix big memory leak.
- *
- * Revision 1.25 2002/01/09 14:32:08 oes
- * Added support for gmtime_r and localtime_r.
- *
- * Revision 1.24 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.23 2001/11/07 00:02:13 steudten
- * Add line number in error output for lineparsing for
- * actionsfile and configfile.
- * Special handling for CLF added.
- *
- * Revision 1.22 2001/11/05 23:43:05 steudten
- * Add time+date to log files.
- *
- * Revision 1.21 2001/10/25 03:40:47 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.20 2001/09/16 23:04:34 jongfoster
- * Fixing a warning
- *
- * Revision 1.19 2001/09/13 20:08:06 jongfoster
- * Adding support for LOG_LEVEL_CGI
- *
- * Revision 1.18 2001/09/10 11:27:24 oes
- * Declaration of w32_socket_strerr now conditional
- *
- * Revision 1.17 2001/09/10 10:17:13 oes
- * Removed unused variable; Fixed sprintf format
- *
- * Revision 1.16 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.15 2001/07/29 17:41:10 jongfoster
- * Now prints thread ID for each message (pthreads only)
- *
- * Revision 1.14 2001/07/19 19:03:48 haroon
- * - Added case for LOG_LEVEL_POPUPS
- *
* Revision 1.13 2001/07/13 13:58:58 oes
* - Added case for LOG_LEVEL_DEANIMATE
* - Removed all #ifdef PCRS
@@ -206,22 +123,18 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.36 2002/03/26 22:29:54 swa Exp $";
#include "config.h"
-#include "miscutil.h"
#include
#include
#include
#include
-#if !defined(_WIN32) && !defined(__OS2__)
+#ifndef _WIN32
#include
-#endif /* !defined(_WIN32) && !defined(__OS2__) */
+#endif /* ndef _WIN32 */
#include
-#include
-#ifdef FEATURE_PTHREAD
-#include
-#endif /* def FEATURE_PTHREAD */
+/* #include */
#ifdef _WIN32
#include
@@ -230,15 +143,8 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.36 2002/03/26 22:29:54 swa Exp $";
#endif /* ndef _WIN_CONSOLE */
#endif /* def _WIN32 */
-#ifdef __OS2__
-#include /* For sock_errno */
-#define INCL_DOS
-#include
-#endif
-
#include "errlog.h"
#include "project.h"
-#include "jcc.h"
const char errlog_h_rcs[] = ERRLOG_H_VERSION;
@@ -253,14 +159,16 @@ const char errlog_h_rcs[] = ERRLOG_H_VERSION;
/* where to log (default: stderr) */
static FILE *logfp = NULL;
+/* where to log (NULL == stderr) */
+static char * logfilename = NULL;
+
/* logging detail level. */
static int debug = (LOG_LEVEL_FATAL | LOG_LEVEL_ERROR | LOG_LEVEL_INFO);
/* static functions */
static void fatal_error(const char * error_message);
-#ifdef _WIN32
-static char *w32_socket_strerr(int errcode, char *tmp_buf);
-#endif
+static char * w32_socket_strerr(int errcode, char * tmp_buf);
+
/*********************************************************************
*
@@ -279,7 +187,7 @@ static char *w32_socket_strerr(int errcode, char *tmp_buf);
static void fatal_error(const char * error_message)
{
#if defined(_WIN32) && !defined(_WIN_CONSOLE)
- MessageBox(g_hwndLogFrame, error_message, "Privoxy Error",
+ MessageBox(g_hwndLogFrame, error_message, "Internet JunkBuster Error",
MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND | MB_TOPMOST);
/* Cleanup - remove taskbar icon etc. */
@@ -289,17 +197,13 @@ static void fatal_error(const char * error_message)
fputs(error_message, stderr);
#endif /* defined(_WIN32) && !defined(_WIN_CONSOLE) */
-#if defined(unix)
- unlink(pidfile);
-#endif /* unix */
-
exit(1);
}
/*********************************************************************
*
- * Function : init_error_log
+ * Function : init_errlog
*
* Description : Initializes the logging module. Must call before
* calling log_error.
@@ -323,7 +227,6 @@ void init_error_log(const char *prog_name, const char *logfname, int debuglevel)
if ((logfp != NULL) && (logfp != stderr))
{
- log_error(LOG_LEVEL_INFO, "(Re-)Open logfile %s", logfname ? logfname : "none");
fclose(logfp);
}
logfp = stderr;
@@ -331,9 +234,9 @@ void init_error_log(const char *prog_name, const char *logfname, int debuglevel)
/* set the designated log file */
if( logfname )
{
- if( NULL == (fp = fopen(logfname, "a")) )
+ if( !(fp = fopen(logfname, "a")) )
{
- log_error(LOG_LEVEL_FATAL, "init_error_log(): can't open logfile: %s", logfname);
+ log_error(LOG_LEVEL_FATAL, "init_errlog(): can't open logfile: %s", logfname);
}
/* set logging to be completely unbuffered */
@@ -342,7 +245,7 @@ void init_error_log(const char *prog_name, const char *logfname, int debuglevel)
logfp = fp;
}
- log_error(LOG_LEVEL_INFO, "Privoxy version " VERSION);
+ log_error(LOG_LEVEL_INFO, "Internet JunkBuster version " VERSION);
if (prog_name != NULL)
{
log_error(LOG_LEVEL_INFO, "Program name: %s", prog_name);
@@ -370,15 +273,10 @@ void init_error_log(const char *prog_name, const char *logfname, int debuglevel)
void log_error(int loglevel, char *fmt, ...)
{
va_list ap;
- char *outbuf= NULL;
- static char *outbuf_save = NULL;
+ char outbuf[BUFFER_SIZE];
char * src = fmt;
int outc = 0;
long this_thread = 1; /* was: pthread_t this_thread;*/
-#ifdef __OS2__
- PTIB ptib;
- APIRET ulrc;
-#endif /* __OS2__ */
#if defined(_WIN32) && !defined(_WIN_CONSOLE)
/*
@@ -399,95 +297,58 @@ void log_error(int loglevel, char *fmt, ...)
}
/* FIXME get current thread id */
-#ifdef FEATURE_PTHREAD
- this_thread = (long)pthread_self();
-#elif defined(_WIN32)
- this_thread = GetCurrentThreadId();
-#elif defined(__OS2__)
- ulrc = DosGetInfoBlocks(&ptib, NULL);
- if (ulrc == 0)
- this_thread = ptib -> tib_ptib2 -> tib2_ultid;
-#endif /* def FEATURE_PTHREAD */
-
- if ( !outbuf_save )
- {
- outbuf_save = outbuf = (char*)malloc(BUFFER_SIZE);
- assert(outbuf);
- }
- outbuf = outbuf_save;
-
- {
- /*
- * Write timestamp into tempbuf.
- *
- * Complex because not all OSs have tm_gmtoff or
- * the %z field in strftime()
- */
- time_t now;
- struct tm tm_now;
- time (&now);
-#ifdef HAVE_LOCALTIME_R
- tm_now = *localtime_r(&now, &tm_now);
-#else
- tm_now = *localtime (&now);
-#endif
- strftime(outbuf, BUFFER_SIZE-6, "%b %d %H:%M:%S ", &tm_now);
- outbuf += strlen( outbuf );
- }
+ /* this_thread = (long)pthread_self(); */
+
switch (loglevel)
{
case LOG_LEVEL_ERROR:
- outc = sprintf(outbuf, "Privoxy(%ld) Error: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Error: ", this_thread);
break;
case LOG_LEVEL_FATAL:
- outc = sprintf(outbuf, "Privoxy(%ld) Fatal error: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Fatal error: ", this_thread);
break;
case LOG_LEVEL_GPC:
- outc = sprintf(outbuf, "Privoxy(%ld) Request: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Request: ", this_thread);
break;
case LOG_LEVEL_CONNECT:
- outc = sprintf(outbuf, "Privoxy(%ld) Connect: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Connect: ", this_thread);
break;
case LOG_LEVEL_LOG:
- outc = sprintf(outbuf, "Privoxy(%ld) Writing: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Writing: ", this_thread);
break;
case LOG_LEVEL_HEADER:
- outc = sprintf(outbuf, "Privoxy(%ld) Header: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Header: ", this_thread);
break;
case LOG_LEVEL_INFO:
- outc = sprintf(outbuf, "Privoxy(%ld) Info: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Info: ", this_thread);
break;
case LOG_LEVEL_RE_FILTER:
- outc = sprintf(outbuf, "Privoxy(%ld) Re-Filter: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Re-Filter: ", this_thread);
break;
-#ifdef FEATURE_FORCE_LOAD
+#ifdef FORCE_LOAD
case LOG_LEVEL_FORCE:
- outc = sprintf(outbuf, "Privoxy(%ld) Force: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Force: ", this_thread);
break;
-#endif /* def FEATURE_FORCE_LOAD */
-#ifdef FEATURE_FAST_REDIRECTS
+#endif /* def FORCE_LOAD */
+#ifdef FAST_REDIRECTS
case LOG_LEVEL_REDIRECTS:
- outc = sprintf(outbuf, "Privoxy(%ld) Redirect: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Redirect: ", this_thread);
break;
-#endif /* def FEATURE_FAST_REDIRECTS */
+#endif /* def FAST_REDIRECTS */
case LOG_LEVEL_DEANIMATE:
- outc = sprintf(outbuf, "Privoxy(%ld) Gif-Deanimate: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Gif-Deanimate: ", this_thread);
break;
case LOG_LEVEL_CLF:
- outbuf = outbuf_save;
outc = 0;
outbuf[0] = '\0';
break;
-#ifdef FEATURE_KILL_POPUPS
+#ifdef KILLPOPUPS
case LOG_LEVEL_POPUPS:
- outc = sprintf(outbuf, "Privoxy(%ld) Kill-Popups: ", this_thread);
- break;
-#endif /* def FEATURE_KILL_POPUPS */
- case LOG_LEVEL_CGI:
- outc = sprintf(outbuf, "Privoxy(%ld) CGI: ", this_thread);
+ outc = sprintf(outbuf, "IJB(%d) Kill-Popups: ", this_thread);
break;
+#endif /* def KILLPOPUPS */
default:
- outc = sprintf(outbuf, "Privoxy(%ld) UNKNOWN LOG TYPE(%d): ", this_thread, loglevel);
+ outc = sprintf(outbuf, "IJB(%d) UNKNOWN LOG TYPE(%d): ", this_thread, loglevel);
break;
}
@@ -498,7 +359,7 @@ void log_error(int loglevel, char *fmt, ...)
while ((*src) && (outc < BUFFER_SIZE-2))
{
char tempbuf[BUFFER_SIZE];
- char *sval = NULL;
+ char *sval;
int ival;
unsigned uval;
long lval;
@@ -562,7 +423,7 @@ void log_error(int loglevel, char *fmt, ...)
else
{
/* Error */
- sprintf(outbuf, "Privoxy(%ld) Error: log_error(): Bad format string:\n"
+ sprintf(outbuf, "IJB(%d) Error: log_error(): Bad format string:\n"
"Format = \"%s\"\n"
"Exiting.", this_thread, fmt);
/* FIXME RACE HAZARD: should start critical section error_log_use here */
@@ -619,7 +480,7 @@ void log_error(int loglevel, char *fmt, ...)
outc += ival;
if (outc < BUFFER_SIZE-1)
{
- memcpy(outbuf + oldoutc, sval, (size_t) ival);
+ memcpy(outbuf + oldoutc, sval, ival);
}
else
{
@@ -631,11 +492,6 @@ void log_error(int loglevel, char *fmt, ...)
#ifdef _WIN32
ival = WSAGetLastError();
sval = w32_socket_strerr(ival, tempbuf);
-#elif __OS2__
- ival = sock_errno();
- if (ival == 0)
- ival = errno;
- sval = strerror(ival);
#else /* ifndef _WIN32 */
ival = errno;
#ifdef HAVE_STRERROR
@@ -671,22 +527,11 @@ void log_error(int loglevel, char *fmt, ...)
*/
time_t now;
struct tm *tm_now;
- struct tm gmt;
-#ifdef HAVE_LOCALTIME_R
- struct tm dummy;
-#endif
+ struct tm gmt;
int days, hrs, mins;
time (&now);
-#ifdef HAVE_GMTIME_R
- gmt = *gmtime_r(&now, &gmt);
-#else
- gmt = *gmtime(&now);
-#endif
-#ifdef HAVE_LOCALTIME_R
- tm_now = localtime_r(&now, &dummy);
-#else
+ gmt = *gmtime (&now);
tm_now = localtime (&now);
-#endif
days = tm_now->tm_yday - gmt.tm_yday;
hrs = ((days < -1 ? 24 : 1 < days ? -24 : days * 24) + tm_now->tm_hour - gmt.tm_hour);
mins = hrs * 60 + tm_now->tm_min - gmt.tm_min;
@@ -705,7 +550,7 @@ void log_error(int loglevel, char *fmt, ...)
}
break;
default:
- sprintf(outbuf, "Privoxy(%ld) Error: log_error(): Bad format string:\n"
+ sprintf(outbuf, "IJB(%d) Error: log_error(): Bad format string:\n"
"Format = \"%s\"\n"
"Exiting.", this_thread, fmt);
/* FIXME RACE HAZARD: should start critical section error_log_use here */
@@ -713,9 +558,9 @@ void log_error(int loglevel, char *fmt, ...)
{
logfp = stderr;
}
- fputs(outbuf_save, logfp);
+ fputs(outbuf, logfp);
/* FIXME RACE HAZARD: should end critical section error_log_use here */
- fatal_error(outbuf_save);
+ fatal_error(outbuf);
/* Never get here */
break;
@@ -759,11 +604,11 @@ void log_error(int loglevel, char *fmt, ...)
logfp = stderr;
}
- fputs(outbuf_save, logfp);
+ fputs(outbuf, logfp);
if (loglevel == LOG_LEVEL_FATAL)
{
- fatal_error(outbuf_save);
+ fatal_error(outbuf);
/* Never get here */
}
@@ -771,7 +616,7 @@ void log_error(int loglevel, char *fmt, ...)
#if defined(_WIN32) && !defined(_WIN_CONSOLE)
/* Write to display */
- LogPutString(outbuf_save);
+ LogPutString(outbuf);
#endif /* defined(_WIN32) && !defined(_WIN_CONSOLE) */
}
@@ -795,7 +640,7 @@ void log_error(int loglevel, char *fmt, ...)
* tmp_buf.
*
*********************************************************************/
-static char *w32_socket_strerr(int errcode, char *tmp_buf)
+static char * w32_socket_strerr(int errcode, char * tmp_buf)
{
#define TEXT_FOR_ERROR(code,text) \
if (errcode == code) \
@@ -872,3 +717,4 @@ static char *w32_socket_strerr(int errcode, char *tmp_buf)
tab-width: 3
end:
*/
+
diff --git a/errlog.h b/errlog.h
index c3424dd0..d5edaaef 100644
--- a/errlog.h
+++ b/errlog.h
@@ -1,6 +1,6 @@
-#ifndef ERRLOG_H_INCLUDED
-#define ERRLOG_H_INCLUDED
-#define ERRLOG_H_VERSION "$Id: errlog.h,v 1.12 2002/03/24 13:25:43 swa Exp $"
+#ifndef _ERRLOG_H
+#define _ERRLOG_H
+#define ERRLOG_H_VERSION "$Id: errlog.h,v 1.6 2001/07/13 13:59:22 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.h,v $
@@ -9,7 +9,7 @@
* printf-like fashion.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -35,28 +35,6 @@
*
* Revisions :
* $Log: errlog.h,v $
- * Revision 1.12 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.11 2002/03/06 23:02:57 jongfoster
- * Removing tabs
- *
- * Revision 1.10 2001/09/13 20:08:06 jongfoster
- * Adding support for LOG_LEVEL_CGI
- *
- * Revision 1.9 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.8 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.7 2001/07/19 19:02:53 haroon
- * Added define for LOG_LEVEL_POPUPS
- *
* Revision 1.6 2001/07/13 13:59:22 oes
* - Added LOG_LEVEL_DEANIMATE
* - Changed LOG_LEVEL_CLF
@@ -135,21 +113,19 @@ extern "C" {
#define LOG_LEVEL_IO 0x0004
#define LOG_LEVEL_HEADER 0x0008
#define LOG_LEVEL_LOG 0x0010
-#ifdef FEATURE_FORCE_LOAD
+#ifdef FORCE_LOAD
#define LOG_LEVEL_FORCE 0x0020
-#endif /* def FEATURE_FORCE_LOAD */
+#endif /* def FORCE_LOAD */
#define LOG_LEVEL_RE_FILTER 0x0040
-#ifdef FEATURE_FAST_REDIRECTS
+#ifdef FAST_REDIRECTS
#define LOG_LEVEL_REDIRECTS 0x0080
-#endif /* def FEATURE_FAST_REDIRECTS */
+#endif /* def FAST_REDIRECTS */
#define LOG_LEVEL_DEANIMATE 0x0100
#define LOG_LEVEL_CLF 0x0200 /* Common Log File format */
-#ifdef FEATURE_KILL_POPUPS
-#define LOG_LEVEL_POPUPS 0x0400 /* Kill Popups */
-#endif /* def FEATURE_KILL_POPUPS */
-
-#define LOG_LEVEL_CGI 0x0800 /* CGI / templates */
+#ifdef KILLPOPUPS
+#define LOG_LEVEL_POPUPS 0x0400 /* Kill Popups */
+#endif /* def KILLPOPUPS */
/* Following are always on: */
#define LOG_LEVEL_INFO 0x1000
@@ -167,7 +143,7 @@ extern const char errlog_h_rcs[];
} /* extern "C" */
#endif
-#endif /* ndef ERRLOG_H_INCLUDED */
+#endif /* ndef _ERRLOG_H */
/*
Local Variables:
diff --git a/filters.c b/filters.c
index 6f16d847..cc06229d 100644
--- a/filters.c
+++ b/filters.c
@@ -1,4 +1,4 @@
-const char filters_rcs[] = "$Id: filters.c,v 1.52 2002/03/24 16:35:57 jongfoster Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.21 2001/07/13 13:59:53 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.c,v $
@@ -6,19 +6,19 @@ const char filters_rcs[] = "$Id: filters.c,v 1.52 2002/03/24 16:35:57 jongfoster
* Purpose : Declares functions to parse/crunch headers and pages.
* Functions declared include:
* `acl_addr', `add_stats', `block_acl', `block_imageurl',
- * `block_url', `url_actions', `domain_split',
+ * `block_url', `url_actions', `domaincmp', `dsplit',
* `filter_popups', `forward_url', 'redirect_url',
* `ij_untrusted_url', `intercept_url', `pcrs_filter_respose',
- * 'ijb_send_banner', and `trust_url'
+ * `show_proxy_args', 'ijb_send_banner', and `trust_url'
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
- * by and Copyright (C) 1997 Anonymous Coders and
+ * by and Copyright (C) 1997 Anonymous Coders and
* Junkbusters Corporation. http://www.junkbusters.com
*
- * This program is free software; you can redistribute it
+ * 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
@@ -38,158 +38,6 @@ const char filters_rcs[] = "$Id: filters.c,v 1.52 2002/03/24 16:35:57 jongfoster
*
* Revisions :
* $Log: filters.c,v $
- * Revision 1.52 2002/03/24 16:35:57 jongfoster
- * Removing logo
- *
- * Revision 1.51 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.50 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.49 2002/03/16 20:29:14 oes
- * Cosmetics
- *
- * Revision 1.48 2002/03/13 20:25:34 oes
- * Better logging for content filters
- *
- * Revision 1.47 2002/03/13 00:30:52 jongfoster
- * Killing warnings
- * Added option of always sending redirect for imageblock,
- * currently disabled with #if 0.
- *
- * Revision 1.46 2002/03/12 01:42:49 oes
- * Introduced modular filters
- *
- * Revision 1.45 2002/03/08 16:47:50 oes
- * Added choice beween GIF and PNG built-in images
- *
- * Revision 1.44 2002/03/07 03:49:31 oes
- * - Fixed compiler warnings etc
- * - Changed built-in images from GIF to PNG
- * (with regard to Unisys patent issue)
- * - Added a 4x4 pattern PNG which is less intrusive
- * than the logo but also clearly marks the deleted banners
- *
- * Revision 1.43 2002/01/22 23:51:59 jongfoster
- * Replacing strsav() with the safer string_append().
- *
- * Adding missing html_encode() to error message generators. Where encoded
- * and unencoded versions of a string were provided, removing the unencoded
- * one.
- *
- * Revision 1.42 2002/01/17 21:00:32 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Using a single, simple url_match(pattern,url) function - rather than
- * the 3-line match routine which was repeated all over the place.
- *
- * Renaming free_url to free_url_spec, since it frees a struct url_spec.
- *
- * Using parse_http_url() to parse URLs without faking a HTTP
- * request line for parse_http_request().
- *
- * Revision 1.41 2001/11/13 00:14:07 jongfoster
- * Fixing stupid bug now I've figured out what || means.
- * (It always returns 0 or 1, not one of it's paramaters.)
- *
- * Revision 1.40 2001/10/26 17:37:55 oes
- * - Re-enabled Netscape 200/404 bug workaround in block_url():
- * - Removed OS/2 special case
- * - Made block_url() independant from sed() having been run
- * - Made trust_url independant from sed() having been run
- * - Made is_imageurl independant from sed() having been run.
- * It now checks User-Agent: and Accept: by itself.
- *
- *
- * Revision 1.39 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.38 2001/10/23 21:32:33 jongfoster
- * Adding error-checking to selected functions
- *
- * Revision 1.37 2001/10/22 15:33:56 david__schmidt
- * Special-cased OS/2 out of the Netscape-abort-on-404-in-js problem in
- * filters.c. Added a FIXME in front of the offending code. I'll gladly
- * put in a better/more robust fix for all parties if one is presented...
- * It seems that just returning 200 instead of 404 would pretty much fix
- * it for everyone, but I don't know all the history of the problem.
- *
- * Revision 1.36 2001/10/10 16:44:16 oes
- * Added match_portlist function
- *
- * Revision 1.35 2001/10/07 15:41:23 oes
- * Replaced 6 boolean members of csp with one bitmap (csp->flags)
- *
- * New function remove_chunked_transfer_coding that strips chunked
- * transfer coding to plain and is called by pcrs_filter_response
- * and gif_deanimate_response if neccessary
- *
- * Improved handling of zero-change re_filter runs
- *
- * pcrs_filter_response and gif_deanimate_response now remove
- * chunked transfer codeing before processing the body.
- *
- * Revision 1.34 2001/09/20 15:49:36 steudten
- *
- * Fix BUG: Change int size to size_t size in pcrs_filter_response().
- * See cgi.c fill_template().
- *
- * Revision 1.33 2001/09/16 17:05:14 jongfoster
- * Removing unused #include showarg.h
- *
- * Revision 1.32 2001/09/16 13:21:27 jongfoster
- * Changes to use new list functions.
- *
- * Revision 1.31 2001/09/16 11:38:02 jongfoster
- * Splitting fill_template() into 2 functions:
- * template_load() loads the file
- * template_fill() performs the PCRS regexps.
- * This is because the CGI edit interface has a "table row"
- * template which is used many times in the page - this
- * change means it's only loaded from disk once.
- *
- * Revision 1.30 2001/09/16 11:00:10 jongfoster
- * New function alloc_http_response, for symmetry with free_http_response
- *
- * Revision 1.29 2001/09/13 23:32:40 jongfoster
- * Moving image data to cgi.c rather than cgi.h
- * Fixing a GPF under Win32 (and any other OS that protects global
- * constants from being written to).
- *
- * Revision 1.28 2001/09/10 10:18:51 oes
- * Silenced compiler warnings
- *
- * Revision 1.27 2001/08/05 16:06:20 jongfoster
- * Modifiying "struct map" so that there are now separate header and
- * "map_entry" structures. This means that functions which modify a
- * map no longer need to return a pointer to the modified map.
- * Also, it no longer reverses the order of the entries (which may be
- * important with some advanced template substitutions).
- *
- * Revision 1.26 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.25 2001/07/26 10:09:46 oes
- * Made browser detection a little less naive
- *
- * Revision 1.24 2001/07/25 17:22:51 oes
- * Added workaround for Netscape bug that prevents display of page when loading a component fails.
- *
- * Revision 1.23 2001/07/23 13:40:12 oes
- * Fixed bug that caused document body to be dropped when pcrs joblist was empty.
- *
- * Revision 1.22 2001/07/18 12:29:34 oes
- * - Made gif_deanimate_response respect
- * csp->action->string[ACTION_STRING_DEANIMATE]
- * - Logging cosmetics
- *
* Revision 1.21 2001/07/13 13:59:53 oes
* - Introduced gif_deanimate_response which shares the
* generic content modification interface of pcrs_filter_response
@@ -386,26 +234,23 @@ const char filters_rcs[] = "$Id: filters.c,v 1.52 2002/03/24 16:35:57 jongfoster
#include
#include
#include
-#include
#ifndef _WIN32
-#ifndef __OS2__
#include
-#endif /* ndef __OS2__ */
#include
#else
#include
-#endif /* ndef _WIN32 */
-
-#ifdef __OS2__
-#include
-#endif /* def __OS2__ */
+#endif
#include "project.h"
#include "filters.h"
#include "encode.h"
+#include "jcc.h"
+#include "showargs.h"
#include "parsers.h"
#include "ssplit.h"
+#include "gateway.h"
+#include "jbsockets.h"
#include "errlog.h"
#include "jbsockets.h"
#include "miscutil.h"
@@ -413,7 +258,6 @@ const char filters_rcs[] = "$Id: filters.c,v 1.52 2002/03/24 16:35:57 jongfoster
#include "cgi.h"
#include "list.h"
#include "deanimate.h"
-#include "urlmatch.h"
#ifdef _WIN32
#include "win32.h"
@@ -431,7 +275,7 @@ const char filters_h_rcs[] = FILTERS_H_VERSION;
#define ijb_isdigit(__X) isdigit((int)(unsigned char)(__X))
-#ifdef FEATURE_ACL
+#ifdef ACL_FILES
/*********************************************************************
*
* Function : block_acl
@@ -496,7 +340,7 @@ int block_acl(struct access_control_addr *dst, struct client_state *csp)
*
* Function : acl_addr
*
- * Description : Called from `load_config' to parse an ACL address.
+ * Description : Called from `load_aclfile' to parse an ACL address.
*
* Parameters :
* 1 : aspec = String specifying ACL address.
@@ -513,7 +357,7 @@ int acl_addr(char *aspec, struct access_control_addr *aca)
masklength = 32;
port = 0;
- if ((p = strchr(aspec, '/')) != NULL)
+ if ((p = strchr(aspec, '/')))
{
*p++ = '\0';
@@ -529,7 +373,7 @@ int acl_addr(char *aspec, struct access_control_addr *aca)
return(-1);
}
- if ((p = strchr(aspec, ':')) != NULL)
+ if ((p = strchr(aspec, ':')))
{
*p++ = '\0';
@@ -544,8 +388,9 @@ int acl_addr(char *aspec, struct access_control_addr *aca)
aca->addr = ntohl(resolve_hostname_to_ip(aspec));
- if (aca->addr == INADDR_NONE)
+ if (aca->addr == -1)
{
+ log_error(LOG_LEVEL_ERROR, "can't resolve address for %s", aspec);
return(-1);
}
@@ -564,87 +409,7 @@ int acl_addr(char *aspec, struct access_control_addr *aca)
return(0);
}
-#endif /* def FEATURE_ACL */
-
-
-/*********************************************************************
- *
- * Function : match_portlist
- *
- * Description : Check if a given number is covered by a comma
- * separated list of numbers and ranges (a,b-c,d,..)
- *
- * Parameters :
- * 1 : portlist = String with list
- * 2 : port = port to check
- *
- * Returns : 0 => no match
- * 1 => match
- *
- *********************************************************************/
-int match_portlist(const char *portlist, int port)
-{
- char *min, *max, *next, *portlist_copy;
-
- min = next = portlist_copy = strdup(portlist);
-
- /*
- * Zero-terminate first item and remember offset for next
- */
- if (NULL != (next = strchr(portlist_copy, (int) ',')))
- {
- *next++ = '\0';
- }
-
- /*
- * Loop through all items, checking for match
- */
- while(min)
- {
- if (NULL == (max = strchr(min, (int) '-')))
- {
- /*
- * No dash, check for equality
- */
- if (port == atoi(min))
- {
- free(portlist_copy);
- return(1);
- }
- }
- else
- {
- /*
- * This is a range, so check if between min and max,
- * or, if max was omitted, between min and 65K
- */
- *max++ = '\0';
- if(port >= atoi(min) && port <= (atoi(max) ? atoi(max) : 65535))
- {
- free(portlist_copy);
- return(1);
- }
-
- }
-
- /*
- * Jump to next item
- */
- min = next;
-
- /*
- * Zero-terminate next item and remember offset for n+1
- */
- if ((NULL != next) && (NULL != (next = strchr(next, (int) ','))))
- {
- *next++ = '\0';
- }
- }
-
- free(portlist_copy);
- return 0;
-
-}
+#endif /* def ACL_FILES */
/*********************************************************************
@@ -661,188 +426,90 @@ int match_portlist(const char *portlist, int port)
*********************************************************************/
struct http_response *block_url(struct client_state *csp)
{
-#ifdef FEATURE_IMAGE_BLOCKING
char *p;
-#endif /* def FEATURE_IMAGE_BLOCKING */
struct http_response *rsp;
+ struct map *exports = NULL;
- /*
+ /*
* If it's not blocked, don't block it ;-)
*/
if ((csp->action->flags & ACTION_BLOCK) == 0)
{
- return NULL;
+ return(NULL);
}
- /*
+ /*
* Else, prepare a response
*/
- if (NULL == (rsp = alloc_http_response()))
+ if (NULL == ( rsp = (struct http_response *)zalloc(sizeof(*rsp))))
{
- return cgi_error_memory();
+ return NULL;
}
/*
* If it's an image-url, send back an image or redirect
* as specified by the relevant +image action
*/
-#ifdef FEATURE_IMAGE_BLOCKING
+#ifdef IMAGE_BLOCKING
if (((csp->action->flags & ACTION_IMAGE_BLOCKER) != 0)
&& is_imageurl(csp))
{
/* determine HOW images should be blocked */
p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER];
-#if 1 /* Two alternative strategies, use this one for now: */
-
/* and handle accordingly: */
- if ((p == NULL) || (0 == strcmpic(p, "pattern")))
+ if ((p == NULL) || (0 == strcmpic(p, "logo")))
{
- rsp->body = bindup(image_pattern_data, image_pattern_length);
- if (rsp->body == NULL)
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
- rsp->content_length = image_pattern_length;
-
- if (enlist_unique_header(rsp->headers, "Content-Type", BUILTIN_IMAGE_MIMETYPE))
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
+ rsp->body = bindup(JBGIF, sizeof(JBGIF));
+ rsp->content_length = sizeof(JBGIF);
+ enlist_unique_header(rsp->headers, "Content-Type", "image/gif");
}
else if (0 == strcmpic(p, "blank"))
{
- rsp->body = bindup(image_blank_data, image_blank_length);
- if (rsp->body == NULL)
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
- rsp->content_length = image_blank_length;
-
- if (enlist_unique_header(rsp->headers, "Content-Type", BUILTIN_IMAGE_MIMETYPE))
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
+ rsp->body = bindup(BLANKGIF, sizeof(BLANKGIF));
+ rsp->content_length = sizeof(BLANKGIF);
+ enlist_unique_header(rsp->headers, "Content-Type", "image/gif");
}
else
{
- rsp->status = strdup("302 Local Redirect from Privoxy");
- if (rsp->status == NULL)
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
-
- if (enlist_unique_header(rsp->headers, "Location", p))
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
- }
-
-#else /* Following code is disabled for now */
-
- /* and handle accordingly: */
- if ((p == NULL) || (0 == strcmpic(p, "pattern")))
- {
- p = CGI_PREFIX "send-banner?type=pattern";
- }
- else if (0 == strcmpic(p, "blank"))
- {
- p = CGI_PREFIX "send-banner?type=blank";
- }
- rsp->status = strdup("302 Local Redirect from Privoxy");
- if (rsp->status == NULL)
- {
- free_http_response(rsp);
- return cgi_error_memory();
+ rsp->status = strdup("302 Local Redirect from Junkbuster");
+ enlist_unique_header(rsp->headers, "Location", p);
}
-
- if (enlist_unique_header(rsp->headers, "Location", p))
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
-#endif /* Preceeding code is disabled for now */
- }
+ }
else
-#endif /* def FEATURE_IMAGE_BLOCKING */
+#endif /* def IMAGE_BLOCKING */
- /*
+ /*
* Else, generate an HTML "blocked" message:
*/
{
- jb_err err;
- struct map * exports;
-
- /*
- * Workaround for stupid Netscape bug which prevents
- * pages from being displayed if loading a referenced
- * JavaScript or style sheet fails. So make it appear
- * as if it succeeded.
- */
- if ( NULL != (p = get_header_value(csp->headers, "User-Agent:"))
- && !strncmpic(p, "mozilla", 7) /* Catch Netscape but */
- && !strstr(p, "Gecko") /* save Mozilla, */
- && !strstr(p, "compatible") /* MSIE */
- && !strstr(p, "Opera")) /* and Opera. */
- {
- rsp->status = strdup("200 Request for blocked URL");
- }
- else
- {
- rsp->status = strdup("404 Request for blocked URL");
- }
- if (rsp->status == NULL)
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
-
- exports = default_exports(csp, NULL);
- if (exports == NULL)
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
-
-#ifdef FEATURE_FORCE_LOAD
- err = map(exports, "force-prefix", 1, FORCE_PREFIX, 1);
-#else /* ifndef FEATURE_FORCE_LOAD */
- err = map_block_killer(exports, "force-support");
-#endif /* ndef FEATURE_FORCE_LOAD */
-
- if (!err) err = map(exports, "hostport", 1, html_encode(csp->http->hostport), 0);
- if (!err) err = map(exports, "path", 1, html_encode(csp->http->path), 0);
+ exports = default_exports(csp, NULL);
+#ifdef FORCE_LOAD
+ exports = map(exports, "force-prefix", 1, FORCE_PREFIX, 1);
+#else
+ exports = map_block_killer(exports, "force-support");
+#endif /* ndef FORCE_LOAD */
- if (err)
- {
- free_map(exports);
- free_http_response(rsp);
- return cgi_error_memory();
- }
+ exports = map(exports, "hostport", 1, csp->http->hostport, 1);
+ exports = map(exports, "hostport-html", 1, html_encode(csp->http->hostport), 0);
+ exports = map(exports, "path", 1, csp->http->path, 1);
+ exports = map(exports, "path-html", 1, html_encode(csp->http->path), 0);
- err = template_fill_for_cgi(csp, "blocked", exports, rsp);
- if (err)
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
+ rsp->body = fill_template(csp, "blocked", exports);
+ free_map(exports);
+
+ rsp->status = strdup("403 Request for blocked URL");
}
- return finish_http_response(rsp);
+ return(finish_http_response(rsp));
}
-#ifdef FEATURE_TRUST
+#ifdef TRUST_FILES
/*********************************************************************
*
* Function : trust_url FIXME: I should be called distrust_url
@@ -859,12 +526,9 @@ struct http_response *block_url(struct client_state *csp)
struct http_response *trust_url(struct client_state *csp)
{
struct http_response *rsp;
- struct map * exports;
- char buf[BUFFER_SIZE];
- char *p;
- struct url_spec **tl;
- struct url_spec *t;
- jb_err err;
+ struct map *exports = NULL;
+ char buf[BUFFER_SIZE], *p = NULL;
+ struct url_spec **tl, *t;
/*
* Don't bother to work on trusted URLs
@@ -874,120 +538,86 @@ struct http_response *trust_url(struct client_state *csp)
return NULL;
}
- /*
+ /*
* Else, prepare a response:
*/
- if (NULL == (rsp = alloc_http_response()))
+ if (NULL == ( rsp = (struct http_response *)zalloc(sizeof(*rsp))))
{
- return cgi_error_memory();
+ return NULL;
}
-
exports = default_exports(csp, NULL);
- if (exports == NULL)
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
- /*
+ /*
* Export the host, port, and referrer information
*/
- err = map(exports, "hostport", 1, csp->http->hostport, 1);
- if (!err) err = map(exports, "path", 1, csp->http->path, 1);
+ exports = map(exports, "hostport", 1, csp->http->hostport, 1);
+ exports = map(exports, "path", 1, csp->http->path, 1);
+ exports = map(exports, "hostport-html", 1, html_encode(csp->http->hostport), 0);
+ exports = map(exports, "path-html", 1, html_encode(csp->http->path), 0);
- if (NULL != (p = get_header_value(csp->headers, "Referer:")))
+ if (csp->referrer && strlen(csp->referrer) > 9)
{
- if (!err) err = map(exports, "referrer", 1, html_encode(p), 0);
+ exports = map(exports, "referrer", 1, csp->referrer + 9, 1);
+ exports = map(exports, "referrer-html", 1, html_encode(csp->referrer + 9), 0);
}
else
{
- if (!err) err = map(exports, "referrer", 1, "unknown", 1);
- }
-
- if (err)
- {
- free_map(exports);
- free_http_response(rsp);
- return cgi_error_memory();
+ exports = map(exports, "referrer", 1, "unknown", 1);
+ exports = map(exports, "referrer-html", 1, "unknown", 1);
}
/*
* Export the trust list
*/
- p = strdup("");
- for (tl = csp->config->trust_list; (t = *tl) != NULL ; tl++)
+ for (tl = csp->config->trust_list; (t = *tl) ; tl++)
{
sprintf(buf, "
%s
\n", t->spec);
- string_append(&p, buf);
- }
- err = map(exports, "trusted-referrers", 1, p, 0);
-
- if (err)
- {
- free_map(exports);
- free_http_response(rsp);
- return cgi_error_memory();
+ p = strsav(p, buf);
}
+ exports = map(exports, "trusted-referrers", 1, p, 0);
+ p = NULL;
/*
* Export the trust info, if available
*/
- if (csp->config->trust_info->first)
+ if (csp->config->trust_info->next)
{
- struct list_entry *l;
+ struct list *l;
- p = strdup("");
- for (l = csp->config->trust_info->first; l ; l = l->next)
+ for (l = csp->config->trust_info->next; l ; l = l->next)
{
sprintf(buf, "
%s \n",l->str, l->str);
- string_append(&p, buf);
+ p = strsav(p, buf);
}
- err = map(exports, "trust-info", 1, p, 0);
+ exports = map(exports, "trust-info", 1, p, 0);
}
else
{
- err = map_block_killer(exports, "have-trust-info");
- }
-
- if (err)
- {
- free_map(exports);
- free_http_response(rsp);
- return cgi_error_memory();
+ exports = map_block_killer(exports, "have-trust-info");
}
-
+
/*
* Export the force prefix or the force conditional block killer
*/
-#ifdef FEATURE_FORCE_LOAD
- err = map(exports, "force-prefix", 1, FORCE_PREFIX, 1);
-#else /* ifndef FEATURE_FORCE_LOAD */
- err = map_block_killer(exports, "force-support");
-#endif /* ndef FEATURE_FORCE_LOAD */
-
- if (err)
- {
- free_map(exports);
- free_http_response(rsp);
- return cgi_error_memory();
- }
+#ifdef FORCE_LOAD
+ exports = map(exports, "force-prefix", 1, FORCE_PREFIX, 1);
+#else
+ exports = map_block_killer(exports, "force-support");
+#endif /* ndef FORCE_LOAD */
/*
* Build the response
*/
- err = template_fill_for_cgi(csp, "untrusted", exports, rsp);
- if (err)
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
+ rsp->body = fill_template(csp, "untrusted", exports);
+ free_map(exports);
+
+ return(finish_http_response(rsp));
- return finish_http_response(rsp);
}
-#endif /* def FEATURE_TRUST */
+#endif /* def TRUST_FILES */
-#ifdef FEATURE_FAST_REDIRECTS
+#ifdef FAST_REDIRECTS
/*********************************************************************
*
* Function : redirect_url
@@ -1009,54 +639,50 @@ struct http_response *redirect_url(struct client_state *csp)
p = q = csp->http->path;
log_error(LOG_LEVEL_REDIRECTS, "checking path for redirects: %s", p);
- /*
+ /*
* find the last URL encoded in the request
*/
- while ((p = strstr(p, "http://")) != NULL)
+ 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);
- if (NULL == (rsp = alloc_http_response()))
+ if (NULL == ( rsp = zalloc(sizeof(*rsp))))
{
- return cgi_error_memory();
+ return NULL;
}
- if ( enlist_unique_header(rsp->headers, "Location", q)
- || (NULL == (rsp->status = strdup("302 Local Redirect from Privoxy"))) )
- {
- free_http_response(rsp);
- return cgi_error_memory();
- }
+ rsp->status = strdup("302 Local Redirect from Junkbuster");
+ enlist_unique_header(rsp->headers, "Location", q);
- return finish_http_response(rsp);
+ return(finish_http_response(rsp));
}
else
{
- return NULL;
+ return(NULL);
}
}
-#endif /* def FEATURE_FAST_REDIRECTS */
+#endif /* def FAST_REDIRECTS */
-#ifdef FEATURE_IMAGE_BLOCKING
+#ifdef IMAGE_BLOCKING
/*********************************************************************
*
* Function : is_imageurl
*
* Description : Given a URL, decide whether it is an image or not,
* using either the info from a previous +image action
- * or, #ifdef FEATURE_IMAGE_DETECT_MSIE, the info from
- * the browser's accept header.
- *
+ * or, #ifdef DETECT_MSIE_IMAGES, the info from the
+ * browser's accept header.
+ *
* Parameters :
* 1 : csp = Current client state (buffers, headers, etc...)
*
@@ -1066,34 +692,28 @@ struct http_response *redirect_url(struct client_state *csp)
*********************************************************************/
int is_imageurl(struct client_state *csp)
{
-#ifdef FEATURE_IMAGE_DETECT_MSIE
- char *tmp;
-
- tmp = get_header_value(csp->headers, "User-Agent:");
- if (tmp && strstr(tmp, "MSIE"))
+#ifdef DETECT_MSIE_IMAGES
+ if ((csp->accept_types
+ & (ACCEPT_TYPE_IS_MSIE|ACCEPT_TYPE_MSIE_IMAGE|ACCEPT_TYPE_MSIE_HTML))
+ == (ACCEPT_TYPE_IS_MSIE|ACCEPT_TYPE_MSIE_IMAGE))
{
- tmp = get_header_value(csp->headers, "Accept:");
- if (tmp && strstr(tmp, "image/gif"))
- {
- /* Client will accept HTML. If this seems counterintuitive,
- * blame Microsoft.
- */
- return(0);
- }
- else
- {
- return(1);
- }
+ return 1;
+ }
+ else if ((csp->accept_types
+ & (ACCEPT_TYPE_IS_MSIE|ACCEPT_TYPE_MSIE_IMAGE|ACCEPT_TYPE_MSIE_HTML))
+ == (ACCEPT_TYPE_IS_MSIE|ACCEPT_TYPE_MSIE_HTML))
+ {
+ return 0;
}
-#endif /* def FEATURE_IMAGE_DETECT_MSIE */
+#endif
return ((csp->action->flags & ACTION_IMAGE) != 0);
}
-#endif /* def FEATURE_IMAGE_BLOCKING */
+#endif /* def IMAGE_BLOCKING */
-#ifdef FEATURE_COOKIE_JAR
+#ifdef TRUST_FILES
/*********************************************************************
*
* Function : is_untrusted_url
@@ -1115,221 +735,205 @@ int is_untrusted_url(struct client_state *csp)
{
struct file_list *fl;
struct block_spec *b;
- struct url_spec **trusted_url;
+ struct url_spec url[1], **tl, *t;
struct http_request rhttp[1];
- const char * referer;
- jb_err err;
+ char *p, *h;
/*
* If we don't have a trustlist, we trust everybody
*/
if (((fl = csp->tlist) == NULL) || ((b = fl->f) == NULL))
{
- return 0;
+ return(0);
}
- memset(rhttp, '\0', sizeof(*rhttp));
/*
* Do we trust the request URL itself?
*/
+ *url = dsplit(csp->http->host);
+
+ /* if splitting the domain fails, punt */
+ if (url->dbuf == NULL) return(0);
+
+ memset(rhttp, '\0', sizeof(*rhttp));
+
for (b = b->next; b ; b = b->next)
{
- if (url_match(b->url, csp->http))
+ if ((b->url->port == 0) || (b->url->port == csp->http->port))
{
- return b->reject;
+ if ((b->url->domain[0] == '\0') || (domaincmp(b->url, url) == 0))
+ {
+ if ((b->url->path == NULL) ||
+#ifdef REGEX
+ (regexec(b->url->preg, csp->http->path, 0, NULL, 0) == 0)
+#else
+ (strncmp(b->url->path, csp->http->path, b->url->pathlen) == 0)
+#endif
+ )
+ {
+ freez(url->dbuf);
+ freez(url->dvec);
+
+ if (b->reject == 0) return(0);
+
+ return(1);
+ }
+ }
}
}
- if (NULL == (referer = get_header_value(csp->headers, "Referer:")))
+ freez(url->dbuf);
+ freez(url->dvec);
+
+ if ((csp->referrer == NULL)|| (strlen(csp->referrer) <= 9))
{
/* no referrer was supplied */
- return 1;
+ return(1);
}
- /*
- * If not, do we maybe trust its referrer?
+ /* forge a URL from the referrer so we can use
+ * convert_url() to parse it into its components.
*/
+ p = NULL;
+ p = strsav(p, "GET ");
+ p = strsav(p, csp->referrer + 9); /* skip over "Referer: " */
+ p = strsav(p, " HTTP/1.0");
- /*
- * Parse the URL from the referrer
- */
+ parse_http_request(p, rhttp, csp);
+ freez(p);
- err = parse_http_url(referer, rhttp, csp);
- if (err)
+ if (rhttp->cmd == NULL)
{
- return 1;
+ return(1);
}
- for (trusted_url = csp->config->trust_list; *trusted_url != NULL; trusted_url++)
- {
- if (url_match(*trusted_url, rhttp))
- {
- /* if the URL's referrer is from a trusted referrer, then
- * add the target spec to the trustfile as an unblocked
- * domain and return NULL (which means it's OK).
- */
-
- FILE *fp;
- if (NULL != (fp = fopen(csp->config->trustfile, "a")))
- {
- char * path;
- char * path_end;
- char * new_entry = strdup("~");
+ /*
+ * If not, do we maybe trust its referrer?
+ */
+ *url = dsplit(rhttp->host);
- string_append(&new_entry, csp->http->hostport);
+ /* if splitting the domain fails, punt */
+ if (url->dbuf == NULL) return(1);
- path = csp->http->path;
- if ( (path[0] == '/')
- && (path[1] == '~')
- && ((path_end = strchr(path + 2, '/')) != NULL))
+ for (tl = csp->config->trust_list; (t = *tl) ; tl++)
+ {
+ if ((t->port == 0) || (t->port == rhttp->port))
+ {
+ if ((t->domain[0] == '\0') || domaincmp(t, url) == 0)
+ {
+ if ((t->path == NULL) ||
+#ifdef REGEX
+ (regexec(t->preg, rhttp->path, 0, NULL, 0) == 0)
+#else
+ (strncmp(t->path, rhttp->path, t->pathlen) == 0)
+#endif
+ )
{
- /* since this path points into a user's home space
- * be sure to include this spec in the trustfile.
+ /* if the URL's referrer is from a trusted referrer, then
+ * add the target spec to the trustfile as an unblocked
+ * domain and return NULL (which means it's OK).
*/
- int path_len = path_end - path; /* save offset */
- path = strdup(path); /* Copy string */
- if (path != NULL)
+
+ FILE *fp;
+
+ freez(url->dbuf);
+ freez(url->dvec);
+
+ if ((fp = fopen(csp->config->trustfile, "a")))
{
- path_end = path + path_len; /* regenerate ptr to new buffer */
- *(path_end + 1) = '\0'; /* Truncate path after '/' */
+ h = NULL;
+
+ h = strsav(h, "~");
+ h = strsav(h, csp->http->hostport);
+
+ p = csp->http->path;
+ if ((*p++ == '/')
+ && (*p++ == '~'))
+ {
+ /* since this path points into a user's home space
+ * be sure to include this spec in the trustfile.
+ */
+ if ((p = strchr(p, '/')))
+ {
+ *p = '\0';
+ h = strsav(h, csp->http->path); /* FIXME: p?! */
+ h = strsav(h, "/");
+ }
+ }
+
+ fprintf(fp, "%s\n", h);
+ freez(h);
+ fclose(fp);
}
- string_join(&new_entry, path);
- }
-
- if (new_entry != NULL)
- {
- fprintf(fp, "%s\n", new_entry);
- free(new_entry);
- }
- else
- {
- /* FIXME: No way to handle out-of memory, so mostly ignoring it */
- log_error(LOG_LEVEL_ERROR, "Out of memory adding pattern to trust file");
+ return(0);
}
-
- fclose(fp);
}
- return 0;
}
}
- return 1;
+ return(1);
}
-#endif /* def FEATURE_COOKIE_JAR */
+#endif /* def TRUST_FILES */
/*********************************************************************
*
* Function : pcrs_filter_response
*
- * Description : Ecexute all text substitutions from all applying
- * +filter actions on the text buffer that's been accumulated
- * in csp->iob->buf. If this changes the contents, set
- * csp->content_length to the modified size and raise the
- * CSP_FLAG_MODIFIED flag.
+ * Description : Apply all the pcrs jobs from the joblist (re_filterfile)
+ * to the text buffer that's been accumulated in
+ * csp->iob->buf and set csp->content_length to the modified
+ * size.
*
* Parameters :
* 1 : csp = Current client state (buffers, headers, etc...)
*
* Returns : a pointer to the (newly allocated) modified buffer.
- * or NULL if there were no hits or something went wrong
- *
+ * or NULL in case something went wrong
+ *
*********************************************************************/
char *pcrs_filter_response(struct client_state *csp)
{
int hits=0;
- size_t size;
+ int size = csp->iob->eod - csp->iob->cur;
char *old = csp->iob->cur, *new = NULL;
pcrs_job *job;
struct file_list *fl;
struct re_filterfile_spec *b;
- struct list_entry *filtername;
- /*
- * Sanity first
- */
- if (csp->iob->cur >= csp->iob->eod)
+ /* Sanity first ;-) */
+ if (size <= 0)
{
return(NULL);
}
- size = csp->iob->eod - csp->iob->cur;
- if ( ( NULL == (fl = csp->rlist) ) || ( NULL == fl->f) )
+ if ( ( NULL == (fl = csp->rlist) ) || ( NULL == (b = fl->f) ) )
{
log_error(LOG_LEVEL_ERROR, "Unable to get current state of regexp filtering.");
return(NULL);
}
- /*
- * If the body has a "chunked" transfer-encoding,
- * get rid of it first, adjusting size and iob->eod
- */
- if (csp->flags & CSP_FLAG_CHUNKED)
- {
- log_error(LOG_LEVEL_RE_FILTER, "Need to de-chunk first");
- if (0 == (size = remove_chunked_transfer_coding(csp->iob->cur, size)))
- {
- return(NULL);
- }
- csp->iob->eod = csp->iob->cur + size;
- csp->flags |= CSP_FLAG_MODIFIED;
- }
+ log_error(LOG_LEVEL_RE_FILTER, "re_filtering %s%s (size %d) ...",
+ csp->http->hostport, csp->http->path, size);
- /*
- * For all applying +filter actions, look if a filter by that
- * name exists and if yes, execute it's pcrs_joblist on the
- * buffer.
- */
- for (b = fl->f; b; b = b->next)
+ /* Apply all jobs from the joblist */
+ for (job = b->joblist; NULL != job; job = job->next)
{
- for (filtername = csp->action->multi[ACTION_MULTI_FILTER]->first;
- filtername ; filtername = filtername->next)
- {
- if (strcmp(b->name, filtername->str) == 0)
- {
- int current_hits = 0;
-
- if ( NULL == b->joblist )
- {
- log_error(LOG_LEVEL_RE_FILTER, "Filter %s has empty joblist. Nothing to do.", b->name);
- return(NULL);
- }
-
- log_error(LOG_LEVEL_RE_FILTER, "re_filtering %s%s (size %d) with filter %s...",
- csp->http->hostport, csp->http->path, size, b->name);
-
- /* Apply all jobs from the joblist */
- for (job = b->joblist; NULL != job; job = job->next)
- {
- current_hits += pcrs_execute(job, old, size, &new, &size);
- if (old != csp->iob->cur) free(old);
- old=new;
- }
-
- log_error(LOG_LEVEL_RE_FILTER, " ...produced %d hits (new size %d).", current_hits, size);
- hits += current_hits;
- }
- }
+ hits += pcrs_execute(job, old, size, &new, &size);
+ if (old != csp->iob->cur) free(old);
+ old=new;
}
- /*
- * If there were no hits, destroy our copy and let
- * chat() use the original in csp->iob
- */
- if (!hits)
- {
- free(new);
- return(NULL);
- }
+ log_error(LOG_LEVEL_RE_FILTER, " produced %d hits (new size %d).", hits, size);
- csp->flags |= CSP_FLAG_MODIFIED;
csp->content_length = size;
- IOB_RESET(csp);
+ /* fwiw, reset the iob */
+ IOB_RESET(csp);
return(new);
}
@@ -1339,37 +943,22 @@ char *pcrs_filter_response(struct client_state *csp)
*
* Function : gif_deanimate_response
*
- * Description : Deanimate the GIF image that has been accumulated in
- * csp->iob->buf, set csp->content_length to the modified
- * size and raise the CSP_FLAG_MODIFIED flag.
+ * Description : Deanimate the GIF image that has been accumulated in
+ * csp->iob->buf and set csp->content_length to the modified
+ * size.
*
* Parameters :
* 1 : csp = Current client state (buffers, headers, etc...)
*
* Returns : a pointer to the (newly allocated) modified buffer.
* or NULL in case something went wrong.
- *
+ *
*********************************************************************/
char *gif_deanimate_response(struct client_state *csp)
{
struct binbuffer *in, *out;
char *p;
- size_t size = csp->iob->eod - csp->iob->cur;
-
- /*
- * If the body has a "chunked" transfer-encoding,
- * get rid of it first, adjusting size and iob->eod
- */
- if (csp->flags & CSP_FLAG_CHUNKED)
- {
- log_error(LOG_LEVEL_DEANIMATE, "Need to de-chunk first");
- if (0 == (size = remove_chunked_transfer_coding(csp->iob->cur, size)))
- {
- return(NULL);
- }
- csp->iob->eod = csp->iob->cur + size;
- csp->flags |= CSP_FLAG_MODIFIED;
- }
+ int size = csp->iob->eod - csp->iob->cur;
if ( (NULL == (in = (struct binbuffer *)zalloc(sizeof *in )))
|| (NULL == (out = (struct binbuffer *)zalloc(sizeof *out))) )
@@ -1390,80 +979,13 @@ char *gif_deanimate_response(struct client_state *csp)
}
else
{
- if ((int)size == out->offset)
- {
- log_error(LOG_LEVEL_DEANIMATE, "GIF not changed.");
- }
- else
- {
- log_error(LOG_LEVEL_DEANIMATE, "Success! GIF shrunk from %d bytes to %d.", size, out->offset);
- }
+ log_error(LOG_LEVEL_DEANIMATE, "Success! GIF shrunk from %d bytes to %d.", size, out->offset);
csp->content_length = out->offset;
- csp->flags |= CSP_FLAG_MODIFIED;
p = out->buffer;
free(in);
free(out);
return(p);
- }
-
-}
-
-
-/*********************************************************************
- *
- * Function : remove_chunked_transfer_coding
- *
- * Description : In-situ remove the "chunked" transfer coding as defined
- * in rfc2616 from a buffer.
- *
- * Parameters :
- * 1 : buffer = Pointer to the text buffer
- * 2 : size = Number of bytes to be processed
- *
- * Returns : The new size, i.e. the number of bytes from buffer which
- * are occupied by the stripped body, or 0 in case something
- * went wrong
- *
- *********************************************************************/
-int remove_chunked_transfer_coding(char *buffer, const size_t size)
-{
- size_t newsize = 0;
- unsigned int chunksize = 0;
- char *from_p, *to_p;
-
- assert(buffer);
- from_p = to_p = buffer;
-
- if (sscanf(buffer, "%x", &chunksize) != 1)
- {
- log_error(LOG_LEVEL_ERROR, "Invalid first chunksize while stripping \"chunked\" transfer coding");
- return(0);
- }
-
- while (chunksize > 0)
- {
- if (NULL == (from_p = strstr(from_p, "\r\n")))
- {
- log_error(LOG_LEVEL_ERROR, "Parse error while stripping \"chunked\" transfer coding");
- return(0);
- }
- newsize += chunksize;
- from_p += 2;
-
- memmove(to_p, from_p, (size_t) chunksize);
- to_p = buffer + newsize;
- from_p += chunksize + 2;
-
- if (sscanf(from_p, "%x", &chunksize) != 1)
- {
- log_error(LOG_LEVEL_ERROR, "Parse error while stripping \"chunked\" transfer coding");
- return(0);
- }
- }
-
- /* FIXME: Should this get its own loglevel? */
- log_error(LOG_LEVEL_RE_FILTER, "De-chunking successful. Shrunk from %d to %d\n", size, newsize);
- return(newsize);
+ }
}
@@ -1481,7 +1003,7 @@ int remove_chunked_transfer_coding(char *buffer, const size_t size)
* Returns : N/A
*
*********************************************************************/
-void url_actions(struct http_request *http,
+void url_actions(struct http_request *http,
struct client_state *csp)
{
struct file_list *fl;
@@ -1513,23 +1035,48 @@ void url_actions(struct http_request *http,
* Returns : N/A
*
*********************************************************************/
-void apply_url_actions(struct current_action_spec *action,
- struct http_request *http,
+void apply_url_actions(struct current_action_spec *action,
+ struct http_request *http,
struct url_actions *b)
{
+ struct url_spec url[1];
+
if (b == NULL)
{
/* Should never happen */
return;
}
+ *url = dsplit(http->host);
+
+ /* if splitting the domain fails, punt */
+ if (url->dbuf == NULL)
+ {
+ return;
+ }
+
for (b = b->next; NULL != b; b = b->next)
{
- if (url_match(b->url, http))
+ if ((b->url->port == 0) || (b->url->port == http->port))
{
- merge_current_action(action, b->action);
+ if ((b->url->domain[0] == '\0') || (domaincmp(b->url, url) == 0))
+ {
+ if ((b->url->path == NULL) ||
+#ifdef REGEX
+ (regexec(b->url->preg, http->path, 0, NULL, 0) == 0)
+#else
+ (strncmp(b->url->path, http->path, b->url->pathlen) == 0)
+#endif
+ )
+ {
+ merge_current_action(action, b->action);
+ }
+ }
}
}
+
+ freez(url->dbuf);
+ freez(url->dvec);
}
@@ -1549,24 +1096,229 @@ void apply_url_actions(struct current_action_spec *action,
const struct forward_spec * forward_url(struct http_request *http,
struct client_state *csp)
{
- static const struct forward_spec fwd_default[1] = { FORWARD_SPEC_INITIALIZER };
+ static const struct forward_spec fwd_default[1] = { 0 }; /* All zeroes */
struct forward_spec *fwd = csp->config->forward;
+ struct url_spec url[1];
if (fwd == NULL)
{
- return fwd_default;
+ return(fwd_default);
+ }
+
+ *url = dsplit(http->host);
+
+ /* if splitting the domain fails, punt */
+ if (url->dbuf == NULL)
+ {
+ return(fwd_default);
}
while (fwd != NULL)
{
- if (url_match(fwd->url, http))
+ if ((fwd->url->port == 0) || (fwd->url->port == http->port))
{
- return fwd;
+ if ((fwd->url->domain[0] == '\0') || (domaincmp(fwd->url, url) == 0))
+ {
+ if ((fwd->url->path == NULL) ||
+#ifdef REGEX
+ (regexec(fwd->url->preg, http->path, 0, NULL, 0) == 0)
+#else
+ (strncmp(fwd->url->path, http->path, fwd->url->pathlen) == 0)
+#endif
+ )
+ {
+ freez(url->dbuf);
+ freez(url->dvec);
+ return(fwd);
+ }
+ }
}
fwd = fwd->next;
}
- return fwd_default;
+ freez(url->dbuf);
+ freez(url->dvec);
+ return(fwd_default);
+
+}
+
+
+/*********************************************************************
+ *
+ * Function : dsplit
+ *
+ * Description : Takes a domain and returns a pointer to a url_spec
+ * structure populated with dbuf, dcnt and dvec. The
+ * other fields in the structure that is returned are zero.
+ *
+ * Parameters :
+ * 1 : domain = a URL address
+ *
+ * Returns : url_spec structure populated with dbuf, dcnt and dvec.
+ *
+ *********************************************************************/
+struct url_spec dsplit(char *domain)
+{
+ struct url_spec ret[1];
+ char *v[BUFFER_SIZE];
+ int size;
+ char *p;
+
+ memset(ret, '\0', sizeof(*ret));
+
+ if (domain[strlen(domain) - 1] == '.')
+ {
+ ret->unanchored |= ANCHOR_RIGHT;
+ }
+
+ if (domain[0] == '.')
+ {
+ ret->unanchored |= ANCHOR_LEFT;
+ }
+
+ ret->dbuf = strdup(domain);
+
+ /* map to lower case */
+ for (p = ret->dbuf; *p ; p++) *p = tolower(*p);
+
+ /* split the domain name into components */
+ ret->dcnt = ssplit(ret->dbuf, ".", v, SZ(v), 1, 1);
+
+ if (ret->dcnt <= 0)
+ {
+ memset(ret, '\0', sizeof(ret));
+ return(*ret);
+ }
+
+ /* save a copy of the pointers in dvec */
+ size = ret->dcnt * sizeof(*ret->dvec);
+
+ if ((ret->dvec = (char **)malloc(size)))
+ {
+ memcpy(ret->dvec, v, size);
+ }
+
+ return(*ret);
+
+}
+
+
+/*********************************************************************
+ *
+ * Function : simple_domaincmp
+ *
+ * Description : Domain-wise Compare fqdn's. The comparison is
+ * both left- and right-anchored. The individual
+ * domain names are compared with simplematch().
+ * This is only used by domaincmp.
+ *
+ * Parameters :
+ * 1 : pv = array of patterns to compare
+ * 2 : fv = array of domain components to compare
+ * 3 : len = length of the arrays (both arrays are the
+ * same length - if they weren't, it couldn't
+ * possibly be a match).
+ *
+ * Returns : 0 => domains are equivalent, else no match.
+ *
+ *********************************************************************/
+static int simple_domaincmp(char **pv, char **fv, int len)
+{
+ int n;
+
+ for (n = 0; n < len; n++)
+ {
+ if (simplematch(pv[n], fv[n]))
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+
+}
+
+
+/*********************************************************************
+ *
+ * Function : domaincmp
+ *
+ * Description : Domain-wise Compare fqdn's. Governed by the bimap in
+ * pattern->unachored, the comparison is un-, left-,
+ * right-anchored, or both.
+ * The individual domain names are compared with
+ * simplematch().
+ *
+ * Parameters :
+ * 1 : pattern = a domain that may contain a '*' as a wildcard.
+ * 2 : fqdn = domain name against which the patterns are compared.
+ *
+ * Returns : 0 => domains are equivalent, else no match.
+ *
+ *********************************************************************/
+int domaincmp(struct url_spec *pattern, struct url_spec *fqdn)
+{
+ char **pv, **fv; /* vectors */
+ int plen, flen;
+ int unanchored = pattern->unanchored & (ANCHOR_RIGHT | ANCHOR_LEFT);
+
+ plen = pattern->dcnt;
+ flen = fqdn->dcnt;
+
+ if (flen < plen)
+ {
+ /* fqdn is too short to match this pattern */
+ return 1;
+ }
+
+ pv = pattern->dvec;
+ fv = fqdn->dvec;
+
+ if (unanchored == ANCHOR_LEFT)
+ {
+ /*
+ * Right anchored.
+ *
+ * Convert this into a fully anchored pattern with
+ * the fqdn and pattern the same length
+ */
+ fv += (flen - plen); /* flen - plen >= 0 due to check above */
+ return simple_domaincmp(pv, fv, plen);
+ }
+ else if (unanchored == 0)
+ {
+ /* Fully anchored, check length */
+ if (flen != plen)
+ {
+ return 1;
+ }
+ return simple_domaincmp(pv, fv, plen);
+ }
+ else if (unanchored == ANCHOR_RIGHT)
+ {
+ /* Left anchored, ignore all extra in fqdn */
+ return simple_domaincmp(pv, fv, plen);
+ }
+ else
+ {
+ /* Unanchored */
+ int n;
+ int maxn = flen - plen;
+ for (n = 0; n <= maxn; n++)
+ {
+ if (!simple_domaincmp(pv, fv, plen))
+ {
+ return 0;
+ }
+ /*
+ * Doesn't match from start of fqdn
+ * Try skipping first part of fqdn
+ */
+ fv++;
+ }
+ return 1;
+ }
+
}
diff --git a/filters.h b/filters.h
index 82b59cef..ec22e365 100644
--- a/filters.h
+++ b/filters.h
@@ -1,6 +1,6 @@
-#ifndef FILTERS_H_INCLUDED
-#define FILTERS_H_INCLUDED
-#define FILTERS_H_VERSION "$Id: filters.h,v 1.18 2002/03/25 22:12:45 oes Exp $"
+#ifndef _FILTERS_H
+#define _FILTERS_H
+#define FILTERS_H_VERSION "$Id: filters.h,v 1.10 2001/06/29 13:29:01 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.h,v $
@@ -8,12 +8,13 @@
* Purpose : Declares functions to parse/crunch headers and pages.
* Functions declared include:
* `acl_addr', `add_stats', `block_acl', `block_imageurl',
- * `block_url', `url_actions', `filter_popups', `forward_url'
+ * `block_url', `url_actions', `domaincmp', `dsplit',
+ * `filter_popups', `forward_url'
* `ij_untrusted_url', `intercept_url', `re_process_buffer',
* `show_proxy_args', and `trust_url'
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -39,36 +40,6 @@
*
* Revisions :
* $Log: filters.h,v $
- * Revision 1.18 2002/03/25 22:12:45 oes
- * Added fix for undefined INADDR_NONE on Solaris by Bart Schelstraete
- *
- * Revision 1.17 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.16 2002/01/17 21:01:02 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Revision 1.15 2001/10/10 16:44:16 oes
- * Added match_portlist function
- *
- * Revision 1.14 2001/10/07 15:41:40 oes
- * Added prototype for remove_chunked_transfer_coding
- *
- * Revision 1.13 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.12 2001/07/29 19:01:11 jongfoster
- * Changed _FILENAME_H to FILENAME_H_INCLUDED.
- * Added forward declarations for needed structures.
- *
- * Revision 1.11 2001/07/13 14:00:18 oes
- * - Introduced gif_deanimate_response
- * - Renamed re_process_buffer to pcrs_filter_response
- * - Removed all #ifdef PCRS
- *
* Revision 1.10 2001/06/29 13:29:01 oes
* Cleaned up and updated to reflect the changesin
* filters.c
@@ -195,43 +166,32 @@
extern "C" {
#endif
-
-struct access_control_addr;
-struct client_state;
-struct http_request;
-struct http_response;
-struct current_action_spec;
-struct url_actions;
-struct url_spec;
-
-
/*
* ACL checking
*/
-#ifdef FEATURE_ACL
+#ifdef ACL_FILES
extern int block_acl(struct access_control_addr *dst, struct client_state *csp);
extern int acl_addr(char *aspec, struct access_control_addr *aca);
-#endif /* def FEATURE_ACL */
-extern int match_portlist(const char *portlist, int port);
+#endif /* def ACL_FILES */
/*
* Interceptors
*/
extern struct http_response *block_url(struct client_state *csp);
extern struct http_response *redirect_url(struct client_state *csp);
-#ifdef FEATURE_COOKIE_JAR
+#ifdef TRUST_FILES
extern struct http_response *trust_url(struct client_state *csp);
-#endif /* def FEATURE_COOKIE_JAR */
+#endif /* def TRUST_FILES */
/*
* Request inspectors
*/
-#ifdef FEATURE_COOKIE_JAR
+#ifdef TRUST_FILES
extern int is_untrusted_url(struct client_state *csp);
-#endif /* def FEATURE_COOKIE_JAR */
-#ifdef FEATURE_IMAGE_BLOCKING
+#endif /* def TRUST_FILES */
+#ifdef IMAGE_BLOCKING
extern int is_imageurl(struct client_state *csp);
-#endif /* def FEATURE_IMAGE_BLOCKING */
+#endif /* def IMAGE_BLOCKING */
/*
* Determining applicable actions
@@ -246,19 +206,14 @@ extern void apply_url_actions(struct current_action_spec *action,
*/
extern const struct forward_spec *forward_url(struct http_request *http, struct client_state *csp);
+extern struct url_spec dsplit(char *domain);
+extern int domaincmp(struct url_spec *pattern, struct url_spec *fqdn);
+
/*
* Content modification
*/
extern char *pcrs_filter_response(struct client_state *csp);
extern char *gif_deanimate_response(struct client_state *csp);
-extern int remove_chunked_transfer_coding(char *buffer, const size_t size);
-
-/*
- * Solaris fix:
- */
-#ifndef INADDR_NONE
-#define INADDR_NONE -1
-#endif
/*
* Revision control strings from this header and associated .c file
@@ -270,7 +225,7 @@ extern const char filters_h_rcs[];
} /* extern "C" */
#endif
-#endif /* ndef FILTERS_H_INCLUDED */
+#endif /* ndef _FILTERS_H */
/*
Local Variables:
diff --git a/gateway.c b/gateway.c
index cff71726..13273f6c 100644
--- a/gateway.c
+++ b/gateway.c
@@ -1,4 +1,4 @@
-const char gateway_rcs[] = "$Id: gateway.c,v 1.14 2002/03/24 13:25:43 swa Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.2 2001/06/07 23:11:38 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/gateway.c,v $
@@ -8,13 +8,13 @@ const char gateway_rcs[] = "$Id: gateway.c,v 1.14 2002/03/24 13:25:43 swa Exp $"
* proxy).
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
- * by and Copyright (C) 1997 Anonymous Coders and
+ * by and Copyright (C) 1997 Anonymous Coders and
* Junkbusters Corporation. http://www.junkbusters.com
*
- * This program is free software; you can redistribute it
+ * 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
@@ -34,68 +34,6 @@ const char gateway_rcs[] = "$Id: gateway.c,v 1.14 2002/03/24 13:25:43 swa Exp $"
*
* Revisions :
* $Log: gateway.c,v $
- * Revision 1.14 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.13 2002/03/13 00:29:59 jongfoster
- * Killing warnings
- *
- * Revision 1.12 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.11 2002/03/08 17:46:04 jongfoster
- * Fixing int/size_t warnings
- *
- * Revision 1.10 2002/03/07 03:50:19 oes
- * - Improved handling of failed DNS lookups
- * - Fixed compiler warnings
- *
- * Revision 1.9 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.8 2001/09/13 20:10:12 jongfoster
- * Fixing missing #include under Windows
- *
- * Revision 1.7 2001/09/12 17:58:26 steudten
- *
- * add #include
- *
- * Revision 1.6 2001/09/10 10:41:16 oes
- * Added #include in.h
- *
- * Revision 1.5 2001/07/29 18:47:57 jongfoster
- * Adding missing #include project.h
- *
- * Revision 1.4 2001/07/24 12:47:06 oes
- * Applied BeOS support update by Eugenia
- *
- * Revision 1.3 2001/06/09 10:55:28 jongfoster
- * Changing BUFSIZ ==> BUFFER_SIZE
- *
* Revision 1.2 2001/06/07 23:11:38 jongfoster
* Removing gateways[] list - no longer used.
* Replacing function pointer in struct gateway with a directly
@@ -118,27 +56,12 @@ const char gateway_rcs[] = "$Id: gateway.c,v 1.14 2002/03/24 13:25:43 swa Exp $"
#include
#include
-
-#ifndef _WIN32
-#include
-#endif
-
#include
-#include
#ifdef _WIN32
#include
#endif /* def _WIN32 */
-#ifdef __BEOS__
-#include
-#endif /* def __BEOS__ */
-
-#ifdef __OS2__
-#include
-#endif /* def __OS2__ */
-
-#include "project.h"
#include "jcc.h"
#include "errlog.h"
#include "jbsockets.h"
@@ -146,10 +69,10 @@ const char gateway_rcs[] = "$Id: gateway.c,v 1.14 2002/03/24 13:25:43 swa Exp $"
const char gateway_h_rcs[] = GATEWAY_H_VERSION;
-static jb_socket socks4_connect(const struct forward_spec * fwd,
- const char * target_host,
- int target_port,
- struct client_state *csp);
+static int socks4_connect(const struct forward_spec * fwd,
+ const char * target_host,
+ int target_port,
+ struct client_state *csp);
#define SOCKS_REQUEST_GRANTED 90
@@ -193,9 +116,9 @@ static const char socks_userid[] = "anonymous";
* Returns : -1 => failure, else it is the socket file descriptor.
*
*********************************************************************/
-jb_socket forwarded_connect(const struct forward_spec * fwd,
- struct http_request *http,
- struct client_state *csp)
+int forwarded_connect(const struct forward_spec * fwd,
+ struct http_request *http,
+ struct client_state *csp)
{
const char * dest_host;
int dest_port;
@@ -228,7 +151,7 @@ jb_socket forwarded_connect(const struct forward_spec * fwd,
/* Should never get here */
log_error(LOG_LEVEL_FATAL, "SOCKS4 impossible internal error - bad SOCKS type.");
errno = EINVAL;
- return(JB_INVALID_SOCKET);
+ return(-1);
}
}
@@ -251,19 +174,19 @@ jb_socket forwarded_connect(const struct forward_spec * fwd,
* Returns : -1 => failure, else a socket file descriptor.
*
*********************************************************************/
-static jb_socket socks4_connect(const struct forward_spec * fwd,
- const char * target_host,
- int target_port,
- struct client_state *csp)
+static int socks4_connect(const struct forward_spec * fwd,
+ const char * target_host,
+ int target_port,
+ struct client_state *csp)
{
int web_server_addr;
- char cbuf[BUFFER_SIZE];
- char sbuf[BUFFER_SIZE];
+ unsigned char cbuf[BUFFER_SIZE];
+ unsigned char sbuf[BUFFER_SIZE];
struct socks_op *c = (struct socks_op *)cbuf;
struct socks_reply *s = (struct socks_reply *)sbuf;
- size_t n;
- size_t csiz;
- jb_socket sfd;
+ int n;
+ int csiz;
+ int sfd;
int err = 0;
char *errstr;
@@ -282,7 +205,7 @@ static jb_socket socks4_connect(const struct forward_spec * fwd,
if (err)
{
errno = EINVAL;
- return(JB_INVALID_SOCKET);
+ return(-1);
}
/* build a socks request for connection to the web server */
@@ -295,11 +218,6 @@ static jb_socket socks4_connect(const struct forward_spec * fwd,
{
case SOCKS_4:
web_server_addr = htonl(resolve_hostname_to_ip(target_host));
- if (web_server_addr == INADDR_NONE)
- {
- log_error(LOG_LEVEL_CONNECT, "socks4_connect: could not resolve target host %s", target_host);
- return(JB_INVALID_SOCKET);
- }
break;
case SOCKS_4A:
web_server_addr = 0x00000001;
@@ -307,16 +225,16 @@ static jb_socket socks4_connect(const struct forward_spec * fwd,
if (n > sizeof(cbuf))
{
errno = EINVAL;
- return(JB_INVALID_SOCKET);
+ return(-1);
}
- strcpy(cbuf + csiz, target_host);
+ strcpy(((char *)cbuf) + csiz, target_host);
csiz = n;
break;
default:
/* Should never get here */
log_error(LOG_LEVEL_FATAL, "SOCKS4 impossible internal error - bad SOCKS type.");
errno = EINVAL;
- return(JB_INVALID_SOCKET);
+ return(-1);
}
c->vn = 4;
@@ -331,23 +249,23 @@ static jb_socket socks4_connect(const struct forward_spec * fwd,
/* pass the request to the socks server */
sfd = connect_to(fwd->gateway_host, fwd->gateway_port, csp);
- if (sfd == JB_INVALID_SOCKET)
+ if (sfd < 0)
{
- return(JB_INVALID_SOCKET);
+ return(-1);
}
- if (write_socket(sfd, (char *)c, csiz))
+ if ((n = write_socket(sfd, (char *)c, csiz)) != csiz)
{
log_error(LOG_LEVEL_CONNECT, "SOCKS4 negotiation write failed...");
close_socket(sfd);
- return(JB_INVALID_SOCKET);
+ return(-1);
}
- if (read_socket(sfd, sbuf, sizeof(sbuf)) != sizeof(*s))
+ if ((n = read_socket(sfd, sbuf, sizeof(sbuf))) != sizeof(*s))
{
log_error(LOG_LEVEL_CONNECT, "SOCKS4 negotiation read failed...");
close_socket(sfd);
- return(JB_INVALID_SOCKET);
+ return(-1);
}
switch (s->cd)
@@ -371,7 +289,7 @@ static jb_socket socks4_connect(const struct forward_spec * fwd,
errno = EACCES;
break;
default:
- errstr = cbuf;
+ errstr = (char *) cbuf;
errno = ENOENT;
sprintf(errstr,
"SOCKS request rejected for reason code %d\n", s->cd);
@@ -380,7 +298,7 @@ static jb_socket socks4_connect(const struct forward_spec * fwd,
log_error(LOG_LEVEL_CONNECT, "socks4_connect: %s ...", errstr);
close_socket(sfd);
- return(JB_INVALID_SOCKET);
+ return(-1);
}
diff --git a/gateway.h b/gateway.h
index d96bc58d..5f1eb826 100644
--- a/gateway.h
+++ b/gateway.h
@@ -1,6 +1,6 @@
-#ifndef GATEWAY_H_INCLUDED
-#define GATEWAY_H_INCLUDED
-#define GATEWAY_H_VERSION "$Id: gateway.h,v 1.6 2002/03/25 22:12:45 oes Exp $"
+#ifndef _GATEWAY_H
+#define _GATEWAY_H
+#define GATEWAY_H_VERSION "$Id: gateway.h,v 1.1.1.1 2001/05/15 13:58:54 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/gateway.h,v $
@@ -10,7 +10,7 @@
* proxy). Also contains the list of gateway types.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -36,48 +36,6 @@
*
* Revisions :
* $Log: gateway.h,v $
- * Revision 1.6 2002/03/25 22:12:45 oes
- * Added fix for undefined INADDR_NONE on Solaris by Bart Schelstraete
- *
- * Revision 1.5 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.4 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.3 2001/07/29 18:58:15 jongfoster
- * Removing nested #includes, adding forward declarations for needed
- * structures, and changing the #define _FILENAME_H to FILENAME_H_INCLUDED.
- *
- * Revision 1.2 2001/06/07 23:12:14 jongfoster
- * Removing gateways[] list - no longer used.
- * Replacing function pointer in struct gateway with a directly
- * called function forwarded_connect(), which can do the common
- * task of deciding whether to connect to the web server or HTTP
- * proxy.
- * Replacing struct gateway with struct forward_spec
- *
* Revision 1.1.1.1 2001/05/15 13:58:54 oes
* Initial import of version 2.9.3 source tree
*
@@ -85,28 +43,17 @@
*********************************************************************/
+#include "project.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-struct forward_spec;
-struct http_request;
-struct client_state;
+extern int forwarded_connect(const struct forward_spec * fwd,
+ struct http_request *http,
+ struct client_state *csp);
-extern jb_socket forwarded_connect(const struct forward_spec * fwd,
- struct http_request *http,
- struct client_state *csp);
-
-/*
- * Solaris fix
- */
-#ifndef INADDR_NONE
-#define INADDR_NONE -1
-#endif
-
-/*
- * Revision control strings from this header and associated .c file
- */
+/* Revision control strings from this header and associated .c file */
extern const char gateway_rcs[];
extern const char gateway_h_rcs[];
@@ -114,7 +61,7 @@ extern const char gateway_h_rcs[];
} /* extern "C" */
#endif
-#endif /* ndef GATEWAY_H_INCLUDED */
+#endif /* ndef _GATEWAY_H */
/*
Local Variables:
diff --git a/icons/denyrule.ico b/icons/denyrule.ico
new file mode 100644
index 00000000..e5aa2506
Binary files /dev/null and b/icons/denyrule.ico differ
diff --git a/icons/icon1.ico b/icons/icon1.ico
new file mode 100644
index 00000000..b96fe7c2
Binary files /dev/null and b/icons/icon1.ico differ
diff --git a/icons/idle.ico b/icons/idle.ico
index 5ef20fc1..99470b54 100644
Binary files a/icons/idle.ico and b/icons/idle.ico differ
diff --git a/icons/privoxy.ico b/icons/junkbust.ico
similarity index 59%
rename from icons/privoxy.ico
rename to icons/junkbust.ico
index 4c96d0b1..41aafd0a 100644
Binary files a/icons/privoxy.ico and b/icons/junkbust.ico differ
diff --git a/icons/os2.ico b/icons/os2.ico
deleted file mode 100644
index b5fd21fc..00000000
Binary files a/icons/os2.ico and /dev/null differ
diff --git a/icons/os20.ico b/icons/os20.ico
deleted file mode 100644
index ef5995b1..00000000
Binary files a/icons/os20.ico and /dev/null differ
diff --git a/icons/os21.ico b/icons/os21.ico
deleted file mode 100644
index cc61b61d..00000000
Binary files a/icons/os21.ico and /dev/null differ
diff --git a/icons/os22.ico b/icons/os22.ico
deleted file mode 100644
index d357dfba..00000000
Binary files a/icons/os22.ico and /dev/null differ
diff --git a/icons/os23.ico b/icons/os23.ico
deleted file mode 100644
index 8ac037f0..00000000
Binary files a/icons/os23.ico and /dev/null differ
diff --git a/icons/os24.ico b/icons/os24.ico
deleted file mode 100644
index f2b87f71..00000000
Binary files a/icons/os24.ico and /dev/null differ
diff --git a/icons/os25.ico b/icons/os25.ico
deleted file mode 100644
index 5bc68b5e..00000000
Binary files a/icons/os25.ico and /dev/null differ
diff --git a/icons/os26.ico b/icons/os26.ico
deleted file mode 100644
index 408d89ef..00000000
Binary files a/icons/os26.ico and /dev/null differ
diff --git a/icons/os27.ico b/icons/os27.ico
deleted file mode 100644
index 00a88148..00000000
Binary files a/icons/os27.ico and /dev/null differ
diff --git a/icons/os28.ico b/icons/os28.ico
deleted file mode 100644
index 91536360..00000000
Binary files a/icons/os28.ico and /dev/null differ
diff --git a/install-sh b/install-sh
deleted file mode 100755
index e9de2384..00000000
--- a/install-sh
+++ /dev/null
@@ -1,251 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/intermediate.action b/intermediate.action
deleted file mode 100644
index ab6689e5..00000000
--- a/intermediate.action
+++ /dev/null
@@ -1,90 +0,0 @@
-######################################################################
-#
-# File : $Source: /cvsroot/ijbswa/current/intermediate.action,v $
-#
-# $Id: intermediate.action,v 1.3 2002/03/26 22:29:54 swa Exp $
-#
-# Purpose : More agressive actions file, see
-# http://www.privoxy.org/faq/questions.html#CONFIGFILES
-#
-# Copyright : Written by and Copyright
-# Privoxy team. http://www.privoxy.org/
-#
-# Based on the Internet Junkbuster originally written
-# by and Copyright (C) 1997 Anonymous Coders and
-# Junkbusters Corporation. http://www.junkbusters.com
-#
-# We value your feedback. However, to provide you with the best support,
-# please note:
-#
-# * Use the support forum to get help:
-# http://sourceforge.net/tracker/?group_id=11118&atid=211118
-# * Submit bugs only thru our bug forum:
-# http://sourceforge.net/tracker/?group_id=11118&atid=111118
-# Make sure that the bug has not already been submitted. Please try
-# to verify that it is a Junkbuster bug, and not a browser or site
-# bug first. If you are using your own custom configuration, please
-# try the stock configs to see if the problem is a configuration
-# related bug. And if not using the latest development snapshot,
-# please try the latest one. Or even better, CVS sources.
-# * Submit feature requests only thru our feature request forum:
-# http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse
-#
-# For any other issues, feel free to use the mailing lists:
-# http://sourceforge.net/mail/?group_id=11118
-#
-# Anyone interested in actively participating in development and related
-# discussions can join the appropriate mailing list here:
-# http://sourceforge.net/mail/?group_id=11118. Archives are available
-# here too.
-#
-######################################################################
-
-######################################################################
-# Aliases
-######################################################################
-
-######################################################################
-# Defaults
-######################################################################
-
-######################################################################
-# Specials
-######################################################################
-
-######################################################################
-# Imagelist:
-######################################################################
-
-######################################################################
-# Blocklist:
-######################################################################
-
-######################################################################
-#
-# Copyright : Written by and Copyright (C) 2001 the SourceForge
-# Privoxy team. http://www.privoxy.org/
-#
-# Based on the Internet Junkbuster originally written
-# by and Copyright (C) 1997 Anonymous Coders and
-# Junkbusters Corporation. http://www.junkbusters.com
-#
-# 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.
-#
-######################################################################
diff --git a/jbsockets.c b/jbsockets.c
index 8a407e26..3f54271a 100644
--- a/jbsockets.c
+++ b/jbsockets.c
@@ -1,4 +1,4 @@
-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.29 2002/03/26 22:29:54 swa Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.13 2001/07/15 13:56:57 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
@@ -9,7 +9,7 @@ const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.29 2002/03/26 22:29:54 swa Ex
* on many platforms.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -35,86 +35,6 @@ const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.29 2002/03/26 22:29:54 swa Ex
*
* Revisions :
* $Log: jbsockets.c,v $
- * Revision 1.29 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.28 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.27 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.26 2002/03/11 22:07:02 david__schmidt
- * OS/2 port maintenance:
- * - Fixed EMX build - it had decayed a little
- * - Fixed inexplicable crash during FD_ZERO - must be due to a bad macro.
- * substituted a memset for now.
- *
- * Revision 1.25 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.24 2002/03/07 03:51:36 oes
- * - Improved handling of failed DNS lookups
- * - Fixed compiler warnings etc
- *
- * Revision 1.23 2002/03/05 00:36:01 jongfoster
- * Fixing bug 514988 - unable to restart JunkBuster
- *
- * Revision 1.22 2002/03/04 02:08:02 david__schmidt
- * Enable web editing of actions file on OS/2 (it had been broken all this time!)
- *
- * Revision 1.21 2002/01/09 14:32:33 oes
- * Added support for gethostbyname_r and gethostbyaddr_r.
- *
- * Revision 1.20 2001/11/16 00:48:48 jongfoster
- * Enabling duplicate-socket detection for all platforms, not
- * just Win32.
- *
- * Revision 1.19 2001/10/25 03:40:47 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.18 2001/09/21 23:02:02 david__schmidt
- * Cleaning up 2 compiler warnings on OS/2.
- *
- * Revision 1.17 2001/09/13 20:11:46 jongfoster
- * Fixing 2 compiler warnings under Win32
- *
- * Revision 1.16 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.15 2001/07/29 17:40:43 jongfoster
- * Fixed compiler warning by adding a cast
- *
- * Revision 1.14 2001/07/18 13:47:59 oes
- * Eliminated dirty hack for getsockbyname()
- *
* Revision 1.13 2001/07/15 13:56:57 jongfoster
* Removing unused local variable.
*
@@ -179,9 +99,7 @@ const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.29 2002/03/26 22:29:54 swa Ex
#else
-#ifndef __OS2__
#include
-#endif
#include
#include
#include
@@ -190,20 +108,11 @@ const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.29 2002/03/26 22:29:54 swa Ex
#ifndef __BEOS__
#include
-#ifndef __OS2__
#include
-#endif
#else
#include
#endif
-#if defined(__EMX__) || defined (__OS2__)
-#include /* OS/2/EMX needs a little help with select */
-#ifdef __OS2__
-#include
-#endif
-#endif
-
#endif
#include "project.h"
@@ -227,72 +136,58 @@ const char jbsockets_h_rcs[] = JBSOCKETS_H_VERSION;
* 3 : csp = Current client state (buffers, headers, etc...)
* Not modified, only used for source IP and ACL.
*
- * Returns : JB_INVALID_SOCKET => failure, else it is the socket
- * file descriptor.
+ * Returns : -1 => failure, else it is the socket file descriptor.
*
*********************************************************************/
-jb_socket connect_to(const char *host, int portnum, struct client_state *csp)
+int connect_to(const char *host, int portnum, struct client_state *csp)
{
struct sockaddr_in inaddr;
- jb_socket fd;
- int addr;
+ int fd, addr;
fd_set wfds;
struct timeval tv[1];
#if !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA)
int flags;
#endif /* !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA) */
-#ifdef FEATURE_ACL
+#ifdef ACL_FILES
struct access_control_addr dst[1];
-#endif /* def FEATURE_ACL */
+#endif /* def ACL_FILES */
memset((char *)&inaddr, 0, sizeof inaddr);
- if ((addr = resolve_hostname_to_ip(host)) == INADDR_NONE)
+ if ((addr = resolve_hostname_to_ip(host)) == -1)
{
csp->http->host_ip_addr_str = strdup("unknown");
- return(JB_INVALID_SOCKET);
+ return(-1);
}
-#ifdef FEATURE_ACL
- dst->addr = ntohl((unsigned long) addr);
+#ifdef ACL_FILES
+ dst->addr = ntohl(addr);
dst->port = portnum;
if (block_acl(dst, csp))
{
-#ifdef __OS2__
- errno = SOCEPERM;
-#else
errno = EPERM;
-#endif
- return(JB_INVALID_SOCKET);
+ return(-1);
}
-#endif /* def FEATURE_ACL */
+#endif /* def ACL_FILES */
inaddr.sin_addr.s_addr = addr;
inaddr.sin_family = AF_INET;
csp->http->host_ip_addr_str = strdup(inet_ntoa(inaddr.sin_addr));
-#ifndef _WIN32
if (sizeof(inaddr.sin_port) == sizeof(short))
-#endif /* ndef _WIN32 */
{
- inaddr.sin_port = htons((unsigned short) portnum);
+ inaddr.sin_port = htons((short)portnum);
}
-#ifndef _WIN32
else
{
- inaddr.sin_port = htonl((unsigned long)portnum);
+ inaddr.sin_port = htonl(portnum);
}
-#endif /* ndef _WIN32 */
-#ifdef _WIN32
- if ((fd = socket(inaddr.sin_family, SOCK_STREAM, 0)) == JB_INVALID_SOCKET)
-#else
if ((fd = socket(inaddr.sin_family, SOCK_STREAM, 0)) < 0)
-#endif
{
- return(JB_INVALID_SOCKET);
+ return(-1);
}
#ifdef TCP_NODELAY
@@ -302,45 +197,39 @@ jb_socket connect_to(const char *host, int portnum, struct client_state *csp)
}
#endif /* def TCP_NODELAY */
-#if !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA) && !defined(__OS2__)
+#if !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA)
if ((flags = fcntl(fd, F_GETFL, 0)) != -1)
{
flags |= O_NDELAY;
fcntl(fd, F_SETFL, flags);
}
-#endif /* !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA) && !defined(__OS2__) */
+#endif /* !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA) */
- while (connect(fd, (struct sockaddr *) & inaddr, sizeof inaddr) == JB_INVALID_SOCKET)
+ while (connect(fd, (struct sockaddr *) & inaddr, sizeof inaddr) == -1)
{
#ifdef _WIN32
if (errno == WSAEINPROGRESS)
-#elif __OS2__
- if (sock_errno() == EINPROGRESS)
#else /* ifndef _WIN32 */
if (errno == EINPROGRESS)
-#endif /* ndef _WIN32 || __OS2__ */
+#endif /* ndef _WIN32 */
{
break;
}
-#ifdef __OS2__
- if (sock_errno() != EINTR)
-#else
if (errno != EINTR)
-#endif /* __OS2__ */
{
close_socket(fd);
- return(JB_INVALID_SOCKET);
+ return(-1);
}
}
-#if !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA) && !defined(__OS2__)
+#if !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA)
if (flags != -1)
{
flags &= ~O_NDELAY;
fcntl(fd, F_SETFL, flags);
}
-#endif /* !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA) && !defined(__OS2__) */
+#endif /* !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA) */
/* wait for connection to complete */
FD_ZERO(&wfds);
@@ -349,11 +238,10 @@ jb_socket connect_to(const char *host, int portnum, struct client_state *csp)
tv->tv_sec = 30;
tv->tv_usec = 0;
- /* MS Windows uses int, not SOCKET, for the 1st arg of select(). Wierd! */
- if (select((int)fd + 1, NULL, &wfds, NULL, tv) <= 0)
+ if (select(fd + 1, NULL, &wfds, NULL, tv) <= 0)
{
close_socket(fd);
- return(JB_INVALID_SOCKET);
+ return(-1);
}
return(fd);
@@ -371,51 +259,24 @@ jb_socket connect_to(const char *host, int portnum, struct client_state *csp)
* 2 : buf = pointer to data to be written.
* 3 : len = length of data to be written to the socket "fd".
*
- * Returns : 0 on success (entire buffer sent).
- * nonzero on error.
+ * Returns : Win32 & Unix: If no error occurs, returns the total number of
+ * bytes sent, which can be less than the number
+ * indicated by len. Otherwise, returns (-1).
*
*********************************************************************/
-int write_socket(jb_socket fd, const char *buf, size_t len)
+int write_socket(int fd, const char *buf, int len)
{
- if (len == 0)
- {
- return 0;
- }
-
- if (len < 0)
+ if (len <= 0)
{
- return 1;
+ return(0);
}
log_error(LOG_LEVEL_LOG, "%N", len, buf);
-#if defined(_WIN32)
- return (send(fd, buf, (int)len, 0) != (int)len);
-#elif defined(__BEOS__) || defined(AMIGA)
- return (send(fd, buf, len, 0) != len);
-#elif defined(__OS2__)
- /*
- * Break the data up into SOCKET_SEND_MAX chunks for sending...
- * OS/2 seemed to complain when the chunks were too large.
- */
-#define SOCKET_SEND_MAX 65000
- {
- int write_len = 0, send_len, send_rc = 0, i = 0;
- while ((i < len) && (send_rc != -1))
- {
- if ((i + SOCKET_SEND_MAX) > len)
- send_len = len - i;
- else
- send_len = SOCKET_SEND_MAX;
- send_rc = send(fd,(char*)buf + i, send_len, 0);
- if (send_rc == -1)
- return 1;
- i = i + send_len;
- }
- return 0;
- }
+#if defined(_WIN32) || defined(__BEOS__) || defined(AMIGA)
+ return( send(fd, buf, len, 0));
#else
- return (write(fd, buf, len) != len);
+ return( write(fd, buf, len));
#endif
}
@@ -439,26 +300,24 @@ int write_socket(jb_socket fd, const char *buf, size_t len)
* smaller than the number of bytes requested; this may hap-
* pen for example because fewer bytes are actually available
* right now (maybe because we were close to end-of-file, or
- * because we are reading from a pipe, or from a terminal,
- * or because read() was interrupted by a signal). On error,
+ * because we are reading from a pipe, or from a terminal),
+ * or because read() was interrupted by a signal. On error,
* -1 is returned, and errno is set appropriately. In this
* case it is left unspecified whether the file position (if
* any) changes.
*
*********************************************************************/
-int read_socket(jb_socket fd, char *buf, int len)
+int read_socket(int fd, char *buf, int len)
{
if (len <= 0)
{
return(0);
}
-#if defined(_WIN32)
- return(recv(fd, buf, len, 0));
-#elif defined(__BEOS__) || defined(AMIGA) || defined(__OS2__)
- return(recv(fd, buf, (size_t)len, 0));
+#if defined(_WIN32) || defined(__BEOS__) || defined(AMIGA)
+ return( recv(fd, buf, len, 0));
#else
- return(read(fd, buf, (size_t)len));
+ return( read(fd, buf, len));
#endif
}
@@ -475,14 +334,12 @@ int read_socket(jb_socket fd, char *buf, int len)
* Returns : void
*
*********************************************************************/
-void close_socket(jb_socket fd)
+void close_socket(int fd)
{
#if defined(_WIN32) || defined(__BEOS__)
closesocket(fd);
#elif defined(AMIGA)
CloseSocket(fd);
-#elif defined(__OS2__)
- soclose(fd);
#else
close(fd);
#endif
@@ -500,69 +357,44 @@ void close_socket(jb_socket fd)
* Parameters :
* 1 : hostnam = TCP/IP address to bind/listen to
* 2 : portnum = port to listen on
- * 3 : pfd = pointer used to return file descriptor.
*
- * Returns : if success, returns 0 and sets *pfd.
- * if failure, returns -3 if address is in use,
- * -2 if address unresolvable,
- * -1 otherwise
+ * Returns : if success, return file descriptor
+ * if failure, returns -2 if address is in use, otherwise -1
+ *
*********************************************************************/
-int bind_port(const char *hostnam, int portnum, jb_socket *pfd)
+int bind_port(const char *hostnam, int portnum)
{
struct sockaddr_in inaddr;
- jb_socket fd;
-#ifndef _WIN32
+ int fd;
int one = 1;
-#endif /* ndef _WIN32 */
-
- *pfd = JB_INVALID_SOCKET;
memset((char *)&inaddr, '\0', sizeof inaddr);
inaddr.sin_family = AF_INET;
inaddr.sin_addr.s_addr = resolve_hostname_to_ip(hostnam);
- if (inaddr.sin_addr.s_addr == INADDR_NONE)
- {
- return(-2);
- }
-
-#ifndef _WIN32
if (sizeof(inaddr.sin_port) == sizeof(short))
-#endif /* ndef _WIN32 */
{
- inaddr.sin_port = htons((unsigned short) portnum);
+ inaddr.sin_port = htons((short)portnum);
}
-#ifndef _WIN32
else
{
- inaddr.sin_port = htonl((unsigned long) portnum);
+ inaddr.sin_port = htonl(portnum);
}
-#endif /* ndef _WIN32 */
fd = socket(AF_INET, SOCK_STREAM, 0);
-#ifdef _WIN32
- if (fd == JB_INVALID_SOCKET)
-#else
if (fd < 0)
-#endif
{
return(-1);
}
#ifndef _WIN32
/*
- * This is not needed for Win32 - in fact, it stops
+ * FIXME: This is not needed for Win32 - in fact, it stops
* duplicate instances of JunkBuster from being caught.
- *
- * On UNIX, we assume the user is sensible enough not
- * to start JunkBuster multiple times on the same IP.
- * Without this, stopping and restarting JunkBuster
- * from a script fails.
- * Note: SO_REUSEADDR is meant to only take over
- * sockets which are *not* in listen state in Linux,
- * e.g. sockets in TIME_WAIT. YMMV.
+ * Is this really needed under UNIX, or should it be taked out?
+ * -- Jon
*/
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one));
#endif /* ndef _WIN32 */
@@ -576,7 +408,7 @@ int bind_port(const char *hostnam, int portnum, jb_socket *pfd)
if (errno == EADDRINUSE)
#endif
{
- return(-3);
+ return(-2);
}
else
{
@@ -592,8 +424,7 @@ int bind_port(const char *hostnam, int portnum, jb_socket *pfd)
}
}
- *pfd = fd;
- return 0;
+ return fd;
}
@@ -614,45 +445,23 @@ int bind_port(const char *hostnam, int portnum, jb_socket *pfd)
* On an error it returns 0 (FALSE).
*
*********************************************************************/
-int accept_connection(struct client_state * csp, jb_socket fd)
+int accept_connection(struct client_state * csp, int fd)
{
struct sockaddr_in client, server;
struct hostent *host = NULL;
- jb_socket afd;
-#if defined(_WIN32) || defined(__OS2__)
- /* Wierdness - fix a warning. */
- int c_length, s_length;
-#else
- size_t c_length, s_length;
-#endif
-#if defined(HAVE_GETHOSTBYADDR_R_8_ARGS) || defined(HAVE_GETHOSTBYADDR_R_7_ARGS) || defined(HAVE_GETHOSTBYADDR_R_5_ARGS)
- struct hostent result;
-#if defined(HAVE_GETHOSTBYADDR_R_5_ARGS)
- struct hostent_data hdata;
-#else
- char hbuf[HOSTENT_BUFFER_SIZE];
- int thd_err;
-#endif /* def HAVE_GETHOSTBYADDR_R_5_ARGS */
-#endif /* def HAVE_GETHOSTBYADDR_R_(8|7|5)_ARGS */
+ int afd, c_length, s_length;
c_length = s_length = sizeof(client);
-#ifdef _WIN32
- afd = accept (fd, (struct sockaddr *) &client, &c_length);
- if (afd == JB_INVALID_SOCKET)
- {
- return 0;
- }
-#else
do
{
afd = accept (fd, (struct sockaddr *) &client, &c_length);
} while (afd < 1 && errno == EINTR);
+
if (afd < 0)
{
return 0;
}
-#endif
/*
* Determine the IP-Adress that the client used to reach us
@@ -661,30 +470,8 @@ int accept_connection(struct client_state * csp, jb_socket fd)
if (!getsockname(afd, (struct sockaddr *) &server, &s_length))
{
csp->my_ip_addr_str = strdup(inet_ntoa(server.sin_addr));
-#if defined(HAVE_GETHOSTBYADDR_R_8_ARGS)
- gethostbyaddr_r((const char *)&server.sin_addr,
- sizeof(server.sin_addr), AF_INET,
- &result, hbuf, HOSTENT_BUFFER_SIZE,
- &host, &thd_err);
-#elif defined(HAVE_GETHOSTBYADDR_R_7_ARGS)
- host = gethostbyaddr_r((const char *)&server.sin_addr,
- sizeof(server.sin_addr), AF_INET,
- &result, hbuf, HOSTENT_BUFFER_SIZE, &thd_err);
-#elif defined(HAVE_GETHOSTBYADDR_R_5_ARGS)
- if (0 == gethostbyaddr_r((const char *)&server.sin_addr,
- sizeof(server.sin_addr), AF_INET,
- &result, &hdata))
- {
- host = &result;
- }
- else
- {
- host = NULL;
- }
-#else
- host = gethostbyaddr((const char *)&server.sin_addr,
- sizeof(server.sin_addr), AF_INET);
-#endif
+
+ host = gethostbyaddr(&server.sin_addr, sizeof(server.sin_addr), AF_INET);
if (host == NULL)
{
log_error(LOG_LEVEL_ERROR, "Unable to get my own hostname: %E\n");
@@ -714,22 +501,13 @@ int accept_connection(struct client_state * csp, jb_socket fd)
* Parameters :
* 1 : host = hostname to resolve
*
- * Returns : INADDR_NONE => failure, INADDR_ANY or tcp/ip address if succesful.
+ * Returns : -1 => failure, INADDR_ANY or tcp/ip address if succesful.
*
*********************************************************************/
-unsigned long resolve_hostname_to_ip(const char *host)
+int resolve_hostname_to_ip(const char *host)
{
struct sockaddr_in inaddr;
struct hostent *hostp;
-#if defined(HAVE_GETHOSTBYNAME_R_6_ARGS) || defined(HAVE_GETHOSTBYNAME_R_5_ARGS) || defined(HAVE_GETHOSTBYNAME_R_3_ARGS)
- struct hostent result;
-#if defined(HAVE_GETHOSTBYNAME_R_6_ARGS) || defined(HAVE_GETHOSTBYNAME_R_5_ARGS)
- char hbuf[HOSTENT_BUFFER_SIZE];
- int thd_err;
-#else /* defined(HAVE_GETHOSTBYNAME_R_3_ARGS) */
- struct hostent_data hdata;
-#endif /* def HAVE_GETHOSTBYNAME_R_(6|5)_ARGS */
-#endif /* def HAVE_GETHOSTBYNAME_R_(6|5|3)_ARGS */
if ((host == NULL) || (*host == '\0'))
{
@@ -740,29 +518,10 @@ unsigned long resolve_hostname_to_ip(const char *host)
if ((inaddr.sin_addr.s_addr = inet_addr(host)) == -1)
{
-#if defined(HAVE_GETHOSTBYNAME_R_6_ARGS)
- gethostbyname_r(host, &result, hbuf,
- HOSTENT_BUFFER_SIZE, &hostp, &thd_err);
-#elif defined(HAVE_GETHOSTBYNAME_R_5_ARGS)
- hostp = gethostbyname_r(host, &result, hbuf,
- HOSTENT_BUFFER_SIZE, &thd_err);
-#elif defined(HAVE_GETHOSTBYNAME_R_3_ARGS)
- if (0 == gethostbyname_r(host, &result, &hdata))
- {
- hostp = &result;
- }
- else
- {
- hostp = NULL;
- }
-#else
- hostp = gethostbyname(host);
-#endif /* def HAVE_GETHOSTBYNAME_R_(6|5|3)_ARGS */
- if (hostp == NULL)
+ if ((hostp = gethostbyname(host)) == NULL)
{
errno = EINVAL;
- log_error(LOG_LEVEL_ERROR, "could not resolve hostname %s", host);
- return(INADDR_NONE);
+ return(-1);
}
if (hostp->h_addrtype != AF_INET)
{
@@ -770,9 +529,8 @@ unsigned long resolve_hostname_to_ip(const char *host)
errno = WSAEPROTOTYPE;
#else
errno = EPROTOTYPE;
-#endif
- log_error(LOG_LEVEL_ERROR, "hostname %s resolves to unknown address type.", host);
- return(INADDR_NONE);
+#endif
+ return(-1);
}
memcpy(
(char *) &inaddr.sin_addr,
diff --git a/jbsockets.h b/jbsockets.h
index 31393301..7c1ee588 100644
--- a/jbsockets.h
+++ b/jbsockets.h
@@ -1,6 +1,6 @@
-#ifndef JBSOCKETS_H_INCLUDED
-#define JBSOCKETS_H_INCLUDED
-#define JBSOCKETS_H_VERSION "$Id: jbsockets.h,v 1.7 2002/03/24 13:25:43 swa Exp $"
+#ifndef _JBSOCKETS_H
+#define _JBSOCKETS_H
+#define JBSOCKETS_H_VERSION "$Id: jbsockets.h,v 1.1.1.1 2001/05/15 13:58:54 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jbsockets.h,v $
@@ -11,7 +11,7 @@
* on many platforms.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -37,47 +37,6 @@
*
* Revisions :
* $Log: jbsockets.h,v $
- * Revision 1.7 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.6 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.5 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.4 2002/03/07 03:51:36 oes
- * - Improved handling of failed DNS lookups
- * - Fixed compiler warnings etc
- *
- * Revision 1.3 2001/07/29 19:01:11 jongfoster
- * Changed _FILENAME_H to FILENAME_H_INCLUDED.
- * Added forward declarations for needed structures.
- *
- * Revision 1.2 2001/06/07 23:06:09 jongfoster
- * The host parameter to connect_to() is now const.
- *
* Revision 1.1.1.1 2001/05/15 13:58:54 oes
* Initial import of version 2.9.3 source tree
*
@@ -85,23 +44,19 @@
*********************************************************************/
-#include "project.h"
-
#ifdef __cplusplus
extern "C" {
#endif
-struct client_state;
-
-extern jb_socket connect_to(const char *host, int portnum, struct client_state *csp);
-extern int write_socket(jb_socket fd, const char *buf, size_t n);
-extern int read_socket(jb_socket fd, char *buf, int n);
-extern void close_socket(jb_socket fd);
+extern int connect_to(const char *host, int portnum, struct client_state *csp);
+extern int write_socket(int fd, const char *buf, int n);
+extern int read_socket(int fd, char *buf, int n);
+extern void close_socket(int fd);
-extern int bind_port(const char *hostnam, int portnum, jb_socket *pfd);
-extern int accept_connection(struct client_state * csp, jb_socket fd);
+extern int bind_port(const char *hostnam, int portnum);
+extern int accept_connection(struct client_state * csp, int fd);
-extern unsigned long resolve_hostname_to_ip(const char *host);
+extern int resolve_hostname_to_ip(const char *host);
/* Revision control strings from this header and associated .c file */
extern const char jbsockets_rcs[];
@@ -111,7 +66,7 @@ extern const char jbsockets_h_rcs[];
} /* extern "C" */
#endif
-#endif /* ndef JBSOCKETS_H_INCLUDED */
+#endif /* ndef _JBSOCKETS_H */
/*
Local Variables:
diff --git a/jcc.c b/jcc.c
index f3cd6e96..9f3083da 100644
--- a/jcc.c
+++ b/jcc.c
@@ -1,19 +1,19 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.87 2002/03/26 22:29:54 swa Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.26 2001/07/18 12:31:36 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
*
- * Purpose : Main file. Contains main() method, main loop, and
+ * Purpose : Main file. Contains main() method, main loop, and
* the main connection-handling function.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
- * by and Copyright (C) 1997 Anonymous Coders and
+ * by and Copyright (C) 1997 Anonymous Coders and
* Junkbusters Corporation. http://www.junkbusters.com
*
- * This program is free software; you can redistribute it
+ * 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
@@ -33,280 +33,6 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.87 2002/03/26 22:29:54 swa Exp $";
*
* Revisions :
* $Log: jcc.c,v $
- * Revision 1.87 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.86 2002/03/25 17:04:55 david__schmidt
- * Workaround for closing the jarfile before load_config() comes around again
- *
- * Revision 1.85 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.84 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.83 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.82 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.81 2002/03/12 01:42:50 oes
- * Introduced modular filters
- *
- * Revision 1.80 2002/03/11 22:07:05 david__schmidt
- * OS/2 port maintenance:
- * - Fixed EMX build - it had decayed a little
- * - Fixed inexplicable crash during FD_ZERO - must be due to a bad macro.
- * substituted a memset for now.
- *
- * Revision 1.79 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.78 2002/03/08 21:35:04 oes
- * Added optional group supplement to --user option. Will now use default group of user if no group given
- *
- * Revision 1.77 2002/03/07 03:52:06 oes
- * - Fixed compiler warnings etc
- * - Improved handling of failed DNS lookups
- *
- * Revision 1.76 2002/03/06 22:54:35 jongfoster
- * Automated function-comment nitpicking.
- *
- * Revision 1.75 2002/03/06 10:02:19 oes
- * Fixed stupid bug when --user was not given
- *
- * Revision 1.74 2002/03/06 00:49:31 jongfoster
- * Fixing warning on Windows
- * Making #ifdefs that refer to the same variable consistently
- * use #ifdef unix rather than mixing #ifdef unix & #ifndef OS2
- *
- * Revision 1.73 2002/03/05 23:57:30 hal9
- * Stray character 's' on line 1618 was breaking build.
- *
- * Revision 1.72 2002/03/05 21:33:45 david__schmidt
- * - Re-enable OS/2 building after new parms were added
- * - Fix false out of memory report when resolving CGI templates when no IP
- * address is available of failed attempt (a la no such domain)
- *
- * Revision 1.71 2002/03/05 18:13:56 oes
- * Added --user option
- *
- * Revision 1.70 2002/03/05 04:52:42 oes
- * Deleted non-errlog debugging code
- *
- * Revision 1.69 2002/03/04 23:50:00 jongfoster
- * Splitting off bind_port() call into bind_port_helper(), with
- * improved logging.
- *
- * Revision 1.68 2002/03/04 20:17:32 oes
- * Fixed usage info
- *
- * Revision 1.67 2002/03/04 18:18:57 oes
- * - Removed _DEBUG mode
- * - Cleand up cmdline parsing
- * - Introduced --no-daemon, --pidfile options
- * - Cleaned up signal handling:
- * - Terminate cleanly on INT, TERM and ABRT
- * - Schedule logfile for re-opening on HUP
- * - Ignore CHLD and PIPE
- * - Leave the rest with their default handlers
- * - Uniform handler registration
- * - Added usage() function
- * - Played styleguide police
- *
- * Revision 1.66 2002/03/03 15:06:55 oes
- * Re-enabled automatic config reloading
- *
- * Revision 1.65 2002/03/03 14:49:11 oes
- * Fixed CLF logging: Now uses client's original HTTP request
- *
- * Revision 1.64 2002/03/03 09:18:03 joergs
- * Made jumbjuster work on AmigaOS again.
- *
- * Revision 1.63 2002/03/02 04:14:50 david__schmidt
- * Clean up a little CRLF unpleasantness that suddenly appeared
- *
- * Revision 1.62 2002/02/20 23:17:23 jongfoster
- * Detecting some out-of memory conditions and exiting with a log message.
- *
- * Revision 1.61 2002/01/17 21:01:52 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Revision 1.60 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.59 2001/12/13 14:07:18 oes
- * Fixed Bug: 503 error page now sent OK
- *
- * Revision 1.58 2001/11/30 23:37:24 jongfoster
- * Renaming the Win32 config file to config.txt - this is almost the
- * same as the corresponding UNIX name "config"
- *
- * Revision 1.57 2001/11/16 00:47:43 jongfoster
- * Changing the tty-disconnection code to use setsid().
- *
- * Revision 1.56 2001/11/13 20:20:54 jongfoster
- * Tabs->spaces, fixing a bug with missing {} around an if()
- *
- * Revision 1.55 2001/11/13 20:14:53 jongfoster
- * Patch for FreeBSD setpgrp() as suggested by Alexander Lazic
- *
- * Revision 1.54 2001/11/07 00:03:14 steudten
- * Give reliable return value if an error
- * occurs not just 0 with new daemon mode.
- *
- * Revision 1.53 2001/11/05 21:41:43 steudten
- * Add changes to be a real daemon just for unix os.
- * (change cwd to /, detach from controlling tty, set
- * process group and session leader to the own process.
- * Add DBG() Macro.
- * Add some fatal-error log message for failed malloc().
- * Add '-d' if compiled with 'configure --with-debug' to
- * enable debug output.
- *
- * Revision 1.52 2001/10/26 20:11:20 jongfoster
- * Fixing type mismatch
- *
- * Revision 1.51 2001/10/26 17:38:28 oes
- * Cosmetics
- *
- * Revision 1.50 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.49 2001/10/23 21:41:35 jongfoster
- * Added call to initialize the (statically-allocated of course)
- * "out of memory" CGI response.
- *
- * Revision 1.48 2001/10/10 19:56:46 jongfoster
- * Moving some code that wasn't cookie-related out of an #ifdef
- * FEATURE_COOKIE_JAR
- *
- * Revision 1.47 2001/10/10 16:44:36 oes
- * Added CONNECT destination port limitation check
- *
- * Revision 1.46 2001/10/08 15:17:41 oes
- * Re-enabled SSL forwarding
- *
- * Revision 1.45 2001/10/07 15:42:11 oes
- * Replaced 6 boolean members of csp with one bitmap (csp->flags)
- *
- * Moved downgrading of the HTTP version from parse_http_request to
- * chat(), since we can't decide if it is necessary before we have
- * determined the actions for the URL. The HTTP command is now
- * *always* re-built so the repairs need no longer be special-cased.
- *
- * filter_popups now gets a csp pointer so it can raise the new
- * CSP_FLAG_MODIFIED flag.
- *
- * Bugfix
- *
- * Added configurable size limit for the IOB. If the IOB grows so
- * large that the next read would exceed the limit, the header
- * is generated, and the header & unfiltered buffer are flushed
- * to the client. Chat then continues in non-buffering,
- * non-filtering body mode.
- *
- * Revision 1.44 2001/10/02 18:13:57 oes
- * Ooops
- *
- * Revision 1.43 2001/10/02 15:32:13 oes
- * Moved generation of hdr
- *
- * Revision 1.42 2001/09/21 23:02:02 david__schmidt
- * Cleaning up 2 compiler warnings on OS/2.
- *
- * Revision 1.41 2001/09/16 17:05:14 jongfoster
- * Removing unused #include showarg.h
- *
- * Revision 1.40 2001/09/16 15:41:45 jongfoster
- * Fixing signed/unsigned comparison warning.
- *
- * Revision 1.39 2001/09/16 13:21:27 jongfoster
- * Changes to use new list functions.
- *
- * Revision 1.38 2001/09/16 13:01:46 jongfoster
- * Removing redundant function call that zeroed zalloc()'d memory.
- *
- * Revision 1.37 2001/09/10 11:12:24 oes
- * Deleted unused variable
- *
- * Revision 1.36 2001/09/10 10:56:15 oes
- * Silenced compiler warnings
- *
- * Revision 1.35 2001/07/31 14:44:22 oes
- * Deleted unused size parameter from filter_popups()
- *
- * Revision 1.34 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.33 2001/07/29 19:32:00 jongfoster
- * Renaming _main() [mingw32 only] to real_main(), for ANSI compliance.
- *
- * Revision 1.32 2001/07/29 18:47:05 jongfoster
- * Adding missing #include "loadcfg.h"
- *
- * Revision 1.31 2001/07/29 12:17:48 oes
- * Applied pthread fix by Paul Lieverse
- *
- * Revision 1.30 2001/07/25 22:57:13 jongfoster
- * __BEOS__ no longer overrides FEATURE_PTHREAD.
- * This is because FEATURE_PTHREAD will soon be widely used, so I
- * want to keep it simple.
- *
- * Revision 1.29 2001/07/24 12:47:06 oes
- * Applied BeOS support update by Eugenia
- *
- * Revision 1.28 2001/07/23 13:26:12 oes
- * Fixed bug in popup-killing for the first read that caused binary garbage to be sent between headers and body
- *
- * Revision 1.27 2001/07/19 19:09:47 haroon
- * - Added code to take care of the situation where while processing the first
- * server response (which includes the server header), after finding the end
- * of the headers we were not looking past the end of the headers for
- * content modification. I enabled it for filter_popups.
- * Someone else should look to see if other similar operations should be
- * done to the discarded portion of the buffer.
- *
- * Note 2001/07/20: No, the other content modification mechanisms will process
- * the whole iob later anyway. --oes
- *
* Revision 1.26 2001/07/18 12:31:36 oes
* cosmetics
*
@@ -538,23 +264,10 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.87 2002/03/26 22:29:54 swa Exp $";
#else /* ifndef _WIN32 */
-# if !defined (__OS2__)
# include
-# include
-# endif /* ndef __OS2__ */
# include
+# include
# include
-# include
-
-#ifdef sun
-#include
-#endif /* sun */
-
-#ifdef unix
-#include
-#include
-#endif
-
# include
# ifdef __BEOS__
@@ -562,15 +275,6 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.87 2002/03/26 22:29:54 swa Exp $";
# include /* declarations for threads and stuff. */
# endif
-# if defined(__EMX__) || defined(__OS2__)
-# include /* OS/2/EMX needs a little help with select */
-# endif
-# ifdef __OS2__
-#define INCL_DOS
-# include
-#define bzero(B,N) memset(B,0x00,n)
-# endif
-
# ifndef FD_ZERO
# include
# endif
@@ -582,6 +286,7 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.87 2002/03/26 22:29:54 swa Exp $";
#include "jcc.h"
#include "filters.h"
#include "loaders.h"
+#include "showargs.h"
#include "parsers.h"
#include "killpopup.h"
#include "miscutil.h"
@@ -590,24 +295,18 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.87 2002/03/26 22:29:54 swa Exp $";
#include "gateway.h"
#include "actions.h"
#include "cgi.h"
-#include "loadcfg.h"
-#include "urlmatch.h"
const char jcc_h_rcs[] = JCC_H_VERSION;
const char project_h_rcs[] = PROJECT_H_VERSION;
-int no_daemon = 0;
struct client_state clients[1];
struct file_list files[1];
-#ifdef FEATURE_STATISTICS
+#ifdef STATISTICS
int urls_read = 0; /* total nr of urls read inc rejected */
int urls_rejected = 0; /* total nr of urls rejected */
-#endif /* def FEATURE_STATISTICS */
+#endif /* def STATISTICS */
-#ifdef FEATURE_GRACEFUL_TERMINATION
-int g_terminate = 0;
-#endif
static void listen_loop(void);
static void chat(struct client_state *csp);
@@ -625,15 +324,6 @@ static int32 server_thread(void *data);
#define sleep(N) Sleep(((N) * 1000))
#endif
-#ifdef __OS2__
-#define sleep(N) DosSleep(((N) * 100))
-#endif
-
-#if defined(unix) || defined(__EMX__)
-const char *basedir;
-const char *pidfile = NULL;
-int received_hup_signal = 0;
-#endif /* defined unix */
/* The vanilla wafer. */
static const char VANILLA_WAFER[] =
@@ -646,60 +336,13 @@ static const char VANILLA_WAFER[] =
"(copyright_or_otherwise)_applying_to_any_cookie._";
-#if !defined(_WIN32) && !defined(__OS2__) && !defined(AMIGA)
-/*********************************************************************
- *
- * Function : sig_handler
- *
- * Description : Signal handler for different signals.
- * Exit gracefully on ABRT, TERM and INT
- * or set a flag that will cause the errlog
- * to be reopened by the main thread on HUP.
- *
- * Parameters :
- * 1 : the_signal = the signal cause this function to call
- *
- * Returns : -
- *
- *********************************************************************/
-static void sig_handler(int the_signal)
-{
- switch(the_signal)
- {
- case SIGABRT:
- case SIGTERM:
- case SIGINT:
- log_error(LOG_LEVEL_INFO, "exiting by signal %d .. bye", the_signal);
-#if defined(unix)
- unlink(pidfile);
-#endif /* unix */
- exit(the_signal);
- break;
-
- case SIGHUP:
- received_hup_signal = 1;
- break;
-
- default:
- /*
- * We shouldn't be here, unless we catch signals
- * in main() that we can't handle here!
- */
- log_error(LOG_LEVEL_FATAL, "sig_handler: exiting on unexpected signal %d", the_signal);
- }
- return;
-
-}
-#endif
-
-
/*********************************************************************
*
* Function : chat
*
* Description : Once a connection to the client has been accepted,
* this function is called (via serve()) to handle the
- * main business of the communication. When this
+ * main business of the communication. When this
* function returns, the caller must close the client
* socket handle.
*
@@ -717,47 +360,42 @@ static void sig_handler(int the_signal)
static void chat(struct client_state *csp)
{
/*
- * This next lines are a little ugly, but they simplifies the if statements
- * below. Basically if TOGGLE, then we want the if to test if the
- * CSP_FLAG_TOGGLED_ON flag ist set, else we don't. And if FEATURE_FORCE_LOAD,
- * then we want the if to test for CSP_FLAG_FORCED , else we don't
+ * This next lines are a little ugly, but they simplifies the if statements below.
+ * Basically if TOGGLE, then we want the if to test "csp->toggled_on", else we don't
+ * And if FORCE_LOAD, then we want the if to test "csp->toggled_on", else we don't
*/
-#ifdef FEATURE_TOGGLE
-# define IS_TOGGLED_ON_AND (csp->flags & CSP_FLAG_TOGGLED_ON) &&
-#else /* ifndef FEATURE_TOGGLE */
+#ifdef TOGGLE
+# define IS_TOGGLED_ON_AND (csp->toggled_on) &&
+#else /* ifndef TOGGLE */
# define IS_TOGGLED_ON_AND
-#endif /* ndef FEATURE_TOGGLE */
-#ifdef FEATURE_FORCE_LOAD
-# define IS_NOT_FORCED_AND !(csp->flags & CSP_FLAG_FORCED) &&
-#else /* ifndef FEATURE_FORCE_LOAD */
+#endif /* ndef TOGGLE */
+#ifdef FORCE_LOAD
+# define IS_NOT_FORCED_AND (!csp->force) &&
+#else /* ifndef FORCE_LOAD */
# define IS_NOT_FORCED_AND
-#endif /* def FEATURE_FORCE_LOAD */
+#endif /* def FORCE_LOAD */
#define IS_ENABLED_AND IS_TOGGLED_ON_AND IS_NOT_FORCED_AND
char buf[BUFFER_SIZE];
- char *hdr;
- char *p;
- char *req;
+ char *hdr, *p, *req;
+ char *err = NULL;
fd_set rfds;
- int n;
- jb_socket maxfd;
- int server_body;
+ int n, maxfd, server_body;
int ms_iis5_hack = 0;
int byte_count = 0;
const struct forward_spec * fwd;
struct http_request *http;
- int len; /* for buffer sizes */
-#ifdef FEATURE_KILL_POPUPS
+#ifdef KILLPOPUPS
int block_popups; /* bool, 1==will block popups */
int block_popups_now = 0; /* bool, 1==currently blocking popups */
-#endif /* def FEATURE_KILL_POPUPS */
+#endif /* def KILLPOPUPS */
int pcrs_filter; /* bool, 1==will filter through pcrs */
int gif_deanimate; /* bool, 1==will deanimate gifs */
/* Function that does the content filtering for the current request */
- char *(*content_filter)() = NULL;
+ char *(*content_filter)() = NULL;
/* Skeleton for HTTP response, if we should intercept the request */
struct http_response *rsp;
@@ -769,13 +407,13 @@ static void chat(struct client_state *csp)
* could get blocked here if a client connected, then didn't say anything!
*/
- for (;;)
+ while (FOREVER)
{
- len = read_socket(csp->cfd, buf, sizeof(buf));
+ n = read_socket(csp->cfd, buf, sizeof(buf));
- if (len <= 0) break; /* error! */
+ if (n <= 0) break; /* error! */
- add_to_iob(csp, buf, len);
+ add_to_iob(csp, buf, n);
req = get_header(csp);
@@ -788,8 +426,8 @@ static void chat(struct client_state *csp)
{
continue; /* more to come! */
}
-
-#ifdef FEATURE_FORCE_LOAD
+
+#ifdef FORCE_LOAD
/* If this request contains the FORCE_PREFIX,
* better get rid of it now and set the force flag --oes
*/
@@ -798,11 +436,14 @@ static void chat(struct client_state *csp)
{
strclean(req, FORCE_PREFIX);
log_error(LOG_LEVEL_FORCE, "Enforcing request \"%s\".\n", req);
- csp->flags |= CSP_FLAG_FORCED;
+ csp->force = 1;
+ }
+ else
+ {
+ csp->force = 0;
}
-
-#endif /* def FEATURE_FORCE_LOAD */
-
+#endif /* def FORCE_LOAD */
+
parse_http_request(req, http, csp);
freez(req);
break;
@@ -830,171 +471,98 @@ static void chat(struct client_state *csp)
* we have to do one of the following:
*
* create = use the original HTTP request to create a new
- * HTTP request that has either the path component
- * without the http://domainspec (w/path) or the
- * full orininal URL (w/url)
- * Note that the path and/or the HTTP version may
- * have been altered by now.
+ * HTTP request that has only the path component
+ * without the http://domainspec
+ * pass = pass the original HTTP request unchanged
*
- * connect = Open a socket to the host:port of the server
- * and short-circuit server and client socket.
- *
- * pass = Pass the request unchanged if forwarding a CONNECT
- * request to a parent proxy. Note that we'll be sending
- * the CFAIL message ourselves if connecting to the parent
- * fails, but we won't send a CSUCCEED message if it works,
- * since that would result in a double message (ours and the
- * parent's). After sending the request to the parent, we simply
- * tunnel.
+ * drop = drop the HTTP request
*
* here's the matrix:
* SSL
* 0 1
* +--------+--------+
* | | |
- * 0 | create | connect|
- * | w/path | |
+ * 0 | create | drop |
+ * | | |
* Forwarding +--------+--------+
* | | |
- * 1 | create | pass |
- * | w/url | |
+ * 1 | pass | pass |
+ * | | |
* +--------+--------+
*
*/
- /*
- * Determine the actions for this URL
- */
-#ifdef FEATURE_TOGGLE
- if (!(csp->flags & CSP_FLAG_TOGGLED_ON))
+ if (fwd->forward_host)
{
- /* Most compatible set of actions (i.e. none) */
- init_current_action(csp->action);
+ /* if forwarding, just pass the request as is */
+ enlist(csp->headers, http->cmd);
}
else
-#endif /* ndef FEATURE_TOGGLE */
- {
- url_actions(http, csp);
- }
-
-
- /*
- * Check if a CONNECT request is allowable:
- * In the absence of a +limit-connect action, allow only port 443.
- * If there is an action, allow whatever matches the specificaton.
- */
- if(http->ssl)
{
- if( ( !(csp->action->flags & ACTION_LIMIT_CONNECT) && csp->http->port != 443)
- || (csp->action->flags & ACTION_LIMIT_CONNECT
- && !match_portlist(csp->action->string[ACTION_STRING_LIMIT_CONNECT], csp->http->port)) )
+ if (http->ssl == 0)
{
- strcpy(buf, CFORBIDDEN);
- write_socket(csp->cfd, buf, strlen(buf));
-
- log_error(LOG_LEVEL_CONNECT, "Denying suspicious CONNECT request from %s", csp->ip_addr_str);
- log_error(LOG_LEVEL_CLF, "%s - - [%T] \" \" 403 0", csp->ip_addr_str);
-
- return;
+ /* otherwise elide the host information from the url */
+ p = NULL;
+ p = strsav(p, http->gpc);
+ p = strsav(p, " ");
+ p = strsav(p, http->path);
+ p = strsav(p, " ");
+ p = strsav(p, http->ver);
+ enlist(csp->headers, p);
+ freez(p);
}
}
+ /* decide what we're to do with cookies */
- /*
- * Downgrade http version from 1.1 to 1.0 if +downgrade
- * action applies
- */
- if ( (http->ssl == 0)
- && (!strcmpic(http->ver, "HTTP/1.1"))
- && (csp->action->flags & ACTION_DOWNGRADE))
+#ifdef TOGGLE
+ if (!csp->toggled_on)
{
- freez(http->ver);
- http->ver = strdup("HTTP/1.0");
-
- if (http->ver == NULL)
- {
- log_error(LOG_LEVEL_FATAL, "Out of memory downgrading HTTP version");
- }
- }
-
- /*
- * Save a copy of the original request for logging
- */
- http->ocmd = strdup(http->cmd);
-
- if (http->ocmd == NULL)
- {
- log_error(LOG_LEVEL_FATAL, "Out of memory copying HTTP request line");
+ /* Most compatible set of actions (i.e. none) */
+ init_current_action(csp->action);
}
-
- /*
- * (Re)build the HTTP request for non-SSL requests.
- * If forwarding, use the whole URL, else, use only the path.
- */
- if (http->ssl == 0)
+ else
+#endif /* ndef TOGGLE */
{
- freez(http->cmd);
-
- http->cmd = strdup(http->gpc);
- string_append(&http->cmd, " ");
-
- if (fwd->forward_host)
- {
- string_append(&http->cmd, http->url);
- }
- else
- {
- string_append(&http->cmd, http->path);
- }
-
- string_append(&http->cmd, " ");
- string_append(&http->cmd, http->ver);
-
- if (http->cmd == NULL)
- {
- log_error(LOG_LEVEL_FATAL, "Out of memory rewiting SSL command");
- }
+ url_actions(http, csp);
}
- enlist(csp->headers, http->cmd);
-
-#ifdef FEATURE_COOKIE_JAR
+#ifdef JAR_FILES
/*
* If we're logging cookies in a cookie jar, and the user has not
* supplied any wafers, and the user has not told us to suppress the
* vanilla wafer, then send the vanilla wafer.
*/
if ((csp->config->jarfile != NULL)
- && list_is_empty(csp->action->multi[ACTION_MULTI_WAFER])
+ && (csp->action->multi[ACTION_MULTI_WAFER]->next == NULL)
&& ((csp->action->flags & ACTION_VANILLA_WAFER) != 0))
{
enlist(csp->action->multi[ACTION_MULTI_WAFER], VANILLA_WAFER);
}
-#endif /* def FEATURE_COOKIE_JAR */
-
+#endif /* def JAR_FILES */
-#ifdef FEATURE_KILL_POPUPS
+#ifdef KILLPOPUPS
block_popups = ((csp->action->flags & ACTION_NO_POPUPS) != 0);
-#endif /* def FEATURE_KILL_POPUPS */
+#endif /* def KILLPOPUPS */
pcrs_filter = (csp->rlist != NULL) && /* There are expressions to be used */
- (!list_is_empty(csp->action->multi[ACTION_MULTI_FILTER]));
+ ((csp->action->flags & ACTION_FILTER) != 0);
gif_deanimate = ((csp->action->flags & ACTION_DEANIMATE) != 0);
/* grab the rest of the client's headers */
- for (;;)
+ while (FOREVER)
{
- if ( ( ( p = get_header(csp) ) != NULL) && ( *p == '\0' ) )
+ if ( ( p = get_header(csp) ) && ( *p == '\0' ) )
{
- len = read_socket(csp->cfd, buf, sizeof(buf));
- if (len <= 0)
+ n = read_socket(csp->cfd, buf, sizeof(buf));
+ if (n <= 0)
{
log_error(LOG_LEVEL_ERROR, "read from client failed: %E");
return;
}
- add_to_iob(csp, buf, len);
+ add_to_iob(csp, buf, n);
continue;
}
@@ -1003,52 +571,59 @@ static void chat(struct client_state *csp)
enlist(csp->headers, p);
freez(p);
}
- /*
- * We have a request. Now, check to see if we need to
- * intercept it, i.e. If ..
- */
+ /* We have a request. */
+
+ hdr = sed(client_patterns, add_client_headers, csp);
+ destroy_list(csp->headers);
+
+ /*
+ * Now, check to see if we need to intercept it, i.e.
+ * If
+ */
+
if (
/* a CGI call was detected and answered */
- (NULL != (rsp = dispatch_cgi(csp)))
+ (NULL != (rsp = dispatch_cgi(csp)))
/* or we are enabled and... */
|| (IS_ENABLED_AND (
/* ..the request was blocked */
- ( NULL != (rsp = block_url(csp)))
+ ( NULL != (rsp = block_url(csp)))
/* ..or untrusted */
-#ifdef FEATURE_TRUST
+#ifdef TRUST_FILES
|| ( NULL != (rsp = trust_url(csp)))
-#endif /* def FEATURE_TRUST */
+#endif
/* ..or a fast redirect kicked in */
-#ifdef FEATURE_FAST_REDIRECTS
- || (((csp->action->flags & ACTION_FAST_REDIRECTS) != 0) &&
- (NULL != (rsp = redirect_url(csp))))
-#endif /* def FEATURE_FAST_REDIRECTS */
- ))
- )
+#ifdef FAST_REDIRECTS
+ || (((csp->action->flags & ACTION_FAST_REDIRECTS) != 0) &&
+ (NULL != (rsp = redirect_url(csp))))
+#endif /* def FAST_REDIRECTS */
+ ))
+ )
{
/* Write the answer to the client */
- if (write_socket(csp->cfd, rsp->head, rsp->head_length)
- || write_socket(csp->cfd, rsp->body, rsp->content_length))
- {
+ if ((write_socket(csp->cfd, rsp->head, rsp->head_length) != rsp->head_length)
+ || (write_socket(csp->cfd, rsp->body, rsp->content_length) != rsp->content_length))
+ {
log_error(LOG_LEVEL_ERROR, "write to: %s failed: %E", http->host);
}
-#ifdef FEATURE_STATISTICS
+#ifdef STATISTICS
/* Count as a rejected request */
- csp->flags |= CSP_FLAG_REJECTED;
-#endif /* def FEATURE_STATISTICS */
+ csp->rejected = 1;
+#endif /* def STATISTICS */
/* Log (FIXME: All intercept reasons apprear as "crunch" with Status 200) */
log_error(LOG_LEVEL_GPC, "%s%s crunch!", http->hostport, http->path);
- log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 3", csp->ip_addr_str, http->ocmd);
+ log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 3", csp->ip_addr_str, http->cmd);
/* Clean up and return */
free_http_response(rsp);
+ freez(hdr);
return;
}
@@ -1068,74 +643,67 @@ static void chat(struct client_state *csp)
csp->sfd = forwarded_connect(fwd, http, csp);
- if (csp->sfd == JB_INVALID_SOCKET)
+ if (csp->sfd < 0)
{
log_error(LOG_LEVEL_CONNECT, "connect to: %s failed: %E",
http->hostport);
if (errno == EINVAL)
{
- rsp = error_response(csp, "no-such-domain", errno);
+ rsp = error_response(csp, "no-such-domain", errno);
- log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 404 0",
- csp->ip_addr_str, http->ocmd);
+ log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 404 0",
+ csp->ip_addr_str, http->cmd);
}
else
{
- rsp = error_response(csp, "connect-failed", errno);
+ rsp = error_response(csp, "connect-failed", errno);
- log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 503 0",
- csp->ip_addr_str, http->ocmd);
+ log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 503 0",
+ csp->ip_addr_str, http->cmd);
}
-
/* Write the answer to the client */
if(rsp)
- {
- if (write_socket(csp->cfd, rsp->head, rsp->head_length)
- || write_socket(csp->cfd, rsp->body, rsp->content_length))
- {
+ {
+ if ((write_socket(csp->cfd, rsp->head, rsp->head_length) != rsp->head_length)
+ || (write_socket(csp->cfd, rsp->body, rsp->content_length) != rsp->content_length))
+ {
log_error(LOG_LEVEL_ERROR, "write to: %s failed: %E", http->host);
}
}
free_http_response(rsp);
+ freez(hdr);
return;
}
log_error(LOG_LEVEL_CONNECT, "OK");
- hdr = sed(client_patterns, add_client_headers, csp);
- if (hdr == NULL)
- {
- /* FIXME Should handle error properly */
- log_error(LOG_LEVEL_FATAL, "Out of memory parsing client header");
- }
-
- list_remove_all(csp->headers);
-
if (fwd->forward_host || (http->ssl == 0))
{
/* write the client's (modified) header to the server
* (along with anything else that may be in the buffer)
*/
- if (write_socket(csp->sfd, hdr, strlen(hdr))
- || (flush_socket(csp->sfd, csp) < 0))
+ n = strlen(hdr);
+
+ if ((write_socket(csp->sfd, hdr, n) != n)
+ || (flush_socket(csp->sfd, csp ) < 0))
{
log_error(LOG_LEVEL_CONNECT, "write header to: %s failed: %E",
http->hostport);
- log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 503 0",
- csp->ip_addr_str, http->ocmd);
+ log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 503 0",
+ csp->ip_addr_str, http->cmd);
rsp = error_response(csp, "connect-failed", errno);
if(rsp)
{
- if (write_socket(csp->cfd, rsp->head, rsp->head_length)
- || write_socket(csp->cfd, rsp->body, rsp->content_length))
- {
+ if ((write_socket(csp->cfd, rsp->head, n) != n)
+ || (write_socket(csp->cfd, rsp->body, rsp->content_length) != rsp->content_length))
+ {
log_error(LOG_LEVEL_ERROR, "write to: %s failed: %E", http->host);
}
}
@@ -1152,10 +720,10 @@ static void chat(struct client_state *csp)
* so just send the "connect succeeded" message to the
* client, flush the rest, and get out of the way.
*/
- log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 2\n",
- csp->ip_addr_str, http->ocmd);
+ log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 2\n",
+ csp->ip_addr_str, http->cmd);
- if (write_socket(csp->cfd, CSUCCEED, sizeof(CSUCCEED)-1))
+ if (write_socket(csp->cfd, CSUCCEED, sizeof(CSUCCEED)-1) < 0)
{
freez(hdr);
return;
@@ -1174,21 +742,14 @@ static void chat(struct client_state *csp)
server_body = 0;
- for (;;)
+ while (FOREVER)
{
-#ifdef __OS2__
- /*
- * FD_ZERO here seems to point to an errant macro which crashes.
- * So do this by hand for now...
- */
- memset(&rfds,0x00,sizeof(fd_set));
-#else
FD_ZERO(&rfds);
-#endif
+
FD_SET(csp->cfd, &rfds);
FD_SET(csp->sfd, &rfds);
- n = select((int)maxfd+1, &rfds, NULL, NULL, NULL);
+ n = select(maxfd+1, &rfds, NULL, NULL, NULL);
if (n < 0)
{
@@ -1202,14 +763,14 @@ static void chat(struct client_state *csp)
if (FD_ISSET(csp->cfd, &rfds))
{
- len = read_socket(csp->cfd, buf, sizeof(buf));
+ n = read_socket(csp->cfd, buf, sizeof(buf));
- if (len <= 0)
+ if (n <= 0)
{
break; /* "game over, man" */
}
- if (write_socket(csp->sfd, buf, (size_t)len))
+ if (write_socket(csp->sfd, buf, n) != n)
{
log_error(LOG_LEVEL_ERROR, "write to: %s failed: %E", http->host);
return;
@@ -1227,25 +788,25 @@ static void chat(struct client_state *csp)
if (FD_ISSET(csp->sfd, &rfds))
{
fflush( 0 );
- len = read_socket(csp->sfd, buf, sizeof(buf) - 1);
+ n = read_socket(csp->sfd, buf, sizeof(buf) - 1);
- if (len < 0)
+ if (n < 0)
{
log_error(LOG_LEVEL_ERROR, "read from: %s failed: %E", http->host);
- log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 503 0",
- csp->ip_addr_str, http->ocmd);
+ log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 503 0",
+ csp->ip_addr_str, http->cmd);
rsp = error_response(csp, "connect-failed", errno);
if(rsp)
{
- if (write_socket(csp->cfd, rsp->head, rsp->head_length)
- || write_socket(csp->cfd, rsp->body, rsp->content_length))
- {
+ if ((write_socket(csp->cfd, rsp->head, rsp->head_length) != rsp->head_length)
+ || (write_socket(csp->cfd, rsp->body, rsp->content_length) != rsp->content_length))
+ {
log_error(LOG_LEVEL_ERROR, "write to: %s failed: %E", http->host);
- }
- }
+ }
+ }
free_http_response(rsp);
return;
@@ -1254,15 +815,15 @@ static void chat(struct client_state *csp)
/* Add a trailing zero. This lets filter_popups
* use string operations.
*/
- buf[len] = '\0';
+ buf[n] = '\0';
-#ifdef FEATURE_KILL_POPUPS
+#ifdef KILLPOPUPS
/* Filter the popups on this read. */
if (block_popups_now)
{
- filter_popups(buf, csp);
+ filter_popups(buf, n);
}
-#endif /* def FEATURE_KILL_POPUPS */
+#endif /* def KILLPOPUPS */
/* Normally, this would indicate that we've read
* as much as the server has sent us and we can
@@ -1282,9 +843,9 @@ static void chat(struct client_state *csp)
* doesn't generate a valid header, then we won't
* transmit anything to the client.
*/
- if (len == 0)
+ if (n == 0)
{
-
+
if (server_body || http->ssl)
{
/*
@@ -1305,33 +866,27 @@ static void chat(struct client_state *csp)
}
hdr = sed(server_patterns, add_server_headers, csp);
- if (hdr == NULL)
- {
- /* FIXME Should handle error properly */
- log_error(LOG_LEVEL_FATAL, "Out of memory parsing server header");
- }
+ n = strlen(hdr);
- if (write_socket(csp->cfd, hdr, strlen(hdr))
- || write_socket(csp->cfd, p != NULL ? p : csp->iob->cur, csp->content_length))
+ if ((write_socket(csp->cfd, hdr, n) != n)
+ || (write_socket(csp->cfd, p != NULL ? p : csp->iob->cur, csp->content_length) != csp->content_length))
{
- log_error(LOG_LEVEL_ERROR, "write modified content to client failed: %E");
+ log_error(LOG_LEVEL_CONNECT, "write modified content to client failed: %E");
return;
}
freez(hdr);
- if (NULL != p) {
- freez(p);
- }
+ freez(p);
}
break; /* "game over, man" */
}
/*
- * This is NOT the body, so
+ * This is NOT the body, so
* Let's pretend the server just sent us a blank line.
*/
- len = sprintf(buf, "\r\n");
+ n = sprintf(buf, "\r\n");
/*
* Now, let the normal header parsing algorithm below do its
@@ -1351,55 +906,17 @@ static void chat(struct client_state *csp)
{
if (content_filter)
{
- add_to_iob(csp, buf, len);
-
- /*
- * If the buffer limit will be reached on the next read,
- * switch to non-filtering mode, i.e. make & write the
- * header, flush the socket and get out of the way.
- */
- if (((size_t)(csp->iob->eod - csp->iob->buf)) + (size_t)BUFFER_SIZE > csp->config->buffer_limit)
- {
- size_t hdrlen;
-
- log_error(LOG_LEVEL_ERROR, "Buffer size limit reached! Flushing and stepping back.");
-
- hdr = sed(server_patterns, add_server_headers, csp);
- if (hdr == NULL)
- {
- /* FIXME Should handle error properly */
- log_error(LOG_LEVEL_FATAL, "Out of memory parsing server header");
- }
-
- hdrlen = strlen(hdr);
- byte_count += hdrlen;
-
- if (write_socket(csp->cfd, hdr, hdrlen)
- || ((len = flush_socket(csp->cfd, csp)) < 0))
- {
- log_error(LOG_LEVEL_CONNECT, "write header to client failed: %E");
-
- freez(hdr);
- return;
- }
-
- freez(hdr);
- byte_count += len;
-
- content_filter = NULL;
- server_body = 1;
-
- }
+ add_to_iob(csp, buf, n);
}
else
{
- if (write_socket(csp->cfd, buf, (size_t)len))
+ if (write_socket(csp->cfd, buf, n) != n)
{
log_error(LOG_LEVEL_ERROR, "write to client failed: %E");
return;
}
}
- byte_count += len;
+ byte_count += n;
continue;
}
else
@@ -1410,11 +927,11 @@ static void chat(struct client_state *csp)
*/
/* buffer up the data we just read */
- add_to_iob(csp, buf, len);
+ add_to_iob(csp, buf, n);
/* get header lines from the iob */
- while ((p = get_header(csp)) != NULL)
+ while ((p = get_header(csp)))
{
if (*p == '\0')
{
@@ -1459,13 +976,14 @@ static void chat(struct client_state *csp)
*/
hdr = sed(server_patterns, add_server_headers, csp);
- if (hdr == NULL)
- {
- /* FIXME Should handle error properly */
- log_error(LOG_LEVEL_FATAL, "Out of memory parsing server header");
- }
+ n = strlen(hdr);
+
+ /* write the server's (modified) header to
+ * the client (along with anything else that
+ * may be in the buffer)
+ */
-#ifdef FEATURE_KILL_POPUPS
+#ifdef KILLPOPUPS
/* Start blocking popups if appropriate. */
if ((csp->content_type & CT_TEXT) && /* It's a text / * MIME-Type */
@@ -1474,13 +992,14 @@ static void chat(struct client_state *csp)
{
block_popups_now = 1;
/*
- * Filter the part of the body that came in the same read
- * as the last headers:
- */
- filter_popups(csp->iob->cur, csp);
+ * even though the header has been found, don't forget about the
+ * left over portion of the buffer which will usually contain body text
+ */
+ n = strlen(csp->iob->cur);
+ filter_popups(csp->iob->cur, n);
}
-#endif /* def FEATURE_KILL_POPUPS */
+#endif /* def KILLPOPUPS */
/* Buffer and pcrs filter this if appropriate. */
@@ -1500,32 +1019,25 @@ static void chat(struct client_state *csp)
content_filter = gif_deanimate_response;
}
+
/*
* Only write if we're not buffering for content modification
*/
- if (!content_filter)
+ if (!content_filter && ((write_socket(csp->cfd, hdr, n) != n)
+ || (n = flush_socket(csp->cfd, csp) < 0)))
{
- /* write the server's (modified) header to
- * the client (along with anything else that
- * may be in the buffer)
- */
-
- if (write_socket(csp->cfd, hdr, strlen(hdr))
- || ((len = flush_socket(csp->cfd, csp)) < 0))
- {
- log_error(LOG_LEVEL_CONNECT, "write header to client failed: %E");
+ log_error(LOG_LEVEL_CONNECT, "write header to client failed: %E");
- /* the write failed, so don't bother
- * mentioning it to the client...
- * it probably can't hear us anyway.
- */
- freez(hdr);
- return;
- }
-
- byte_count += len;
+ /* the write failed, so don't bother
+ * mentioning it to the client...
+ * it probably can't hear us anyway.
+ */
+ freez(hdr);
+ return;
}
+ !content_filter && (byte_count += n);
+
/* we're finished with the server's header */
freez(hdr);
@@ -1547,8 +1059,8 @@ static void chat(struct client_state *csp)
return; /* huh? we should never get here */
}
- log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 %d",
- csp->ip_addr_str, http->ocmd, byte_count);
+ log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s\" 200 %d",
+ csp->ip_addr_str, http->cmd, byte_count);
}
@@ -1574,12 +1086,12 @@ static void serve(struct client_state *csp)
chat(csp);
close_socket(csp->cfd);
- if (csp->sfd != JB_INVALID_SOCKET)
+ if (csp->sfd >= 0)
{
close_socket(csp->sfd);
}
- csp->flags &= ~CSP_FLAG_ACTIVE;
+ csp->active = 0;
}
@@ -1606,28 +1118,6 @@ static int32 server_thread(void *data)
#endif
-/*********************************************************************
- *
- * Function : usage
- *
- * Description : Print usage info & exit.
- *
- * Parameters : Pointer to argv[0] for identifying ourselves
- *
- * Returns : No. ,-)
- *
- *********************************************************************/
-void usage(const char *myname)
-{
- printf("Privoxy version " VERSION " (" HOME_PAGE_URL ")\n"
- "Usage: %s [--help] [--version] [--no-daemon] [--pidfile pidfile] [--user user[.group]] [configfile]\n"
- "Aborting.\n", myname);
-
- exit(2);
-
-}
-
-
/*********************************************************************
*
* Function : main
@@ -1647,116 +1137,50 @@ void usage(const char *myname)
* any load fails, and can't bind port.
*
* Else main never returns, the process must be signaled
- * to terminate execution. Or, on Windows, use the
+ * to terminate execution. Or, on Windows, use the
* "File", "Exit" menu option.
*
*********************************************************************/
#ifdef __MINGW32__
-int real_main(int argc, const char *argv[])
+int _main(int argc, const char *argv[])
#else
int main(int argc, const char *argv[])
#endif
{
- int argc_pos = 0;
-#ifdef unix
- struct passwd *pw = NULL;
- struct group *grp = NULL;
- char *p;
-#endif
-
- Argc = argc;
- Argv = argv;
-
configfile =
-#if !defined(_WIN32)
+#ifdef AMIGA
+ "AmiTCP:db/junkbuster/config"
+#elif !defined(_WIN32)
"config"
#else
- "config.txt"
+ "junkbstr.txt"
#endif
;
- /*
- * Parse the command line arguments
- */
- while (++argc_pos < argc)
- {
#if !defined(_WIN32) || defined(_WIN_CONSOLE)
-
- if (strcmp(argv[argc_pos], "--help") == 0)
- {
- usage(argv[0]);
- }
-
- else if(strcmp(argv[argc_pos], "--version") == 0)
- {
- printf("Privoxy version " VERSION " (" HOME_PAGE_URL ")\n");
- exit(0);
- }
-
- else if (strcmp(argv[argc_pos], "--no-daemon" ) == 0)
- {
- no_daemon = 1;
- }
-#if defined(unix)
- else if (strcmp(argv[argc_pos], "--pidfile" ) == 0)
- {
- if (++argc_pos == argc) usage(argv[0]);
- pidfile = strdup(argv[argc_pos]);
- }
-
- else if (strcmp(argv[argc_pos], "--user" ) == 0)
- {
- if (++argc_pos == argc) usage(argv[argc_pos]);
-
- if ((NULL != (p = strchr(argv[argc_pos], '.'))) && *(p + 1) != '0')
- {
- *p++ = '\0';
- if (NULL == (grp = getgrnam(p)))
- {
- log_error(LOG_LEVEL_FATAL, "Group %s not found.", p);
- }
- }
-
- if (NULL == (pw = getpwnam(argv[argc_pos])))
- {
- log_error(LOG_LEVEL_FATAL, "User %s not found.", argv[argc_pos]);
- }
-
- if (p != NULL) *--p = '\0';
- }
-#endif /* defined(unix) */
- else
-#endif /* defined(_WIN32) && !defined(_WIN_CONSOLE) */
- {
- configfile = argv[argc_pos];
- }
-
- } /* -END- while (more arguments) */
-
-#if defined(unix)
- if ( *configfile != '/' )
+ if ((argc >= 2) && (strcmp(argv[1], "--help")==0))
+ {
+ printf("JunkBuster proxy version " VERSION ".\n\n"
+ "Usage: %s [configfile]\n\n"
+ "See " HOME_PAGE_URL " for details.\n"
+ "This program is distributed under the GNU GPL, version 2 or later.\n",
+ argv[0]);
+ exit(2);
+ }
+ if ((argc >= 2) && (strcmp(argv[1], "--version")==0))
{
- char *abs_file;
+ printf(VERSION "\n");
+ exit(2);
+ }
+#endif /* !defined(_WIN32) || defined(_WIN_CONSOLE) */
- /* make config-filename absolute here */
- if ( !(basedir = getcwd( NULL, 1024 )))
- {
- perror("get working dir failed");
- exit( 1 );
- }
+ Argc = argc;
+ Argv = argv;
- if ( !(abs_file = malloc( strlen( basedir ) + strlen( configfile ) + 5 )))
- {
- perror("malloc failed");
- exit( 1 );
- }
- strcpy( abs_file, basedir );
- strcat( abs_file, "/" );
- strcat( abs_file, configfile );
- configfile = abs_file;
+ if (argc > 1)
+ {
+ configfile = argv[1];
}
-#endif /* defined unix */
-
files->next = NULL;
@@ -1766,37 +1190,11 @@ int main(int argc, const char *argv[])
InitWin32();
#endif
- /*
- * Unix signal handling
- *
- * Catch the abort, interrupt and terminate signals for a graceful exit
- * Catch the hangup signal so the errlog can be reopened.
- * Ignore the broken pipe and child signals
- * FIXME: Isn't ignoring the default for SIGCHLD anyway and why ignore SIGPIPE?
- */
-#if !defined(_WIN32) && !defined(__OS2__) && !defined(AMIGA)
-{
- int idx;
- const int catched_signals[] = { SIGABRT, SIGTERM, SIGINT, SIGHUP, 0 };
- const int ignored_signals[] = { SIGPIPE, SIGCHLD, 0 };
- for (idx = 0; catched_signals[idx] != 0; idx++)
- {
- if (signal(catched_signals[idx], sig_handler) == SIG_ERR)
- {
- log_error(LOG_LEVEL_FATAL, "Can't set signal-handler for signal %d: %E", catched_signals[idx]);
- }
- }
+#ifndef _WIN32
+ signal(SIGPIPE, SIG_IGN);
+ signal(SIGCHLD, SIG_IGN);
- for (idx = 0; ignored_signals[idx] != 0; idx++)
- {
- if (signal(ignored_signals[idx], SIG_IGN) == SIG_ERR)
- {
- log_error(LOG_LEVEL_FATAL, "Can't set ignore-handler for signal %d: %E", ignored_signals[idx]);
- }
- }
-
-}
#else /* ifdef _WIN32 */
# ifdef _WIN_CONSOLE
/*
@@ -1808,96 +1206,6 @@ int main(int argc, const char *argv[])
#endif /* def _WIN32 */
- /* Initialize the CGI subsystem */
- cgi_init_error_messages();
-
- /*
- * If runnig on unix and without the --nodaemon
- * option, become a daemon. I.e. fork, detach
- * from tty and get process group leadership
- */
-#if defined(unix)
-{
- pid_t pid = 0;
-#if 0
- int fd;
-#endif
-
- if (!no_daemon)
- {
- pid = fork();
-
- if ( pid < 0 ) /* error */
- {
- perror("fork");
- exit( 3 );
- }
- else if ( pid != 0 ) /* parent */
- {
- int status;
- pid_t wpid;
- /*
- * must check for errors
- * child died due to missing files aso
- */
- sleep( 1 );
- wpid = waitpid( pid, &status, WNOHANG );
- if ( wpid != 0 )
- {
- exit( 1 );
- }
- exit( 0 );
- }
- /* child */
-#if 1
- /* Should be more portable, but not as well tested */
- setsid();
-#else /* !1 */
-#ifdef __FreeBSD__
- setpgrp(0,0);
-#else /* ndef __FreeBSD__ */
- setpgrp();
-#endif /* ndef __FreeBSD__ */
- fd = open("/dev/tty", O_RDONLY);
- if ( fd )
- {
- /* no error check here */
- ioctl( fd, TIOCNOTTY,0 );
- close ( fd );
- }
-#endif /* 1 */
- /* FIXME: should close stderr (fd 2) here too, but the test
- * for existence
- * and load config file is done in listen_loop() and puts
- * some messages on stderr there.
- */
-
- close( 0 );
- close( 1 );
- chdir("/");
-
- } /* -END- if (!no_daemon) */
-
- /*
- * As soon as we have written the PID file, we can switch
- * to the user and group ID indicated by the --user option
- */
- write_pid_file();
-
- if (NULL != pw)
- {
- if (((NULL != grp) && setgid(grp->gr_gid)) || (setgid(pw->pw_gid)))
- {
- log_error(LOG_LEVEL_FATAL, "Cannot setgid(): Insufficient permissions.");
- }
- if (setuid(pw->pw_uid))
- {
- log_error(LOG_LEVEL_FATAL, "Cannot setuid(): Insufficient permissions.");
- }
- }
-}
-#endif /* defined unix */
-
listen_loop();
/* NOTREACHED */
@@ -1906,78 +1214,6 @@ int main(int argc, const char *argv[])
}
-/*********************************************************************
- *
- * Function : bind_port_helper
- *
- * Description : Bind the listen port. Handles logging, and aborts
- * on failure.
- *
- * Parameters :
- * 1 : config = Privoxy configuration. Specifies port
- * to bind to.
- *
- * Returns : Port that was opened.
- *
- *********************************************************************/
-static jb_socket bind_port_helper(struct configuration_spec * config)
-{
- int result;
- jb_socket bfd;
-
- if ( (config->haddr != NULL)
- && (config->haddr[0] == '1')
- && (config->haddr[1] == '2')
- && (config->haddr[2] == '7')
- && (config->haddr[3] == '.') )
- {
- log_error(LOG_LEVEL_INFO, "Listening on port %d for local connections only",
- config->hport);
- }
- else if (config->haddr == NULL)
- {
- log_error(LOG_LEVEL_INFO, "Listening on port %d on all IP addresses",
- config->hport);
- }
- else
- {
- log_error(LOG_LEVEL_INFO, "Listening on port %d on IP address %s",
- config->hport, config->haddr);
- }
-
- result = bind_port(config->haddr, config->hport, &bfd);
-
- if (result < 0)
- {
- switch(result)
- {
- case -3 :
- log_error(LOG_LEVEL_FATAL, "can't bind to %s:%d: "
- "There may be another Privoxy or some other "
- "proxy running on port %d",
- (NULL != config->haddr) ? config->haddr : "INADDR_ANY",
- config->hport, config->hport);
-
- case -2 :
- log_error(LOG_LEVEL_FATAL, "can't bind to %s:%d: "
- "The hostname is not resolvable",
- (NULL != config->haddr) ? config->haddr : "INADDR_ANY", config->hport);
-
- default :
- log_error(LOG_LEVEL_FATAL, "can't bind to %s:%d: because %E",
- (NULL != config->haddr) ? config->haddr : "INADDR_ANY", config->hport);
- }
-
- /* shouldn't get here */
- return JB_INVALID_SOCKET;
- }
-
- config->need_bind = 0;
-
- return bfd;
-}
-
-
/*********************************************************************
*
* Function : listen_loop
@@ -1992,67 +1228,51 @@ static jb_socket bind_port_helper(struct configuration_spec * config)
static void listen_loop(void)
{
struct client_state *csp = NULL;
- jb_socket bfd;
+ int bfd;
struct configuration_spec * config;
config = load_config();
- bfd = bind_port_helper(config);
+ log_error(LOG_LEVEL_CONNECT, "bind (%s, %d)",
+ config->haddr ? config->haddr : "INADDR_ANY", config->hport);
-#ifdef FEATURE_GRACEFUL_TERMINATION
- while (!g_terminate)
-#else
- for (;;)
-#endif
+ bfd = bind_port(config->haddr, config->hport);
+
+ if (bfd < 0)
+ {
+ log_error(LOG_LEVEL_FATAL, "can't bind %s:%d: %E "
+ "- There may be another junkbuster or some other "
+ "proxy running on port %d",
+ (NULL != config->haddr) ? config->haddr : "INADDR_ANY",
+ config->hport, config->hport
+ );
+ /* shouldn't get here */
+ return;
+ }
+
+ config->need_bind = 0;
+
+
+ while (FOREVER)
{
-#if !defined(FEATURE_PTHREAD) && !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA) && !defined(__OS2__)
+#if !defined(FEATURE_PTHREAD) && !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA)
while (waitpid(-1, NULL, WNOHANG) > 0)
{
/* zombie children */
}
#endif /* !defined(FEATURE_PTHREAD) && !defined(_WIN32) && !defined(__BEOS__) && !defined(AMIGA) */
-
- /*
- * Free data that was used by died threads
- */
sweep();
-#if defined(unix)
- /*
- * Re-open the errlog after HUP signal
- */
- if (received_hup_signal)
- {
- init_error_log(Argv[0], config->logfile, config->debug);
- received_hup_signal = 0;
- }
-#endif
-
-#ifdef __OS2__
-#ifdef FEATURE_COOKIE_JAR
- /*
- * Need a workaround here: we have to fclose() the jarfile, or we die because it's
- * already open. I think unload_configfile() is not being run, which should do
- * this work. Until that can get resolved, we'll use this workaround.
- */
- if (csp)
- if(csp->config)
- if (csp->config->jar)
- {
- fclose(csp->config->jar);
- csp->config->jar = NULL;
- }
-#endif /* FEATURE_COOKIE_JAR */
-#endif /* __OS2__ */
-
if ( NULL == (csp = (struct client_state *) zalloc(sizeof(*csp))) )
{
log_error(LOG_LEVEL_FATAL, "malloc(%d) for csp failed: %E", sizeof(*csp));
continue;
}
- csp->flags |= CSP_FLAG_ACTIVE;
- csp->sfd = JB_INVALID_SOCKET;
+ memset(csp, '\0', sizeof(*csp));
+
+ csp->active = 1;
+ csp->sfd = -1;
csp->config = config = load_config();
@@ -2073,7 +1293,23 @@ static void listen_loop(void)
close_socket(bfd);
- bfd = bind_port_helper(config);
+ log_error(LOG_LEVEL_CONNECT, "bind (%s, %d)",
+ config->haddr ? config->haddr : "INADDR_ANY", config->hport);
+ bfd = bind_port(config->haddr, config->hport);
+
+ if (bfd < 0)
+ {
+ log_error(LOG_LEVEL_FATAL, "can't bind %s:%d: %E "
+ "- There may be another junkbuster or some other "
+ "proxy running on port %d",
+ (NULL != config->haddr) ? config->haddr : "INADDR_ANY",
+ config->hport, config->hport
+ );
+ /* shouldn't get here */
+ return;
+ }
+
+ config->need_bind = 0;
}
log_error(LOG_LEVEL_CONNECT, "accept connection ... ");
@@ -2085,7 +1321,7 @@ static void listen_loop(void)
#ifdef AMIGA
if(!childs)
{
- exit(1);
+ exit(1);
}
#endif
freez(csp);
@@ -2096,12 +1332,10 @@ static void listen_loop(void)
log_error(LOG_LEVEL_CONNECT, "OK");
}
-#ifdef FEATURE_TOGGLE
- if (g_bToggleIJB)
- {
- csp->flags |= CSP_FLAG_TOGGLED_ON;
- }
-#endif /* def FEATURE_TOGGLE */
+#if defined(TOGGLE)
+ /* by haroon - most of credit to srt19170 */
+ csp->toggled_on = g_bToggleIJB;
+#endif
if (run_loader(csp))
{
@@ -2109,7 +1343,7 @@ static void listen_loop(void)
/* Never get here - LOG_LEVEL_FATAL causes program exit */
}
-#ifdef FEATURE_ACL
+#ifdef ACL_FILES
if (block_acl(NULL,csp))
{
log_error(LOG_LEVEL_CONNECT, "Connection dropped due to ACL");
@@ -2117,7 +1351,7 @@ static void listen_loop(void)
freez(csp);
continue;
}
-#endif /* def FEATURE_ACL */
+#endif /* def ACL_FILES */
/* add it to the list of clients */
csp->next = clients->next;
@@ -2138,7 +1372,6 @@ static void listen_loop(void)
pthread_attr_t attrs;
pthread_attr_init(&attrs);
- pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
child_id = (pthread_create(&the_thread, &attrs,
(void*)serve, csp) ? -1 : 0);
pthread_attr_destroy(&attrs);
@@ -2148,16 +1381,7 @@ static void listen_loop(void)
#if defined(_WIN32) && !defined(_CYGWIN) && !defined(SELECTED_ONE_OPTION)
#define SELECTED_ONE_OPTION
child_id = _beginthread(
- (void (*)(void *))serve,
- 64 * 1024,
- csp);
-#endif
-
-#if defined(__OS2__) && !defined(SELECTED_ONE_OPTION)
-#define SELECTED_ONE_OPTION
- child_id = _beginthread(
- (void(* _Optlink)(void*))serve,
- NULL,
+ (void*)serve,
64 * 1024,
csp);
#endif
@@ -2186,7 +1410,7 @@ static void listen_loop(void)
NP_Entry, (ULONG)server_thread,
NP_Output, Output(),
NP_CloseOutput, FALSE,
- NP_Name, (ULONG)"privoxy child",
+ NP_Name, (ULONG)"junkbuster child",
NP_StackSize, 200*1024,
TAG_DONE)))
{
@@ -2221,7 +1445,7 @@ static void listen_loop(void)
wait( NULL );
#endif /* !defined(_WIN32) && defined(__CYGWIN__) */
close_socket(csp->cfd);
- csp->flags &= ~CSP_FLAG_ACTIVE;
+ csp->active = 0;
}
#endif
@@ -2238,7 +1462,7 @@ static void listen_loop(void)
write_socket(csp->cfd, buf, strlen(buf));
close_socket(csp->cfd);
- csp->flags &= ~CSP_FLAG_ACTIVE;
+ csp->active = 0;
sleep(5);
continue;
}
@@ -2248,48 +1472,7 @@ static void listen_loop(void)
serve(csp);
}
}
-
- /* NOTREACHED unless FEATURE_GRACEFUL_TERMINATION is defined */
-
- /* Clean up. Aim: free all memory (no leaks) */
-#ifdef FEATURE_GRACEFUL_TERMINATION
-
- log_error(LOG_LEVEL_ERROR, "Graceful termination requested");
-
- unload_current_config_file();
- unload_current_actions_file();
- unload_current_re_filterfile();
-#ifdef FEATURE_TRUST
- unload_current_trust_file();
-#endif
-
- if (config->multi_threaded)
- {
- int i = 60;
- do
- {
- sleep(1);
- sweep();
- } while ((clients->next != NULL) && (--i > 0));
-
- if (i <= 0)
- {
- log_error(LOG_LEVEL_ERROR, "Graceful termination failed - still some live clients after 1 minute wait.");
- }
- }
- sweep();
- sweep();
-
-#if defined(unix)
- free(basedir);
-#endif
-#if defined(_WIN32) && !defined(_WIN_CONSOLE)
- /* Cleanup - remove taskbar icon etc. */
- TermLogWindow();
-#endif
-
- exit(0);
-#endif /* FEATURE_GRACEFUL_TERMINATION */
+ /* NOTREACHED */
}
diff --git a/jcc.h b/jcc.h
index 1778f1ea..f2560d33 100644
--- a/jcc.h
+++ b/jcc.h
@@ -1,6 +1,6 @@
-#ifndef JCC_H_INCLUDED
-#define JCC_H_INCLUDED
-#define JCC_H_VERSION "$Id: jcc.h,v 1.11 2002/03/24 13:25:43 swa Exp $"
+#ifndef _JCC_H
+#define _JCC_H
+#define JCC_H_VERSION "$Id: jcc.h,v 1.2 2001/05/31 21:24:47 jongfoster Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.h,v $
@@ -9,7 +9,7 @@
* the main connection-handling function.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -35,47 +35,6 @@
*
* Revisions :
* $Log: jcc.h,v $
- * Revision 1.11 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.10 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.9 2002/03/07 03:52:44 oes
- * Set logging to tty for --no-daemon mode
- *
- * Revision 1.8 2002/03/04 18:19:49 oes
- * Added extern const char *pidfile
- *
- * Revision 1.7 2001/11/05 21:41:43 steudten
- * Add changes to be a real daemon just for unix os.
- * (change cwd to /, detach from controlling tty, set
- * process group and session leader to the own process.
- * Add DBG() Macro.
- * Add some fatal-error log message for failed malloc().
- * Add '-d' if compiled with 'configure --with-debug' to
- * enable debug output.
- *
- * Revision 1.6 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.5 2001/07/29 19:32:00 jongfoster
- * Renaming _main() [mingw32 only] to real_main(), for ANSI compliance.
- *
- * Revision 1.4 2001/07/29 18:58:15 jongfoster
- * Removing nested #includes, adding forward declarations for needed
- * structures, and changing the #define _FILENAME_H to FILENAME_H_INCLUDED.
- *
- * Revision 1.3 2001/07/18 12:31:58 oes
- * moved #define freez from jcc.h to project.h
- *
* Revision 1.2 2001/05/31 21:24:47 jongfoster
* Changed "permission" to "action" throughout.
* Removed DEFAULT_USER_AGENT - it must now be specified manually.
@@ -89,36 +48,34 @@
*********************************************************************/
+/* Declare struct FILE for vars and funcs. */
+#include
+
+/* All of our project's data types. */
+#include "project.h"
+
+#include "loadcfg.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-struct client_state;
-struct file_list;
-
/* Global variables */
-#ifdef FEATURE_STATISTICS
+#ifdef STATISTICS
extern int urls_read;
extern int urls_rejected;
-#endif /*def FEATURE_STATISTICS*/
+#endif /*def STATISTICS*/
extern struct client_state clients[];
-extern struct file_list files[];
-#ifdef unix
-extern const char *pidfile;
-#endif
-extern int no_daemon;
+extern struct file_list files[];
-#ifdef FEATURE_GRACEFUL_TERMINATION
-extern int g_terminate;
-#endif
/* Functions */
#ifdef __MINGW32__
-int real_main(int argc, const char *argv[]);
+int _main(int argc, const char *argv[]);
#else
int main(int argc, const char *argv[]);
#endif
@@ -131,7 +88,7 @@ extern const char jcc_h_rcs[];
} /* extern "C" */
#endif
-#endif /* ndef JCC_H_INCLUDED */
+#endif /* ndef _JCC_H */
/*
Local Variables:
diff --git a/junkbuster-rh.spec b/junkbuster-rh.spec
new file mode 100644
index 00000000..a20194f8
--- /dev/null
+++ b/junkbuster-rh.spec
@@ -0,0 +1,302 @@
+# $Id: junkbuster-rh.spec,v 1.10 2001/07/03 09:34:44 sarantis Exp $
+#
+# Written by and Copyright (C) 2001 the SourceForge
+# IJBSWA team. http://ijbswa.sourceforge.net
+#
+# Based on the Internet Junkbuster originally written
+# by and Copyright (C) 1997 Anonymous Coders and
+# Junkbusters Corporation. http://www.junkbusters.com
+#
+# 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.
+#
+# $Log: junkbuster-rh.spec,v $
+# Revision 1.10 2001/07/03 09:34:44 sarantis
+# bumped up version number.
+#
+# Revision 1.9 2001/06/12 18:15:29 swa
+# the % in front of configure (see tag below) confused
+# the rpm build process on 7.1.
+#
+# Revision 1.8 2001/06/12 17:15:56 swa
+# fixes, because a clean build on rh6.1 was impossible.
+# GZIP confuses make, % configure confuses rpm, etc.
+#
+# Revision 1.7 2001/06/11 12:17:26 sarantis
+# fix typo in %post
+#
+# Revision 1.6 2001/06/11 11:28:25 sarantis
+# Further optimizations and adaptations in the spec file.
+#
+# Revision 1.5 2001/06/09 09:14:11 swa
+# shamelessly adapted RPM stuff from the newest rpm that
+# RedHat provided for the JB.
+#
+# Revision 1.4 2001/06/08 20:54:18 swa
+# type with status file. remove forward et. al from file list.
+#
+# Revision 1.3 2001/06/07 17:28:10 swa
+# cosmetics
+#
+# Revision 1.2 2001/06/04 18:31:58 swa
+# files are now prefixed with either `confdir' or `logdir'.
+# `make redhat-dist' replaces both entries confdir and logdir
+# with redhat values
+#
+# Revision 1.1 2001/06/04 10:44:57 swa
+# `make redhatr-dist' now works. Except for the paths
+# in the config file.
+#
+#
+#
+Summary: The Internet Junkbuster
+Vendor: http://ijbswa.sourceforge.net
+Name: junkbuster
+Version: 2.9.5
+Release: 1
+Source0: http://www.waldherr.org/junkbuster/ijbswa.tar.gz
+Copyright: GPL
+BuildRoot: %{_tmppath}/%{name}-root
+Group: Networking/Utilities
+URL: http://ijbswa.sourceforge.net/
+Packager: Stefan Waldherr
+Obsoletes: junkbuster-raw junkbuster-blank
+Prereq: /usr/sbin/useradd , /sbin/chkconfig , /sbin/service
+Conflicts: junkbuster-raw junkbuster-blank
+
+%description
+The Internet Junkbuster stops your browser from displaying the
+advertisement images that pervade many commercial web pages. Since
+your browser has to download fewer images, surfing the web should be
+faster.
+
+%define ijbconf %{_sysconfdir}/junkbuster
+
+%prep
+%setup -c -n ijbswa
+
+%build
+./configure
+make
+strip junkbuster
+
+%pre
+/usr/sbin/useradd -d /etc/junkbuster -u 73 -r junkbust > /dev/null 2>&1 || /bin/true
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p ${RPM_BUILD_ROOT}%{_sbindir} \
+ ${RPM_BUILD_ROOT}%{_mandir}/man8 \
+ ${RPM_BUILD_ROOT}/var/log/junkbuster \
+ ${RPM_BUILD_ROOT}%{ijbconf}/templates \
+ ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d \
+ ${RPM_BUILD_ROOT}%{_sysconfdir}/rc.d/init.d
+
+install -s -m 744 junkbuster $RPM_BUILD_ROOT%{_sbindir}/junkbuster
+cp -f junkbuster.1 $RPM_BUILD_ROOT%{_mandir}/man8/junkbuster.8
+cp -f actionsfile $RPM_BUILD_ROOT%{ijbconf}/actionsfile
+cp -f re_filterfile $RPM_BUILD_ROOT%{ijbconf}/re_filterfile
+cp -f trust $RPM_BUILD_ROOT%{ijbconf}/trust
+cp -f templates/default $RPM_BUILD_ROOT%{ijbconf}/templates/
+cp -f templates/show-status $RPM_BUILD_ROOT%{ijbconf}/templates/
+cp -f templates/show-status-file $RPM_BUILD_ROOT%{ijbconf}/templates/
+cp -f junkbuster.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/junkbuster
+install -m 755 junkbuster.init $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/junkbuster
+install -m 744 -d $RPM_BUILD_ROOT/var/log/junkbuster
+
+# verify all file locations, etc. in the config file
+# don't start with ^ or commented lines are not replaced
+cat config | \
+ sed 's/^confdir.*/confdir \/etc\/junkbuster/g' | \
+# sed 's/^permissionsfile.*/permissionsfile \/etc\/junkbuster\/permissionsfile/g' | \
+# sed 's/^re_filterfile.*/re_filterfile \/etc\/junkbuster\/re_filterfile/g' | \
+# sed 's/^logfile.*/logfile \/var\/log\/junkbuster\/logfile/g' | \
+# sed 's/^jarfile.*/jarfile \/var\/log\/junkbuster\/jarfile/g' | \
+# sed 's/^forward.*/forward \/etc\/junkbuster\/forward/g' | \
+# sed 's/^aclfile.*/aclfile \/etc\/junkbuster\/aclfile/g' > \
+ sed 's/^logdir.*/logdir \/var\/log\/junkbuster/g' > \
+ $RPM_BUILD_ROOT%{ijbconf}/config
+
+%post
+if [ "$1" = "1" ]; then
+ /sbin/chkconfig --add junkbuster
+fi
+
+%preun
+if [ "$1" = "0" ]; then
+ /sbin/service junkbuster stop > /dev/null 2>&1 ||:
+ /sbin/chkconfig --del junkbuster
+fi
+
+%postun
+if [ "$1" -ge "1" ]; then
+ /sbin/service junkbuster condrestart > /dev/null 2>&1
+fi
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+# %doc ijbfaq.html ijbman.html README README.TOO gpl.html
+%doc junkbuster.weekly junkbuster.monthly
+%dir %{ijbconf}
+%config %{ijbconf}/*
+%attr(0744,junkbust,junkbust) %dir /var/log/junkbuster
+%config %{_sysconfdir}/logrotate.d/junkbuster
+%attr(0744,junkbust,junkbust)/usr/sbin/junkbuster
+%{_mandir}/man8/*
+%config %{_sysconfdir}/rc.d/init.d/junkbuster
+
+
+%changelog
+
+* Sun Jun 3 2001 Stefan Waldherr
+- rework of RPM
+
+* Mon Sep 25 2000 Stefan Waldherr
+- CLF Logging patch by davep@cyw.uklinux.net
+- Hal DeVore fix akamaitech in blocklist
+
+* Sun Sep 17 2000 Stefan Waldherr
+- Steve Kemp skx@tardis.ed.ac.uk's javascript popup patch.
+- Markus Breitenbach breitenb@rbg.informatik.tu-darmstadt.de supplied
+ numerous fixes and enhancements for Steve's patch.
+- adamlock@netscape.com (Adam Lock) in the windows version:
+ - Taskbar activity spinner always spins even when logging is
+ turned off (which is the default) - people who don't
+ like the spinner can turn it off from a menu option.
+ - Taskbar popup menu has a options submenu - people can now
+ open the settings files for cookies, blockers etc.
+ without opening the JB window.
+ - Logging functionality works again
+ - Buffer overflow is fixed - new code uses a bigger buffer
+ and snprintf so it shouldn't overflow anymore.
+- Fixed userid swa, group learning problem while installing.
+ root must build RPM.
+- Added patch by Benjamin Low that prevents JB to
+ core dump when there is no log file.
+- Tweaked SuSE startup with the help of mohataj@gmx.net and Doc.B@gmx.de.
+- Fixed man page to include imagefile and popupfile.
+- Sanity check for the statistics function added.
+- "Patrick D'Cruze" : It seems Microsoft
+ are transitioning Hotmail from FreeBSD/Apache to Windows 2000/IIS.
+ With IIS/5, it appears to omit the trailing \r\n from http header
+ only messages. eg, when I visit http://www.hotmail.com, IIS/5
+ responds with a HTTP 302 redirect header. However, this header
+ message is missing the trailing \r\n. IIS/5 then closes the
+ connection. Junkbuster, unfortunately, discards the header becomes
+ it thinks it is incomplete - and it is. MS have transmitted an
+ incomplete header!
+- Added bug reports and patch submission forms in the docs.
+
+* Mon Mar 20 2000 Stefan Waldherr
+ Andrew extended the JB:
+ Display of statistics of the total number of requests and the number
+ of requests filtered by junkbuster, also the percentage of requests
+ filtered. Suppression of the listing of files on the proxy-args page.
+ All stuff optional and configurable.
+
+* Sun Sep 12 1999 Stefan Waldherr
+ Jan Willamowius (jan@janhh.shnet.org) fixed a bug in the
+ code which prevented the JB from handling URLs of the form
+ user:password@www.foo.com. Fixed.
+
+* Mon Aug 2 1999 Stefan Waldherr
+ Blank images are no longer cached, thanks to a hint from Markus
+ Breitenbach . The user
+ agent is NO longer set by the Junkbuster. Sadly, many sites depend
+ on the correct browser version nowadays. Incorporated many
+ suggestions from Jan "Yenya" Kasprzak for the
+ spec file. Fixed logging problem and since runlevel 2 does not
+ use networking, I replaced /etc/rc.d/rc2.d/S84junkbuster with
+ /etc/rc.d/rc2.d/K09junkbuster thanks to Shaw Walker
+ . You should now be able to build this RPM as
+ a non-root user (mathias@weidner.sem.lipsia.de).
+
+* Sun Jan 31 1999 Stefan Waldherr
+ /var/log/junkbuster set to nobody. Added /etc/junkbuster/imagelist
+ to allow more sophisticated matching of blocked images. Logrotate
+ logfile. Added files for auto-updating the blocklist et al.
+
+* Wed Dec 16 1998 Stefan Waldherr
+ Configure blank version via config file. No separate blank
+ version anymore. Added Roland's
+ patch to show a logo instead of a blank area. Added a suggestion
+ from Alex : /var/lock/subsys/junkbuster.
+ More regexps in the blocklist. Prepared the forwardfile for
+ squid. Extended image regexp with help from gabriel
+ .
+
+* Thu Nov 19 1998 Stefan Waldherr
+ All RPMs now identify themselves in the show-proxy-args page.
+ Released Windoze version. Run junkbuster as nobody instead of
+ root.
+
+* Fri Oct 30 1998 Stefan Waldherr
+ Newest version. First release (hence the little version number
+ mixture -- 2.0.2-0 instead of 2.0-7). This version tightens
+ security over 2.0.1; some multi-user sites will need to change
+ the listen-address in the configuration file. The blank version of
+ the Internet Junkbuster has a more sophisticated way of replacing
+ images. All RPMs identify themselves in the show-proxy-args page.
+
+* Thu Sep 23 1998 Stefan Waldherr
+ Modified the blocking feature, so that only GIFs and JPEGs are
+ blocked and replaced but not HTML pages. Thanks to
+ "Gerd Flender" for this nice
+ idea. Added numerous stuff to the blocklist. Keep patches in
+ seperate files and no longer in diffs (easier to maintain).
+
+* Tue Jun 16 1998 Stefan Waldherr
+ Moved config files to /etc/junkbuster directory, moved man page,
+ added BuildRoot directive (Thanks to Alexey Nogin )
+ Made new version junkbuster-raw (which is only a stripped version of
+ the junkuster rpm, i.e. without my blocklist, etc.)
+
+* Tue Jun 16 1998 (2.0-1)
+ Uhm, not that much. Just a new junkbuster version that
+ fixes a couple of bugs ... and of course a bigger
+ blocklist with the unique Now-less-ads-than-ever(SM)
+ feature.
+ Oh, one thing: I changed the default user agent to Linux -- no
+ need anymore to support Apple.
+
+* Tue Jun 16 1998 (2.0-0)
+ Now-less-ads-than-ever (SM)
+ compiled with gcc instead of cc
+ compiled with -O3, thus it should be a little faster
+ show-proxy-args now works
+ /etc/junkbuster.init wasn't necessary
+
+* Tue Jun 16 1998 (1.4)
+ some more config files were put into /etc
+ The junkbuster-blank rpm returns a 1x1 pixel image, that gets
+ displayed by Netscape instead of the blocked image.
+ Read http://www.waldherr.org/junkbuster/ for
+ further info.
+
+* Tue Jun 16 1998 (1.3)
+ The program has been moved to /usr/sbin (from /usr/local/bin)
+ Init- and stopscripts (/etc/rc.d/rc*) have been added so
+ that the junkbuster starts automatically during bootup.
+ The /etc/blocklist file is much more sophisticated. Theoretically
+ one should e.g. browse all major US and German newspapers without
+ seeing one annoying ad.
+ junkbuster.init was modified. It now starts junkbuster with an
+ additional "-r @" flag.
diff --git a/junkbuster-suse.spec b/junkbuster-suse.spec
new file mode 100644
index 00000000..9218a2fd
--- /dev/null
+++ b/junkbuster-suse.spec
@@ -0,0 +1,175 @@
+# $Id: junkbuster-suse.spec,v 1.4 2001/06/08 20:53:36 swa Exp $
+#
+# Written by and Copyright (C) 2001 the SourceForge
+# IJBSWA team. http://ijbswa.sourceforge.net
+#
+# Based on the Internet Junkbuster originally written
+# by and Copyright (C) 1997 Anonymous Coders and
+# Junkbusters Corporation. http://www.junkbusters.com
+#
+# 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.
+#
+# $Log: junkbuster-suse.spec,v $
+# Revision 1.4 2001/06/08 20:53:36 swa
+# use buildroot, export init to separate file (better manageability)
+#
+# Revision 1.3 2001/06/07 17:28:10 swa
+# cosmetics
+#
+# Revision 1.2 2001/06/07 17:18:44 swa
+# header fixed
+#
+#
+# neededforbuild -ijb
+# usedforbuild -ijb aaa_base aaa_dir autoconf automake base bash bindutil binutils bison bzip compress cpio cracklib db devs diffutils e2fsprogs file fileutils findutils flex gawk gcc gdbm gdbm-devel gettext glibc glibc-devel gpm gppshare groff gzip kbd less libtool libz lx_suse make mktemp modutils ncurses ncurses-devel net-tools netcfg nkitb pam pam-devel patch perl pgp ps rcs rpm sendmail sh-utils shadow strace syslogd sysvinit texinfo textutils timezone unzip util-linux vim xdevel xf86 xshared
+
+Vendor: http://ijbswa.sourceforge.net
+Distribution: defineme
+Name: junkbuster
+Packager: Stefan Waldherr
+
+Copyright: GPL
+BuildRoot: /tmp/junkbuster-rpmbuild
+Group: Networking/Utilities
+Provides: ijb
+Obsoletes: ijb
+Autoreqprov: on
+Version: 2.9
+Release: 4
+Summary: The Internet Junkbuster
+Source: http://www.waldherr.org/junkbuster/ijbswa.tar.gz
+
+#
+# -----------------------------------------------------------------------------
+#
+%description
+The Internet Junkbuster stops your browser from displaying the
+advertisement images that pervade many commercial web pages. Since
+your browser has to download fewer images, surfing the web should be
+faster.
+
+Authors:
+--------
+ http://ijbswa.sourceforge.net
+
+SuSE series: n
+
+#
+# -----------------------------------------------------------------------------
+#
+%prep
+%setup -c -n ijbswa
+
+#
+# -----------------------------------------------------------------------------
+#
+%build
+./configure
+make
+
+#
+# -----------------------------------------------------------------------------
+#
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/{var/log/junkbuster,usr/{sbin,share/man/man1},etc/{junkbuster,junkbuster/templates,init.d}}
+
+install -m 755 junkbuster.init.suse $RPM_BUILD_ROOT/etc/init.d/junkbuster
+ln -sf $RPM_BUILD_ROOT/etc/init.d/junkbuster $RPM_BUILD_ROOT/usr/sbin/rcjunkbuster
+
+install -m 755 junkbuster $RPM_BUILD_ROOT/usr/sbin
+install -d $RPM_BUILD_ROOT/etc/junkbuster
+install -d $RPM_BUILD_ROOT/etc/junkbuster/templates
+install -m 644 permissionsfile $RPM_BUILD_ROOT/etc/junkbuster
+install -m 644 re_filterfile $RPM_BUILD_ROOT/etc/junkbuster
+# verify all file locations, etc. in the config file
+# don't start with ^ or commented lines are not replaced
+cat config | \
+ sed 's/^confdir.*/confdir \/etc\/junkbuster/g' | \
+# sed 's/^permissionsfile.*/permissionsfile \/etc\/junkbuster\/permissionsfile/g' | \
+# sed 's/^re_filterfile.*/re_filterfile \/etc\/junkbuster\/re_filterfile/g' | \
+# sed 's/^logfile.*/logfile \/var\/log\/junkbuster\/logfile/g' | \
+# sed 's/^jarfile.*/jarfile \/var\/log\/junkbuster\/jarfile/g' | \
+# sed 's/^forward.*/forward \/etc\/junkbuster\/forward/g' | \
+# sed 's/^aclfile.*/aclfile \/etc\/junkbuster\/aclfile/g' > \
+ sed 's/^logdir.*/logdir \/var\/log\/junkbuster/g' > \
+ config.tmp
+cp -f config.tmp config
+install -m 644 config $RPM_BUILD_ROOT/etc/junkbuster
+#install -m 644 forward $RPM_BUILD_ROOT/etc/junkbuster
+install -m 644 trust $RPM_BUILD_ROOT/etc/junkbuster
+install -m 644 templates/default $RPM_BUILD_ROOT/etc/junkbuster/templates
+install -m 644 templates/show-status $RPM_BUILD_ROOT/etc/junkbuster/templates
+install -m 644 templates/show-status-file $RPM_BUILD_ROOT/etc/junkbuster/templates
+install -m 644 junkbuster.1 $RPM_BUILD_ROOT/usr/share/man/man1
+%{?suse_check}
+
+#
+# -----------------------------------------------------------------------------
+#
+%post
+sbin/insserv etc/init.d/junkbuster
+
+#
+# -----------------------------------------------------------------------------
+#
+%postun
+sbin/insserv etc/init.d/
+
+#
+# -----------------------------------------------------------------------------
+#
+%files
+#%doc README *.html
+/usr/sbin/junkbuster
+/usr/share/man/man1/junkbuster.1.gz
+%config(noreplace) /etc/junkbuster
+/etc/init.d/junkbuster
+/usr/sbin/rcjunkbuster
+
+#
+# -----------------------------------------------------------------------------
+#
+%changelog -n junkbuster
+* Sun Jun 3 2001 Stefan Waldherr
+- rework of RPM
+* Wed Feb 14 2001 - uli@suse.de
+- fixed init script
+* Wed Dec 06 2000 - bjacke@suse.de
+- renamed package to junkbuster
+- fixed copyright tag
+* Thu Nov 30 2000 - uli@suse.de
+- moved init script to /etc/init.d
+* Wed Feb 16 2000 - kukuk@suse.de
+- Move /usr/man -> /usr/share/man
+- Mark /etc/ijb as "config(noreplace)"
+* Mon Sep 20 1999 - uli@suse.de
+- fixed init script
+* Mon Sep 13 1999 - bs@suse.de
+- ran old prepare_spec on spec file to switch to new prepare_spec.
+* Thu Apr 01 1999 - daniel@suse.de
+- do not start ijb as root (security)
+* Tue Mar 30 1999 - daniel@suse.de
+- don´t use saclfile.ini
+* Tue Mar 30 1999 - daniel@suse.de
+- small fix to whitelist-configuration,
+ version is and was 2.0.2 WITHOUT Stefan Waldherr's patches
+ (http://www.waldherr.org/junkbuster/)
+* Mon Mar 01 1999 - daniel@suse.de
+- new package: version 2.0
diff --git a/junkbuster.1 b/junkbuster.1
new file mode 100644
index 00000000..d88294da
--- /dev/null
+++ b/junkbuster.1
@@ -0,0 +1,871 @@
+.TH JUNKBUSTER 1 "http://www.junkbusters.com/ht/en/ijb2.0man.html"
+.SH NAME
+\fBjunkbuster\fP
+- The
+Internet Junkbuster
+Proxy
+\s-2(TM)\s+2
+.SH SYNOPSIS
+\fBjunkbuster\fP
+\fI\&configfile\fP
+(Version 2.0 onwards)
+.br
+\fBjunkbstr.exe\fP
+\fI\&configfile\fP
+(Windows)
+.br
+\fBjunkbuster\fP
+[-a]
+[-y]
+[-s]
+[-c]
+[-v]
+.br
+[-u user_agent]
+[-r referer]
+[-t from]
+.br
+[-b blockfile]
+[-j jarfile]
+[-l logfile]
+.br
+[-w NAME=VALUE]
+[-x Header_text]
+.br
+[-h [bind_host_address][:bind_port]]
+.br
+[-f forward_host[:port]]
+[-d N]
+.br
+[-g gw_protocol[:[gw_host][:gw_port]]]
+.br
+(Version 1.4 and earlier)
+.SH DESCRIPTION
+\fBjunkbuster\fP
+is an instrumentable proxy that filters the
+\s-2HTTP\s0
+stream between
+web servers and browsers.
+Its main purpose is to enhance privacy.
+.P
+Versions before 2.0 used command-line options;
+Versions from 2.0 onward use a configuration file.
+The following descriptions of the options first give the older
+command-line usage, then the new configfile line.
+.P
+In Versions 2.0.1 upwards on Windows,
+a start-up message is printed and the configuration is read from the file
+\fC\&junkbstr.ini\fP
+if it exists and no argument was given.
+.P
+All files except the configfile
+are checked for changes before each page is fetched,
+so they may edited without restarting the proxy.
+.SS OPTIONS
+.TP
+.\" anchor: o_b blockfile
+\fI-b blockfile\fP (Old) blockfile \fIblockfile\fP (New)
+Block\" ijbfaq.html#blocking
+requests to
+\s-2URL\s0s
+matching any pattern given in the lines of the
+\fI\&blockfile\fP.
+The
+\fBjunkbuster\fP
+instead returns status 202, indicating that the request has been accepted
+(though not completed),
+and a
+message identifying itself\" ijbfaq.html#show
+(though the browser may
+display only a broken image icon).
+(Versions before 2.0 returned an error 403 (Forbidden).)
+The syntax of a pattern is
+\fB\&[domain][:port][/path]\fP
+(the
+\fB\&http://\fP
+or
+\fB\&https://\fP
+protocol part is omitted).
+To decide if a pattern matches a target, the domains are compared first,
+then the paths.
+.P
+To compare the domains,
+the pattern domain and the target
+domain specified in the
+\s-2URL\s0
+are each broken into their components.
+(Components are separated by the
+\fC\&.\fP
+(period) character.)
+Next each of the target components
+is compared with the corresponding pattern component: last with last,
+next-to-last with next-to-last, and so on.
+(This is called
+\fIright-anchored\fP
+matching.)
+If all of the pattern components find their match in the target,
+then the domains are considered a match.
+Case is irrelevant when comparing domain components.
+.P
+A successfully
+matching pattern can be an anchored substring of a target, but
+not vice versa.
+Thus if a pattern doesn't specify a domain,
+it matches all domains.
+.\" anchor: wildcard
+Furthermore, when comparing two components,
+the components must either match in their entirety or up to a wildcard
+\fC\&* \fP
+(star character) in the pattern. The wildcard feature
+implements only a "prefix" match capability ("abc*" vs. "abcdefg"),
+not suffix matching ("*efg" vs. "abcdefg") or
+infix matching ("abc*efg" vs. "abcdefg").
+The feature is restricted to the domain component;
+it is unrelated to the optional
+regular expression
+feature in the path
+(described below).\" ijbman.html#regex
+.P
+If a numeric port
+is specified in the pattern domain, then the target port must
+match as well. The default port in a target is port 80.
+.P
+If the domain and port match,
+then the target
+\s-2URL\s0
+path is checked for
+a match against the path in the pattern.
+Paths are compared with a simple case-sensitive
+left-anchored substring comparison.
+Once again, the pattern can be an
+anchored substring of the target, but not vice versa.
+A path of
+\fC\&/\fP
+(slash) would match all paths. Wildcards are not considered in
+path comparisons.
+.P
+For example, the target
+\s-2URL\s0
+.br
+.ti +0.25i
+\fB\&the.yellow-brick-road.com/TinMan/has_no_brain\fP
+.br
+would be matched (and blocked) by the following patterns
+.br
+.ti +0.25i
+\fB\&yellow-brick-road.com\fP
+.br
+and
+.br
+.ti +0.25i
+\fB\&Yellow*.COM\fP
+.br
+and
+.br
+.ti +0.25i
+\fB\&/TinM\fP
+.br
+but not
+.br
+.ti +0.25i
+\fB\&follow.the.yellow-brick-road.com\fP
+.br
+or
+.br
+.ti +0.25i
+\fB\&/tinman\fP
+.br
+.P
+Comments in a blockfile start with a
+\fB\\fP
+(hash) character and end at a new line.
+Blank lines are also ignored.
+.P
+Lines beginning with a
+\fC\&~\fP
+(tilde) character are taken to be
+exceptions:\" ijbfaq.html#exceptions
+a
+\s-2URL\s0
+blocked by previous patterns that matches the rest of
+the line is let through. (The last match wins.)
+.P
+Patterns
+may contain
+\s-2POSIX\s0
+regular expressions\" ijbfaq.html#regex
+provided the
+\fBjunkbuster\fP
+was compiled with this option
+(the default in Version 2.0 on).
+The idiom
+\fC\&/*.*/ad\fP
+can then be used
+to match any
+\s-2URL\s0
+containing
+\fC\&/ad\fP
+(such as
+\fC\&http://nomatterwhere.com/images/advert/g3487.gif\fP
+for example).
+These expressions
+don't work\" ijbman.html#substring
+in the domain part.
+.P
+In version 1.3 and later
+the blockfile and cookiefile are checked for changes before each request.
+.TP
+tinygif \fIN\fP
+Set appearance of blocked GIFs. You can select one of the following
+values:
+.br
+.br
+\h'-\w"0 = "u'0 = Show a ``broken icon'' in the browser
+.br
+\h'-\w"1 = "u'1 = Show a one pixel transparent GIF
+.br
+\h'-\w"2 = "u'2 = Show a GIF with the word ``JUNKBUSTER''
+.TP
+popupfile \fI\&popup\fP
+Sets the name of the popupfile. If uncommented, the popupfile
+controls on which sites Javascript popup windows are disabled.
+.TP
+.\" anchor: o_w wafer
+\fI-w NAME=VALUE\fP (Old) wafer \fINAME=VALUE\fP (New)
+Specifies a pair to be sent as a cookie with every request
+to the server.\" ijbfaq.html#wafers
+(Such boring cookies are called
+\fI\&wafers\fP.)
+This option may be called more than once to generate multiple wafers.
+The original
+Netscape specification
+prohibited
+semi-colons, commas and white space;
+these characters will be
+\s-2URL\s0-encoded
+if used in wafers.
+The Path and Domain attributes are not currently supported.
+.TP
+.\" anchor: o_c cookiefile
+\fI-c cookiefile\fP (Old) cookiefile \fIcookiefile\fP (New)
+Enforce the cookie management policy specified in the
+\fI\&cookiefile.\fP
+.\" anchor: java
+If this option is not used all cookies are silently crunched,
+so that users who never want cookies aren't bothered by browsers
+asking whether each cookie should be accepted.
+However, cookies can
+still get through\" ijbfaq.html#breakthrough
+via
+JavaScript\" links.html#javascript
+and
+\s-2SSL\s0,
+so alerts should be left on.
+.P
+In Version 1.2 and later
+this option must be followed by a
+filename\" ijbfaq.html#crumble
+containing instructions on which sites are allowed to
+receive and set cookies.
+.\" anchor: drop
+By default cookies are dropped in both the browser's request
+and the server's response, unless the
+\s-2URL\s0
+requested matches an entry in the
+\fI\&cookiefile\fP.
+The matching algorithm is the same as for the blockfile.
+A leading
+\fC\&>\fP
+character allows
+server-bound\" ijbfaq.html#directional
+cookies only;
+a
+\fC\&<\fP
+allows only browser-bound cookies;
+a
+\fC\&~\fP
+character stops cookies in
+both directions.\" ijbfaq.html#crumble
+Thus a cookiefile containing a single line with the two characters
+\fC\&>*\fP
+will pass on all cookies to servers but not give any new ones to the browser.
+.TP
+.\" anchor: o_j jarfile
+\fI-j jarfile\fP (Old) jarfile \fIjarfile\fP (New)
+All Set-cookie attempts by the server are
+logged\" ijbfaq.html#jar
+to
+\fI\&jarfile\fP.
+If no wafer is specified,
+one containing a
+canned notice\" ijbfaq.html#notice
+(the
+\fI\&vanilla wafer\fP)
+is added as an alert to the server
+unless the
+suppress-vanilla-wafer\" ijbman.html#suppress-vanilla-wafer
+option is invoked.
+.TP
+.\" anchor: o_v suppress-vanilla-wafer
+\fI-v\fP (Old) suppress-vanilla-wafer \fI\fP (New)
+Suppress the vanilla wafer.
+.TP
+.\" anchor: o_t from
+\fI-t from\fP (Old) from \fIfrom\fP (New)
+If the browser
+discloses an email address\" ijbfaq.html#from
+in the
+\fB\&FROM\fP
+header (most don't),
+replace it with
+\fI\&from.\fP
+If
+\fI\&from\fP
+is set to
+\fB\&.\fP
+(the period character)
+the
+\fB\&FROM\fP
+is passed to the server unchanged.
+The default is to delete the
+\fB\&FROM\fP
+header.
+.TP
+.\" anchor: o_r referer
+\fI-r referer\fP (Old) referer \fIreferer\fP (New)
+Whenever the browser discloses the
+\s-2URL\s0
+that
+led to\" ijbfaq.html#referer
+the current request,
+replace it with
+\fI\&referer.\fP
+If
+\fI\&referer\fP
+is set to
+\fB\&.\fP
+(period)
+the
+\s-2URL\s0
+is passed to the server unchanged.
+In
+Version 1.4
+and later, if referer is set to
+\fB\&@\fP
+(at) the
+\s-2URL\s0
+is sent in cases where the cookiefile
+specifies that a cookie would be sent.
+(No way to send bogus referers selectively is provided.)
+The default is to delete Referer.
+.P
+Version 2.0 also accepts the spelling
+\fC\&referrer\fP,
+which most dictionaries consider correct.
+.TP
+.\" anchor: o_u user-agent
+\fI-u user-agent\fP (Old) user-agent \fIuser-agent\fP (New)
+Information disclosed by the browser
+about itself\" ijbfaq.html#agent
+is replaced with the value
+\fI\&user-agent.\fP
+If
+\fI\&user-agent\fP
+is set to
+\fB\&.\fP
+(period)
+the
+\fB\&User-Agent\fP
+header is passed to the server unchanged,
+along with any
+\fB\&UA\fP
+headers produced by
+\s-2MS-IE\s0
+(which would otherwise be deleted).
+In
+Version 1.4
+and later, if
+\fI\&user-agent\fP
+is set to
+\fB\&@\fP
+(at) these headers are sent unchanged in cases where the cookiefile
+specifies that a cookie would be sent,
+otherwise only default
+\fB\&User-Agent\fP
+header is sent.
+That default
+is Mozilla/3.0 (Netscape)
+with an unremarkable
+Macintosh\" ijbfaq.html#infer
+configuration.
+If used with a browser less advanced than Mozilla/3.0 or IE-3, the default
+may encourage pages containing extensions that confuse the browser.
+.TP
+.\" anchor: o_h listen-address
+\fI-h [host][:port]\fP (Old) listen-address \fI[host][:port]\fP (New)
+If
+\fI\&host\fP
+is specified,
+bind the
+\fBjunkbuster\fP
+to that
+\s-2IP\s0
+address.
+If a
+\fI\&port\fP
+is specified, use it.
+The default
+port
+is 8000;
+the default host is
+\fC\&localhost\fP.
+Before Version 2.0.2,
+the default was to bind to all
+\s-2IP\s0
+addresses
+(\fB\&INADDR_ANY\fP);
+but this has been restricted to
+\fB\&localhost\fP
+to avoid unintended security breaches.
+(To open the proxy to all, use the line
+.br
+.ti +0.25i
+\fB\&listen-address :8000\fP
+.br
+in the configuration file.)
+.TP
+.\" anchor: o_f forwardfile
+\fI-f forward_host[:port]\fP (Old) forwardfile \fIforwardfile\fP (New)
+Version 1.X required all
+\s-2HTTP\s0
+requests from the client to be forwarded to the same destination.
+Version 2.0 takes its routing specification from a
+\fI\&forwardfile\fP,
+allowing selection of the proxy (a.k.a. forwarding host) and gateway
+according to the
+\s-2URL\s0.
+Here is a typical line.
+.br
+.ft CW
+.S 8
+.nf
+.sp
+* lpwa.com:8000 . .
+.S
+.ft
+.fi
+.sp
+
+.P
+Each line contains four fields:
+\fB\&target\fP,
+\fB\&forward_to\fP,
+\fB\&via_gateway_type\fP
+and
+\fB\&gateway\fP.
+As usual, the
+last\" ijbman.html#compare
+\fB\&target\fP
+domain that matches the requested
+\s-2URL\s0
+wins,
+and the
+\fC\&*\fP
+character alone matches any domain.
+The target domain need not be a fully qualified
+hostname; it can be a general domain such as
+\fC\&com\fP
+or
+\fC\&co.uk\fP
+or even just a port number.
+.\" anchor: nose
+For example, because
+LPWA
+does not handle
+SSL,\" ijbfaq.html#encrypt
+the line above will typically be followed by a line such as
+.br
+.ft CW
+.S 8
+.nf
+.sp
+:443 . . .
+.S
+.ft
+.fi
+.sp
+
+to allow SSL transactions to proceed directly.
+The cautious would also
+add an entry in their blockfile to stop transactions
+to port 443 for all but specified trusted sites.
+.P
+If the winning
+\fB\&forward_to\fP
+field is
+\fC\&.\fP
+(the dot character) the proxy connects
+directly to the server given in the
+\s-2URL\s0,
+otherwise it forwards to the host and port number specified.
+The default port is 8000.
+The
+\fC\&via_gateway_type\fP
+and
+\fC\&gateway\fP
+fields also use a dot to indicate no gateway protocol.
+The gateway protocols are explained
+below.\" ijbman.html#o_g
+.P
+The example line above in a forwardfile alone
+would send everything through port 8000 at
+\fC\&lpwa.com\fP
+with no gateway protocol,
+and is equivalent to the old
+\fC\&-f lpwa.com:8000\fP
+with no
+\fC\&-g\fP
+option.
+For more information see the example file provided with the distribution.
+.P
+Configure with care: no loop detection is performed.
+When setting up chains of proxies that might loop back, try adding
+Squid.\" ijbman.html#squid
+.TP
+.\" anchor: o_g
+\fI-g gw_protocol[:[gw_host][:gw_port]]\fP (Old)
+Use
+\fI\&gw_protocol\fP
+as the gateway protocol.
+This option was introduced in Version 1.4,
+but was folded into the
+forwardfile\" ijbman.html#forwardfile
+option in Version 2.0.
+The default is to use no gateway protocol;
+this may be explicitly specified as
+\fB\&direct\fP
+on the command line
+or the dot character in the forwardfile.
+The
+\fC\&SOCKS4\fP
+protocol may be specified as
+\fB\&socks\fP
+or
+\fB\&socks4\fP.
+The
+\fC\&SOCKS4A\fP
+protocol is specified as
+\fB\&socks4a\fP.
+The
+\fC\&SOCKS5\fP
+protocol is not currently supported.
+The default
+\s-2SOCKS\s0
+\fI\&gw_port\fP
+is 1080.
+.P
+The user's browser should
+\fInot\fP
+be
+configured\" ijbfaq.html#socks
+to use
+\fC\&SOCKS\fP;
+the proxy conducts the negotiations, not the browser.
+.P
+The user identification capabilities of
+\fC\&SOCKS4\fP
+are deliberately not used;
+the user is always identified to the
+\fC\&SOCKS\fP
+server as
+\fC\&userid=anonymous\fP.
+If the server's policy is to reject requests from
+\fC\&anonymous\fP,
+the proxy will not work.
+Use a
+debug\" ijbman.html#o_d
+value of 3
+to see the status returned by the server.
+.TP
+.\" anchor: o_d debug
+\fI-d N\fP (Old) debug \fIN\fP (New)
+Set debug mode.
+The most common value is 1,
+to
+pinpoint\" ijbfaq.html#pinpoint
+offensive
+\s-2URL\s0s,
+so they can be added to the blockfile.
+The value of
+\fB\&N\fP
+is a bitwise
+logical-\s-2OR\s0
+of the following values:
+.br
+.br
+\h'-\w"1 = "u'1 = URLs (show each URL requested by the browser);
+.br
+\h'-\w"2 = "u'2 = Connections (show each connection to or from the proxy);
+.br
+\h'-\w"4 = "u'4 = I/O (log I/O errors);
+.br
+\h'-\w"8 = "u'8 = Headers (as each header is scanned, show the header and what is done to it);
+.br
+\h'-\w"16 = "u'16 = Log everything (including debugging traces and the contents of the pages).
+.\" anchor: or
+Multiple
+\fB\&debug\fP
+lines are permitted; they are logical OR-ed together.
+.P
+Because most browsers send several requests in parallel
+the debugging output may appear intermingled, so the
+single-threaded\" ijbman.html#single-threaded
+option is recommended when using
+debug\" ijbman.html#debug
+with
+\fB\&N\fP
+greater than 1.
+.TP
+.\" anchor: o_y add-forwarded-header
+\fI-y\fP (Old) add-forwarded-header \fI\fP (New)
+Add
+\fB\&X-Forwarded-For\fP
+headers to the server-bound
+\s-2HTTP\s0
+stream
+indicating the client
+\s-2IP\s0
+address
+to the server,\" ijbfaq.html#detect
+in the new style of
+Squid 1.1.4.\" ijbman.html#squid
+If you want the traditional
+\fC\&HTTP_FORWARDED\fP
+response header, add it manually with the
+-x\" ijbman.html#o_x
+option.
+.TP
+.\" anchor: o_x add-header
+\fI-x HeaderText\fP (Old) add-header \fIHeaderText\fP (New)
+Add the
+\fI\&HeaderText\fP
+verbatim to requests to the server.
+Typical uses include
+adding old-style forwarding notices such as
+\fB\&Forwarded: by http://pro-privacy-isp.net\fP
+and reinstating the
+\fB\&Proxy-Connection: Keep-Alive\fP
+header
+(which the
+\fBjunkbuster\fP
+deletes so as
+not\" ijbfaq.html#detect
+to reveal its existence).
+No checking is done for correctness or plausibility,
+so it can be used to throw any old trash into the server-bound
+\s-2HTTP\s0
+stream.
+Please don't litter.
+.TP
+.\" anchor: o_s single-threaded
+\fI-s\fP (Old) single-threaded \fI\fP (New)
+Doesn't
+\fB\&fork()\fP
+a separate process
+(or create a separate thread)
+to handle each connection.
+Useful when debugging to keep the process single threaded.
+.TP
+.\" anchor: o_l logfile
+\fI-l logfile\fP (Old) logfile \fIlogfile\fP (New)
+Write all debugging data into
+\fI\&logfile.\fP
+The default
+\fI\&logfile\fP
+is the standard output.
+.TP
+.\" anchor: o_acl aclfile
+aclfile \fIaclfile\fP (New)
+Unless this option is used, the proxy talks to anyone who can connect to it,
+and everyone who can has equal permissions on where they can go.
+An access file allows restrictions to be placed on these two policies,
+by distinguishing some
+\fIsource\fP
+\s-2IP\s0
+addresses and/or
+some
+\fIdestination\fP
+addresses.
+(If a
+forwarder or a gateway\" ijbman.html#forwardfile
+is being used, its address is considered the destination address,
+not the ultimate
+\s-2IP\s0
+address of the
+\s-2URL\s0
+requested.)
+.P
+Each line of the access file begins with
+either the word
+\fB\&permit\fP
+or
+\fB\&deny\fP
+followed by source and (optionally) destination addresses
+to be matched against those of the
+\s-2HTTP\s0
+request.
+The last matching line specifies the result: if it was a
+\fB\&deny\fP
+line or if no line matched,
+the request will be refused.
+.P
+A source or destination
+can be specified as a single numeric
+\s-2IP\s0
+address,
+or with a hostname, provided that the host's name
+can be resolved to a numeric address: this cannot be used to block all
+\fB\&.mil \fP
+domains for example,
+because there is no single address associated with that domain name.
+Either form may be followed by a slash and an integer
+\fB\&N\fP,
+specifying a subnet mask of
+\fB\&N\fP
+bits.
+For example,
+\fB\&permit 207.153.200.72/24\fP
+matches the entire Class-C subnet from
+207.153.200.0
+through 207.153.200.255.
+(A netmask of 255.255.255.0 corresponds to 24 bits of
+ones in the netmask, as with
+\fC\&*_MASKLEN=24\fP.)
+A value of 16 would be used for a Class-B subnet.
+A value of zero for
+\fB\&N\fP
+in the subnet mask length will cause any address to match;
+this can be used to express a default rule.
+For more information see the example file provided with the distribution.
+.P
+If you like these access controls
+you should probably have
+firewall;\" ijbfaq.html#firewall
+they are not intended to replace one.
+.TP
+.\" anchor: o_tf trustfile
+trustfile \fItrustfile\fP (New)
+This feature is experimental, has not been fully documented and is
+very subject to change.
+The goal is for parents to be able to choose a page or site whose
+links they regard suitable for their
+young children\" ijbfaq.html#children
+and for the proxy to allow access only to sites mentioned there.
+To do this the proxy examines the
+referer\" ijbman.html#o_r
+variable on each page request to check they resulted from
+a click on the ``trusted referer'' site: if so the referred site
+is added to a list of trusted sites, so that the child can
+then move around that site.
+There are several uncertainties in this scheme that experience may be
+able to iron out; check back in the months ahead.
+.TP
+.\" anchor: o_ti trust_info_url
+trust_info_url \fItrust_info_url\fP (New)
+When access is denied due to lack of a trusted referer, this
+\s-2URL\s0
+is displayed with a message pointing the user to it for further information.
+.TP
+.\" anchor: o_hc hide-console
+hide-console \fI\fP (New)
+In the Windows version only, instructs the program
+to disconnect from and hide the command console after starting.
+.TP
+.\" anchor: o_a
+\fI-a\fP (Old)
+(Obsolete) Accept the server's
+\fB\&Set-cookie\fP
+headers, passing them through to the browser.
+.\" anchor: obsolete
+This option was removed in Version 1.2
+and replaced by an improvement to the
+-c\" ijbman.html#o_c
+option.
+.LE
+.SH INSTALLATION AND USE
+Browsers must be told where to find the
+\fBjunkbuster\fP
+(e.g.
+\fB\&localhost\fP
+port 8000).
+To set the
+\s-2HTTP\s0
+proxy in Netscape 3.0,
+go through:
+\fB\&Options\fP;
+\fB\&Network Preferences\fP;
+\fB\&Proxies\fP;
+\fB\&Manual Proxy Configuration\fP;
+\fB\&View\fP.
+See the
+\s-2FAQ\s0
+for other browsers.
+The
+Security Proxy\" ijbfaq.html#security
+should also be set to the same values,
+otherwise
+\fB\&shttp:\fP
+\s-2URL\s0s
+won't work.
+.P
+Note the limitations
+explained in the
+\s-2FAQ\s0.
+.SH CHECKING OPTIONS
+To allow users to
+check\" ijbfaq.html#show
+that a
+\fBjunkbuster\fP
+is running and how it is configured,
+it intercepts requests for any
+\s-2URL\s0
+ending in
+\fB\&/show-proxy-args\fP
+and blocks it,
+returning instead returns information on its
+version number and
+current configuration
+including the contents of its blockfile.
+To get an explicit warning that no
+\fBjunkbuster\fP
+intervened if the proxy was not configured,
+it's best to point it to a
+\s-2URL\s0
+that does this, such as
+http://internet.junkbuster.com/cgi-bin/show-proxy-args
+on Junkbusters's website.
+.SH SEE ALSO
+http://www.waldherr.org/junkbuster/\" waldherr.org#
+.br
+http://www.junkbusters.com/ht/en/ijbfaq.html\" ijbfaq.html#
+.br
+http://www.junkbusters.com/ht/en/cookies.html\" cookies.html#
+.br
+http://internet.junkbuster.com/cgi-bin/show-proxy-args
+.br
+http://www.cis.ohio-state.edu/htbin/rfc/rfc2109.html
+.br
+http://squid.nlanr.net/Squid/
+.br
+http://www-math.uni-paderborn.de/~axel/
+.SH COPYRIGHT AND GPL
+Written and copyright by the Anonymous Coders and Junkbusters Corporation
+and made available under the
+GNU General Public License (GPL).\" gpl.html#
+This software comes with
+NO WARRANTY.\" gpl.html#nowarr
+Internet Junkbuster
+Proxy
+is a
+trademark\" legal.html#marks
+of Junkbusters Corporation.
diff --git a/junkbuster.init b/junkbuster.init
new file mode 100644
index 00000000..f35001a8
--- /dev/null
+++ b/junkbuster.init
@@ -0,0 +1,133 @@
+#!/bin/sh
+# ********************************************************************
+#
+# File : $Source: /cvsroot/ijbswa/current/junkbuster.init,v $
+#
+# Purpose : This shell script takes care of starting and stopping
+# junkbuster.
+# This works only correctly if the user `nobody' is allowed
+# to be in the directory where this file is called
+# (for example: /root is NOT ok)
+#
+# Copyright : Written by and Copyright (C) 2001 the SourceForge
+# IJBSWA team. http://ijbswa.sourceforge.net
+#
+# Based on the Internet Junkbuster originally written
+# by and Copyright (C) 1997 Anonymous Coders and
+# Junkbusters Corporation. http://www.junkbusters.com
+#
+# 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: junkbuster.init,v $
+# Revision 1.7 2001/06/28 13:40:26 sarantis
+# remove single quotes from $JB; it was not expanded.
+#
+# Revision 1.6 2001/06/28 13:38:42 sarantis
+# formatting changes; individual return values are returned from the init script.
+#
+# Revision 1.5 2001/06/11 11:37:40 sarantis
+# Minor editing changes.
+#
+# Revision 1.4 2001/06/09 09:14:11 swa
+# shamelessly adapted RPM stuff from the newest rpm that
+# RedHat provided for the JB.
+#
+# Revision 1.3 2001/05/25 10:12:44 oes
+# Fixed default case in switch statement (# -> *)
+#
+# Revision 1.2 2001/05/24 07:52:24 swa
+# added header. removed ^M.
+#
+#
+# ********************************************************************/
+
+# This is file /etc/rc.d/init.d/junkbuster and was put here
+# by the junkbuster rpm
+#
+# chkconfig: 235 84 09
+#
+# description: This shell script takes care of starting and stopping \
+# junkbuster.
+#
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+. /etc/sysconfig/network
+
+# Check that networking is up.
+[ ${NETWORKING} = "no" ] && exit 0
+[ -f /usr/sbin/junkbuster ] || exit 0
+
+[ -f /etc/junkbuster/config ] || exit 0
+
+# See how we were called.
+
+JB="/usr/sbin/junkbuster /etc/junkbuster/config & "
+start () {
+ # start daemon
+ [ -f /var/lock/subsys/junkbuster ] && exit 0
+ echo -n $"Starting junkbuster: "
+ daemon --user junkbust $JB
+ RETVAL=$?
+ echo
+ [ $RETVAL = 0 ] && touch /var/lock/subsys/junkbuster
+ return $RETVAL
+}
+
+stop () {
+ # stop daemon
+ echo -n $"Stopping junkbuster: "
+ killproc junkbuster && rm -f /var/lock/subsys/junkbuster
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ reload|restart)
+ stop
+ start
+ RETVAL=$?
+ ;;
+ condrestart)
+ # restart only if already running
+ if [ -f /var/lock/subsys/junkbuster ] ; then
+ stop
+ start
+ RETVAL=$?
+ fi
+ ;;
+ status)
+ status junkbuster
+ RETVAL=$?
+ ;;
+ *)
+ echo $"Usage: junkbuster {start|stop|reload|restart|condrestart|status}"
+ exit 1
+esac
+
+exit $RETVAL
diff --git a/junkbuster.init.suse b/junkbuster.init.suse
new file mode 100644
index 00000000..e49579e1
--- /dev/null
+++ b/junkbuster.init.suse
@@ -0,0 +1,76 @@
+#! /bin/sh
+# ********************************************************************
+#
+# File : $Source: /cvsroot/ijbswa/current/junkbuster.init,v $
+#
+# Purpose : This shell script takes care of starting and stopping
+# junkbuster.
+#
+# Copyright : Written by and Copyright (C) 2001 the SourceForge
+# IJBSWA team. http://ijbswa.sourceforge.net
+#
+# Based on the Internet Junkbuster originally written
+# by and Copyright (C) 1997 Anonymous Coders and
+# Junkbusters Corporation. http://www.junkbusters.com
+#
+# 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: junkbuster.init,v $
+#
+#
+# ********************************************************************/
+### BEGIN INIT INFO
+# Provides: junkbuster ijb
+# Required-Start: $network syslog
+# Required-Stop:
+# Default-Start: 3 5
+# Default-Stop:
+# Description: Starts the Internet Junkbuster
+### END INIT INFO
+. /etc/rc.config
+base=\${0##*/}
+link=\${base#*[SK][0-9][0-9]}
+#test \$link = \$base && START_IJB=yes
+#test "\$START_IJB" = "yes" || exit 0
+return=\$rc_done
+case "\$1" in
+ start)
+ echo -n "Starting The Internet Junkbuster"
+ su - nobody -c 'nohup /usr/sbin/junkbuster /etc/junkbuster/config < /dev/null > /dev/null &'
+ sleep 1
+ echo -e "\$return"
+ ;;
+ stop)
+ echo -n "Shutting down The Internet Junkbuster"
+ killproc -TERM /usr/sbin/junkbuster || return=\$rc_failed
+ echo -e "\$return"
+ ;;
+ restart|reload)
+ \$0 stop && \$0 start || return=\$rc_failed
+ ;;
+ status)
+ checkproc /usr/sbin/junkbuster && echo OK || echo No process
+ ;;
+ *)
+ echo "Usage: \$0 {start|restart|status|stop}"
+ exit 1
+esac
+test "\$return" = "\$rc_done" || exit 1
+exit 0
diff --git a/privoxy.logrotate b/junkbuster.logrotate
similarity index 56%
rename from privoxy.logrotate
rename to junkbuster.logrotate
index 035112a5..e13ee1d5 100644
--- a/privoxy.logrotate
+++ b/junkbuster.logrotate
@@ -1,15 +1,15 @@
#
-# Logrotate file for Privoxy RPM
+# Logrotate file for Junkbuster RPM
#
# ********************************************************************
#
-# File : $Source: /cvsroot/ijbswa/current/privoxy.logrotate,v $
+# File : $Source: /cvsroot/ijbswa/current/junkbuster.logrotate,v $
#
-# Purpose : Rotates all potential Privoxy logfiles
+# Purpose : Rotates all potential Junkbuster logfiles
#
#
# Copyright : Written by and Copyright (C) 2001 the SourceForge
-# Privoxy team. http://www.privoxy.org/
+# IJBSWA team. http://ijbswa.sourceforge.net
#
# Based on the Internet Junkbuster originally written
# by and Copyright (C) 1997 Anonymous Coders and
@@ -34,35 +34,7 @@
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Revisions :
-# $Log: privoxy.logrotate,v $
-# Revision 1.3 2002/03/24 15:19:57 swa
-# name change related issue.
-#
-# Revision 1.2 2002/03/24 11:40:14 swa
-# name change
-#
-# Revision 1.1 2002/03/24 11:23:44 swa
-# name change
-#
-# Revision 1.7 2001/12/30 14:07:32 steudten
-# - Add signal handling (unix)
-# - Add SIGHUP handler (unix)
-# - Add creation of pidfile (unix)
-# - Add action 'top' in rc file (RH)
-# - Add entry 'SIGNALS' to manpage
-# - Add exit message to logfile (unix)
-#
-# Revision 1.6 2001/12/13 23:19:43 steudten
-# Add 'restart' of junkbuster service after rotate logfiles.
-# Better we could use the well known 'kill -HUP', but the handler
-# isn't there at this time.
-#
-# Revision 1.5 2001/11/05 21:31:51 steudten
-# Change switch mode from weekly to size 1M
-#
-# Revision 1.4 2001/06/28 13:30:22 sarantis
-# add missingok for the jarfile entry
-#
+# $Log: junkbuster.logrotate,v $
# Revision 1.3 2001/06/04 18:31:58 swa
# files are now prefixed with either `confdir' or `logdir'.
# `make redhat-dist' replaces both entries confdir and logdir
@@ -78,19 +50,13 @@
#
# ********************************************************************/
-/var/log/privoxy/logfile {
+/var/log/junkbuster/logfile {
compress
- size 1M
- postrotate
- /sbin/service privoxy reload 2> /dev/null || true
- endscript
+ weekly
}
-/var/log/privoxy/jarfile {
- missingok
- compress
- size 1M
- postrotate
- /sbin/service privoxy reload 2> /dev/null || true
- endscript
+/var/log/junkbuster/jarfile {
+ missingok
+ compress
+ weekly
}
diff --git a/privoxy.monthly b/junkbuster.monthly
similarity index 87%
rename from privoxy.monthly
rename to junkbuster.monthly
index 15734ddf..89dac657 100644
--- a/privoxy.monthly
+++ b/junkbuster.monthly
@@ -2,13 +2,13 @@
# ********************************************************************
#
-# File : $Source: /cvsroot/ijbswa/current/privoxy.monthly,v $
+# File : $Source: /cvsroot/ijbswa/current/gateway.h,v $
#
# Purpose : Downloads updated configuration (blocklists, ...)
# to the machine.
#
# Copyright : Written by and Copyright (C) 2001 the SourceForge
-# Privoxy team. http://www.privoxy.org/
+# IJBSWA team. http://ijbswa.sourceforge.net
#
# Based on the Internet Junkbuster originally written
# by and Copyright (C) 1997 Anonymous Coders and
@@ -33,16 +33,7 @@
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Revisions :
-# $Log: privoxy.monthly,v $
-# Revision 1.2 2002/03/24 11:40:14 swa
-# name change
-#
-# Revision 1.1 2002/03/24 11:23:44 swa
-# name change
-#
-# Revision 1.3 2001/05/24 07:41:33 swa
-# added header
-#
+# $Log: gateway.h,v $
#
#
# ********************************************************************/
diff --git a/privoxy.weekly b/junkbuster.weekly
similarity index 84%
rename from privoxy.weekly
rename to junkbuster.weekly
index 81424f8d..fdd5bf14 100644
--- a/privoxy.weekly
+++ b/junkbuster.weekly
@@ -2,13 +2,13 @@
# ********************************************************************
#
-# File : $Source: /cvsroot/ijbswa/current/privoxy.weekly,v $
+# File : $Source: /cvsroot/ijbswa/current/junkbuster.monthly,v $
#
# Purpose : Downloads updated configuration (blocklists, ...)
# to the machine.
#
# Copyright : Written by and Copyright (C) 2001 the SourceForge
-# Privoxy team. http://www.privoxy.org/
+# IJBSWA team. http://ijbswa.sourceforge.net
#
# Based on the Internet Junkbuster originally written
# by and Copyright (C) 1997 Anonymous Coders and
@@ -33,16 +33,7 @@
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Revisions :
-# $Log: privoxy.weekly,v $
-# Revision 1.2 2002/03/24 11:40:14 swa
-# name change
-#
-# Revision 1.1 2002/03/24 11:23:44 swa
-# name change
-#
-# Revision 1.2 2001/05/24 07:52:24 swa
-# added header. removed ^M.
-#
+# $Log: junkbuster.monthly,v $
# Revision 1.3 2001/05/24 07:41:33 swa
# added header
#
diff --git a/killpopup.c b/killpopup.c
index 34653738..f191b08e 100644
--- a/killpopup.c
+++ b/killpopup.c
@@ -1,4 +1,4 @@
-const char killpopup_rcs[] = "$Id: killpopup.c,v 1.15 2002/03/24 13:25:43 swa Exp $";
+const char killpopup_rcs[] = "$Id: killpopup.c,v 1.6 2001/07/19 19:11:35 haroon Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/killpopup.c,v $
@@ -6,13 +6,13 @@ const char killpopup_rcs[] = "$Id: killpopup.c,v 1.15 2002/03/24 13:25:43 swa Ex
* Purpose : Handles the filtering of popups.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
- * by and Copyright (C) 1997 Anonymous Coders and
+ * by and Copyright (C) 1997 Anonymous Coders and
* Junkbusters Corporation. http://www.junkbusters.com
*
- * This program is free software; you can redistribute it
+ * 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
@@ -32,44 +32,6 @@ const char killpopup_rcs[] = "$Id: killpopup.c,v 1.15 2002/03/24 13:25:43 swa Ex
*
* Revisions :
* $Log: killpopup.c,v $
- * Revision 1.15 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.14 2002/03/07 03:46:53 oes
- * Fixed compiler warnings etc
- *
- * Revision 1.13 2001/11/13 00:16:40 jongfoster
- * Replacing references to malloc.h with the standard stdlib.h
- * (See ANSI or K&R 2nd Ed)
- *
- * Revision 1.12 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.11 2001/10/07 15:42:41 oes
- * filter_popups now gets a csp pointer so it can raise the new
- * CSP_FLAG_MODIFIED flag.
- *
- * Revision 1.10 2001/09/22 16:34:44 jongfoster
- * Removing unneeded #includes
- *
- * Revision 1.9 2001/07/31 14:44:22 oes
- * Deleted unused size parameter from filter_popups()
- *
- * Revision 1.8 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.7 2001/07/20 19:29:25 haroon
- * - In v1.5 forgot to add that I implemented LOG_LEVEL_POPUPS in errlog.c,
- * errlog.h and killpopup.c. In that case, it is superfluous to have define for
- * POPUP_VERBOSE, so I removed the defines and logging is now done
- * via log_error(LOG_LEVEL_POPUPS, ....)
- *
* Revision 1.6 2001/07/19 19:11:35 haroon
* - Implemented Guy's idea of replacing window.open( with 1;''.concat(
* - Implemented Guy's idea of replacing .resizeTo( with .scrollTo(
@@ -109,102 +71,99 @@ const char killpopup_rcs[] = "$Id: killpopup.c,v 1.15 2002/03/24 13:25:43 swa Ex
#include
#include
#include
+#include
#include
#include
#include
-#if !defined(_WIN32) && !defined(__OS2__)
+#ifndef _WIN32
#include
#endif
#include "project.h"
#include "killpopup.h"
+#include "jcc.h"
#include "errlog.h"
const char killpopup_h_rcs[] = KILLPOPUP_H_VERSION;
-#ifdef FEATURE_KILL_POPUPS
+#ifdef KILLPOPUPS
/*********************************************************************
*
* Function : filter_popups
*
- * Description : Filter the block of data that's been read from the server
- * for javascript popup code and replace by syntactically
- * neutral code of the same size.
- * Raise the CSP_FLAG_MODIFIED flag on success.
+ * Description : Filter the block of data that's been read from the server.
+ * Caller is responsible for checking permissons list
+ * to determine if this function should be called.
+ * Remember not to change the content length (substitute char by char)
*
* Parameters :
* 1 : buff = Buffer to scan and modify. Null terminated.
- * 2 : csp = Client state pointer
+ * 2 : size = Buffer size, excluding null terminator.
*
* Returns : void
*
*********************************************************************/
-void filter_popups(char *buff, struct client_state *csp)
+void filter_popups(char *buff, int size)
{
- char *start_p = NULL;
- char *close_p = NULL;
+ char *popup = NULL;
+ char *close = NULL;
char *p = NULL;
- /*
- * replace the window.open( with a harmless JavaScript replacement
- * (notice the two single quotes)
- */
- while ((start_p = strstr(buff, "window.open(")) != NULL)
+ while ((popup = strstr( buff, "window.open(" )) != NULL)
{
- if (start_p)
+ if ( popup )
{
- strncpy(start_p, "1;''.concat(", 12);
+ /*
+ * replace the window.open( with a harmless JavaScript replacement (notice the two single quotes)
+ * Guy's idea (thanks)
+ */
+ strncpy(popup, "1;''.concat(", 12);
log_error(LOG_LEVEL_POPUPS, "Blocked popup window open");
- csp->flags |= CSP_FLAG_MODIFIED;
}
}
-
- /*
- * replace the .resizeTo( with a harmless JavaScript replacement
- */
- while ((start_p = strstr(buff, ".resizeTo(")) != NULL)
+
+ while ((popup = strstr( buff, ".resizeTo(" )) != NULL)
{
- if (start_p)
+ if ( popup )
{
- strncpy(start_p, ".scrollTo(", 10);
+ /*
+ * replace the .resizeTo( with a harmless JavaScript replacement
+ * Guy's idea (thanks)
+ */
+ strncpy(popup, ".scrollTo(", 10);
log_error(LOG_LEVEL_POPUPS, "Blocked popup window resize");
- csp->flags |= CSP_FLAG_MODIFIED;
}
}
- /*
- * Filter onUnload and onExit
- */
- start_p = strstr(buff, "');
- if (close_p)
+ close=strchr(popup,'>');
+ if (close)
{
- /* we are now between */
- p = strstr(start_p, "onUnload");
+ /* we are now between FIXME: No, we're anywhere! --oes*/
+ p=strstr(popup, "onUnload");
if (p)
{
- strncpy(p, "_nU_", 4);
- csp->flags |= CSP_FLAG_MODIFIED;
+ strncpy(p,"_nU_",4);
}
- p = strstr(start_p, "onExit");
+ p=strstr(popup, "onExit");
if (p)
{
- strncpy(p, "_nE_", 4);
- csp->flags |= CSP_FLAG_MODIFIED;
+ strncpy(p,"_nE_",4);
}
}
}
}
-#endif /* def FEATURE_KILL_POPUPS */
+#endif /* def KILLPOPUPS */
/*
Local Variables:
diff --git a/killpopup.h b/killpopup.h
index 7d2eadf6..23bd7d7b 100644
--- a/killpopup.h
+++ b/killpopup.h
@@ -1,6 +1,6 @@
-#ifndef KILLPOPUP_H_INCLUDED
-#define KILLPOPUP_H_INCLUDED
-#define KILLPOPUP_H_VERSION "$Id: killpopup.h,v 1.7 2002/03/24 13:25:43 swa Exp $"
+#ifndef _KILLPOPUP_H
+#define _KILLPOPUP_H
+#define KILLPOPUP_H_VERSION "$Id: killpopup.h,v 1.1.1.1 2001/05/15 13:58:58 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/killpopup.h,v $
@@ -8,7 +8,7 @@
* Purpose : Handles the filtering of popups.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -34,39 +34,6 @@
*
* Revisions :
* $Log: killpopup.h,v $
- * Revision 1.7 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.6 2001/10/07 15:42:41 oes
- * filter_popups now gets a csp pointer so it can raise the new
- * CSP_FLAG_MODIFIED flag.
- *
- * Revision 1.5 2001/07/31 14:44:22 oes
- * Deleted unused size parameter from filter_popups()
- *
- * Revision 1.4 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.3 2001/07/29 18:59:21 jongfoster
- * - Changing #define _KILLPOPUP_H to KILLPOPUP_H_INCLUDED
- * - Adding extern "C" {}
- *
- * 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:58 oes
* Initial import of version 2.9.3 source tree
*
@@ -76,25 +43,17 @@
#include "project.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifdef KILLPOPUPS
-#ifdef FEATURE_KILL_POPUPS
+extern void filter_popups(char *buff, int size);
-extern void filter_popups(char *buff, struct client_state *csp);
-
-#endif /* def FEATURE_KILL_POPUPS */
+#endif /* def KILLPOPUPS */
/* Revision control strings from this header and associated .c file */
extern const char killpopup_rcs[];
extern const char killpopup_h_rcs[];
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* ndef KILLPOPUP_H_INCLUDED */
+#endif /* ndef _KILLPOPUP_H */
/*
Local Variables:
diff --git a/list.c b/list.c
index 6cd7f891..18e5da7e 100644
--- a/list.c
+++ b/list.c
@@ -1,4 +1,4 @@
-const char list_rcs[] = "$Id: list.c,v 1.14 2002/03/24 13:25:43 swa Exp $";
+const char list_rcs[] = "$Id: list.c,v 1.4 2001/06/29 13:30:22 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/list.c,v $
@@ -8,13 +8,13 @@ const char list_rcs[] = "$Id: list.c,v 1.14 2002/03/24 13:25:43 swa Exp $";
* `destroy_list', `enlist' and `list_to_text'
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
- * by and Copyright (C) 1997 Anonymous Coders and
+ * by and Copyright (C) 1997 Anonymous Coders and
* Junkbusters Corporation. http://www.junkbusters.com
*
- * This program is free software; you can redistribute it
+ * 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
@@ -34,47 +34,6 @@ const char list_rcs[] = "$Id: list.c,v 1.14 2002/03/24 13:25:43 swa Exp $";
*
* Revisions :
* $Log: list.c,v $
- * Revision 1.14 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.13 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.12 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.11 2001/10/23 21:21:03 jongfoster
- * New error handling - error codes are now jb_errs, not ints.
- * Changed the way map() handles out-of-memory, to dramatically
- * reduce the amount of error-checking clutter needed.
- *
- * Revision 1.10 2001/09/16 17:30:24 jongfoster
- * Fixing a compiler warning.
- *
- * Revision 1.9 2001/09/16 13:20:29 jongfoster
- * Rewrite of list library. Now has seperate header and list_entry
- * structures. Also added a large sprinking of assert()s to the list
- * code.
- *
- * Revision 1.8 2001/08/07 14:00:20 oes
- * Fixed comment
- *
- * Revision 1.7 2001/08/05 16:06:20 jongfoster
- * Modifiying "struct map" so that there are now separate header and
- * "map_entry" structures. This means that functions which modify a
- * map no longer need to return a pointer to the modified map.
- * Also, it no longer reverses the order of the entries (which may be
- * important with some advanced template substitutions).
- *
- * Revision 1.6 2001/07/31 14:44:51 oes
- * list_to_text() now appends empty line at end
- *
- * Revision 1.5 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
* Revision 1.4 2001/06/29 13:30:22 oes
* - Added Convenience function enlist_unique_header(),
* which takes the Header name and value as separate
@@ -111,174 +70,23 @@ const char list_rcs[] = "$Id: list.c,v 1.14 2002/03/24 13:25:43 swa Exp $";
#include "config.h"
-#ifndef _WIN32
-/* FIXME: The following headers are not needed for Win32. Are they
- * needed on other platforms?
- */
#include
#include
#include
#include
-#endif
#include
-#if !defined(_WIN32) && !defined(__OS2__)
+#ifndef _WIN32
#include
#endif
-#include
-
#include "project.h"
+#include "jcc.h"
#include "list.h"
#include "miscutil.h"
const char list_h_rcs[] = LIST_H_VERSION;
-
-static int list_is_valid (const struct list *the_list);
-
-
-/*********************************************************************
- *
- * Function : list_init
- *
- * Description : Create a new, empty list in user-allocated memory.
- * Caller should allocate a "struct list" variable,
- * then pass it to this function.
- * (Implementation note: Rather than calling this
- * function, you can also just memset the memory to
- * zero, e.g. if you have a larger structure you
- * want to initialize quickly. However, that isn't
- * really good design.)
- *
- * Parameters :
- * 1 : the_list = pointer to list
- *
- * Returns : N/A
- *
- *********************************************************************/
-void init_list(struct list *the_list)
-{
- memset(the_list, '\0', sizeof(*the_list));
-}
-
-
-/*********************************************************************
- *
- * Function : destroy_list
- *
- * Description : Destroy a string list (opposite of list_init).
- * On return, the memory used by the list entries has
- * been freed, but not the memory used by the_list
- * itself. You should not re-use the_list without
- * calling list_init().
- *
- * (Implementation note: You *can* reuse the_list
- * without calling list_init(), but please don't.
- * If you want to remove all entries from a list
- * and still have a usable list, then use
- * list_remove_all().)
- *
- * Parameters :
- * 1 : the_list = pointer to list
- *
- * Returns : N/A
- *
- *********************************************************************/
-void destroy_list (struct list *the_list)
-{
- struct list_entry *cur_entry, *next_entry;
-
- assert(the_list);
-
- for (cur_entry = the_list->first; cur_entry ; cur_entry = next_entry)
- {
- next_entry = cur_entry->next;
- freez(cur_entry->str);
- free(cur_entry);
- }
-
- the_list->first = NULL;
- the_list->last = NULL;
-}
-
-
-/*********************************************************************
- *
- * Function : list_is_valid
- *
- * Description : Check that a string list is valid. The intended
- * usage is "assert(list_is_valid(the_list))".
- * Currently this checks that "the_list->last"
- * is correct, and that the list dosn't contain
- * circular references. It is likely to crash if
- * it's passed complete garbage.
- *
- * Parameters :
- * 1 : the_list = pointer to list. Must be non-null.
- *
- * Returns : 1 if list is valid, 0 otherwise.
- *
- *********************************************************************/
-static int list_is_valid (const struct list *the_list)
-{
- /*
- * If you don't want this check, just change the line below
- * from "#if 1" to "#if 0".
- */
-#if 1
- const struct list_entry *cur_entry;
- const struct list_entry *last_entry = NULL;
- int length = 0;
-
- assert(the_list);
-
- for (cur_entry = the_list->first; cur_entry ; cur_entry = cur_entry->next)
- {
- last_entry = cur_entry;
-
- if (cur_entry->str)
- {
- /*
- * Just check that this string can be accessed - i.e. it's a valid
- * pointer.
- */
- strlen(cur_entry->str);
- }
-
- /*
- * Check for looping back to first
- */
- if ((length != 0) && (cur_entry == the_list->first))
- {
- return 0;
- }
-
- /*
- * Arbitrarily limit length to prevent infinite loops.
- */
- if (++length > 1000)
- {
- return 0;
- }
-
- /*
- * Check this isn't marked as the last entry, unless of course it's
- * *really* the last entry.
- */
- if ((the_list->last == cur_entry) && (cur_entry->next != NULL))
- {
- /* This is the last entry, but there's data after it !!?? */
- return 0;
- }
- }
-
- return (the_list->last == last_entry);
-#else
- return 1;
-#endif
-}
-
/*********************************************************************
*
* Function : enlist
@@ -286,51 +94,32 @@ static int list_is_valid (const struct list *the_list)
* Description : Append a string into a specified string list.
*
* Parameters :
- * 1 : the_list = pointer to list
+ * 1 : header = pointer to list 'dummy' header
* 2 : str = string to add to the list (maybe NULL)
*
- * Returns : JB_ERR_OK on success
- * JB_ERR_MEMORY on out-of-memory error.
- * On error, the_list will be unchanged.
+ * Returns : N/A
*
*********************************************************************/
-jb_err enlist(struct list *the_list, const char *str)
+void enlist(struct list *header, const char *str)
{
- struct list_entry *cur;
-
- assert(the_list);
- assert(list_is_valid(the_list));
+ struct list *cur = (struct list *)malloc(sizeof(*cur));
+ struct list *last;
- if (NULL == (cur = (struct list_entry *)zalloc(sizeof(*cur))))
+ if (cur)
{
- return JB_ERR_MEMORY;
- }
+ cur->str = (str ? strdup(str) : NULL);
+ cur->next = NULL;
- if (str)
- {
- if (NULL == (cur->str = strdup(str)))
+ last = header->last;
+ if (last == NULL)
{
- free(cur);
- return JB_ERR_MEMORY;
+ last = header;
}
- }
- /* else { cur->str = NULL; } - implied by zalloc */
-
- /* cur->next = NULL; - implied by zalloc */
- if (the_list->last)
- {
- the_list->last->next = cur;
- the_list->last = cur;
- }
- else
- {
- the_list->first = cur;
- the_list->last = cur;
+ last->next = cur;
+ header->last = cur;
}
- assert(list_is_valid(the_list));
- return JB_ERR_OK;
}
@@ -342,46 +131,28 @@ jb_err enlist(struct list *the_list, const char *str)
* string list.
*
* Parameters :
- * 1 : the_list = pointer to list
+ * 1 : header = pointer to list 'dummy' header
* 2 : str = string to add to the list (maybe NULL)
*
- * Returns : JB_ERR_OK on success
- * JB_ERR_MEMORY on out-of-memory error.
- * On error, the_list will be unchanged.
+ * Returns : N/A
*
*********************************************************************/
-jb_err enlist_first(struct list *the_list, const char *str)
+void enlist_first(struct list *header, const char *str)
{
- struct list_entry *cur;
-
- assert(the_list);
- assert(list_is_valid(the_list));
+ struct list *cur = (struct list *)malloc(sizeof(*cur));
- if (NULL == (cur = (struct list_entry *)zalloc(sizeof(*cur))))
+ if (cur)
{
- return JB_ERR_MEMORY;
- }
+ cur->str = (str ? strdup(str) : NULL);
+ cur->next = header->next;
- if (str)
- {
- if (NULL == (cur->str = strdup(str)))
+ header->next = cur;
+ if (header->last == NULL)
{
- free(cur);
- return JB_ERR_MEMORY;
+ header->last = cur;
}
}
- /* else { cur->str = NULL; } - implied by zalloc */
-
- cur->next = the_list->first;
- the_list->first = cur;
- if (the_list->last == NULL)
- {
- the_list->last = cur;
- }
-
- assert(list_is_valid(the_list));
- return JB_ERR_OK;
}
@@ -391,59 +162,49 @@ jb_err enlist_first(struct list *the_list, const char *str)
*
* Description : Append a string into a specified string list,
* if & only if it's not there already.
- * If the num_significant_chars argument is nonzero,
- * only compare up to the nth character.
+ * If the n argument is nonzero, only compare up to
+ * the nth character.
*
* Parameters :
- * 1 : the_list = pointer to list
- * 2 : str = string to add to the list
- * 3 : num_significant_chars = number of chars to use
- * for uniqueness test, or 0 to require an exact match.
+ * 1 : header = pointer to list 'dummy' header
+ * 2 : str = string to add to the list (maybe NULL)
+ * 3 : n = number of chars to use for uniqueness test
*
- * Returns : JB_ERR_OK on success
- * JB_ERR_MEMORY on out-of-memory error.
- * On error, the_list will be unchanged.
- * "Success" does not indicate whether or not the
- * item was already in the list.
+ * Returns : N/A
*
*********************************************************************/
-jb_err enlist_unique(struct list *the_list, const char *str,
- size_t num_significant_chars)
+void enlist_unique(struct list *header, const char *str, int n)
{
- struct list_entry *cur_entry;
-
- assert(the_list);
- assert(list_is_valid(the_list));
- assert(str);
- assert(num_significant_chars >= 0);
- assert(num_significant_chars <= strlen(str));
+ struct list *last;
+ struct list *cur = header->next;
- if (num_significant_chars > 0)
+ while (cur != NULL)
{
- for (cur_entry = the_list->first; cur_entry != NULL; cur_entry = cur_entry->next)
+ if ((cur->str != NULL) && (
+ (n && (0 == strncmp(str, cur->str, n))) ||
+ (!n && (0 == strcmp(str, cur->str)))))
{
- if ( (cur_entry->str != NULL)
- && (0 == strncmp(str, cur_entry->str, num_significant_chars)))
- {
- /* Already there */
- return JB_ERR_OK;
- }
+ /* Already there */
+ return;
}
+ cur = cur->next;
}
- else
+
+ cur = (struct list *)malloc(sizeof(*cur));
+
+ if (cur != NULL)
{
- /* Test whole string */
- for (cur_entry = the_list->first; cur_entry != NULL; cur_entry = cur_entry->next)
+ cur->str = (str ? strdup(str) : NULL); /* FIXME check retval */
+ cur->next = NULL;
+
+ last = header->last;
+ if (last == NULL)
{
- if ( (cur_entry->str != NULL) && (0 == strcmp(str, cur_entry->str)))
- {
- /* Already there */
- return JB_ERR_OK;
- }
+ last = header;
}
+ last->next = cur;
+ header->last = cur;
}
-
- return enlist(the_list, str);
}
@@ -456,84 +217,80 @@ jb_err enlist_unique(struct list *the_list, const char *str,
* if & only if there isn't already a header with that name.
*
* Parameters :
- * 1 : the_list = pointer to list
- * 2 : name = HTTP header name (e.g. "Content-type")
- * 3 : value = HTTP header value (e.g. "text/html")
+ * 1 : header = pointer to list 'dummy' header
+ * 2 : first = first string to add to the list (maybe NULL)
+ * 3 : second = number of chars to use for uniqueness test
*
- * Returns : JB_ERR_OK on success
- * JB_ERR_MEMORY on out-of-memory error.
- * On error, the_list will be unchanged.
- * "Success" does not indicate whether or not the
- * header was already in the list.
+ * Returns : N/A
*
*********************************************************************/
-jb_err enlist_unique_header(struct list *the_list, const char *name,
- const char *value)
+void enlist_unique_header(struct list *header, const char *name, const char *value)
{
- size_t length;
- jb_err result;
- char *str;
+ struct list *last;
+ struct list *cur = header->next;
+ int length;
+ char *dummy;
+
+ if (name == NULL || value == NULL) return;
- assert(the_list);
- assert(list_is_valid(the_list));
- assert(name);
- assert(value);
+ dummy = strdup(name);
+ dummy = strsav(dummy, ": ");
+ length = strlen(dummy);
- length = strlen(name) + 2;
- if (NULL == (str = (char *)malloc(length + strlen(value) + 1)))
+ while (cur != NULL)
{
- return JB_ERR_MEMORY;
+ if ((cur->str != NULL) &&
+ (0 == strncmp(dummy, cur->str, length)))
+ {
+ /* Already there */
+ return;
+ }
+ cur = cur->next;
}
- strcpy(str, name);
- str[length - 2] = ':';
- str[length - 1] = ' ';
- strcpy(str + length, value);
- result = enlist_unique(the_list, str, length);
+ cur = (struct list *)malloc(sizeof(*cur));
- free(str);
-
- assert(list_is_valid(the_list));
-
- return result;
+ if (cur != NULL)
+ {
+ cur->str = strsav(dummy, value);
+ cur->next = NULL;
+ last = header->last;
+ if (last == NULL)
+ {
+ last = header;
+ }
+ last->next = cur;
+ header->last = cur;
+ }
}
/*********************************************************************
*
- * Function : list_remove_all
+ * Function : destroy_list
*
- * Description : Remove all entries from a list. On return, the_list
- * is a valid, empty list. Note that this is similar
- * to destroy_list(), but the difference is that this
- * function guarantees that the list structure is still
- * valid after the call.
+ * Description : Destroy a string list (opposite of enlist)
*
* Parameters :
- * 1 : the_list = pointer to list
+ * 1 : header = pointer to list 'dummy' header
*
* Returns : N/A
*
*********************************************************************/
-void list_remove_all(struct list *the_list)
+void destroy_list(struct list *header)
{
- struct list_entry *cur_entry;
- struct list_entry *next_entry;
+ struct list *p, *n;
- assert(the_list);
- assert(list_is_valid(the_list));
-
- for (cur_entry = the_list->first; cur_entry ; cur_entry = next_entry)
+ for (p = header->next; p ; p = n)
{
- next_entry = cur_entry->next;
- freez(cur_entry->str);
- free(cur_entry);
+ n = p->next;
+ freez(p->str);
+ free(p);
}
- the_list->first = the_list->last = NULL;
+ memset(header, '\0', sizeof(*header));
- assert(list_is_valid(the_list));
}
@@ -541,56 +298,52 @@ void list_remove_all(struct list *the_list)
*
* Function : list_to_text
*
- * Description : "Flatten" a string list into 1 long \r\n delimited string,
- * adding an empty line at the end. NULL entries are ignored.
- * This function does not change the_list.
+ * Description : "Flaten" a string list into 1 long \r\n delimited string.
*
* Parameters :
- * 1 : the_list = pointer to list
+ * 1 : h = pointer to list 'dummy' header
*
* Returns : NULL on malloc error, else new long string.
- * Caller must free() it.
*
*********************************************************************/
-char *list_to_text(const struct list *the_list)
+char *list_to_text(struct list *h)
{
- struct list_entry *cur_entry;
+ struct list *p;
char *ret = NULL;
char *s;
- size_t size = 2;
+ int size;
- assert(the_list);
- assert(list_is_valid(the_list));
+ size = 0;
- for (cur_entry = the_list->first; cur_entry ; cur_entry = cur_entry->next)
+ for (p = h->next; p ; p = p->next)
{
- if (cur_entry->str)
+ if (p->str)
{
- size += strlen(cur_entry->str) + 2;
+ size += strlen(p->str) + 2;
}
}
if ((ret = (char *)malloc(size + 1)) == NULL)
{
- return NULL;
+ return(NULL);
}
ret[size] = '\0';
s = ret;
- for (cur_entry = the_list->first; cur_entry ; cur_entry = cur_entry->next)
+ for (p = h->next; p ; p = p->next)
{
- if (cur_entry->str)
+ if (p->str)
{
- strcpy(s, cur_entry->str);
+ strcpy(s, p->str);
s += strlen(s);
*s++ = '\r'; *s++ = '\n';
}
}
- *s++ = '\r'; *s++ = '\n';
- return ret;
+ return(ret);
+
}
@@ -601,54 +354,36 @@ char *list_to_text(const struct list *the_list)
* Description : Remove a string from a specified string list.
*
* Parameters :
- * 1 : the_list = pointer to list
- * 2 : str = string to remove from the list - non-NULL
+ * 1 : header = pointer to list 'dummy' header
+ * 2 : str = string to remove from the list
*
* Returns : Number of times it was removed.
*
*********************************************************************/
-int list_remove_item(struct list *the_list, const char *str)
+int list_remove_item(struct list *header, const char *str)
{
- struct list_entry *prev = NULL;
- struct list_entry *cur;
- struct list_entry *next;
+ struct list *prev = header;
+ struct list *cur = prev->next;
int count = 0;
- assert(the_list);
- assert(list_is_valid(the_list));
- assert(str);
-
- cur = the_list->first;
-
while (cur != NULL)
{
- next = cur->next;
-
if ((cur->str != NULL) && (0 == strcmp(str, cur->str)))
{
count++;
- if (prev != NULL)
- {
- prev->next = next;
- }
- else
- {
- the_list->first = next;
- }
- free((char *)cur->str);
+ prev->next = cur->next;
+ free(cur->str);
free(cur);
}
else
{
prev = cur;
}
- cur = next;
+ cur = prev->next;
}
- the_list->last = prev;
-
- assert(list_is_valid(the_list));
+ header->last = prev;
return count;
}
@@ -671,25 +406,18 @@ int list_remove_item(struct list *the_list, const char *str)
*********************************************************************/
int list_remove_list(struct list *dest, const struct list *src)
{
- struct list_entry *cur;
+ struct list *cur = src->next;
int count = 0;
- assert(src);
- assert(dest);
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
-
- for (cur = src->first; cur != NULL; cur = cur->next)
+ while (cur != NULL)
{
if (cur->str != NULL)
{
count += list_remove_item(dest, cur->str);
}
+ cur = cur->next;
}
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
-
return count;
}
@@ -698,96 +426,35 @@ int list_remove_list(struct list *dest, const struct list *src)
*
* Function : list_duplicate
*
- * Description : Copy a string list
+ * Description : Duplicate a string list
*
* Parameters :
- * 1 : dest = Destination list. Must be a valid list.
- * All existing entries will be removed.
- * 1 : src = pointer to source list for copy.
+ * 1 : dest = pointer to destination for copy. Caller allocs.
+ * 2 : src = pointer to source for copy.
*
- * Returns : JB_ERR_OK on success
- * JB_ERR_MEMORY on out-of-memory error.
- * On error, dest will be empty.
+ * Returns : N/A
*
*********************************************************************/
-jb_err list_duplicate(struct list *dest, const struct list *src)
+void list_duplicate(struct list *dest, const struct list *src)
{
- struct list_entry * cur_src;
- struct list_entry * cur_dest;
+ struct list * cur_src = src->next;
+ struct list * cur_dest = dest;
- assert(src);
- assert(dest);
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
+ memset(dest, '\0', sizeof(*dest));
- list_remove_all(dest);
-
- /* Need to process first entry specially so we can set dest->first */
- cur_src = src->first;
- if (cur_src)
+ while (cur_src)
{
- cur_dest = dest->first = (struct list_entry *)zalloc(sizeof(*cur_dest));
+ cur_dest = cur_dest->next = (struct list *)zalloc(sizeof(*cur_dest));
if (cur_dest == NULL)
{
- destroy_list(dest);
-
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
-
- return JB_ERR_MEMORY;
+ return;
}
-
- if (cur_src->str)
- {
- cur_dest->str = strdup(cur_src->str);
- if (cur_dest->str == NULL)
- {
- destroy_list(dest);
-
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
-
- return JB_ERR_MEMORY;
- }
- }
- /* else { cur_dest->str = NULL; } - implied by zalloc */
-
- /* Now process the rest */
- for (cur_src = cur_src->next; cur_src; cur_src = cur_src->next)
- {
- cur_dest = cur_dest->next = (struct list_entry *)zalloc(sizeof(*cur_dest));
- if (cur_dest == NULL)
- {
- destroy_list(dest);
-
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
-
- return JB_ERR_MEMORY;
- }
- if (cur_src->str)
- {
- cur_dest->str = strdup(cur_src->str);
- if (cur_dest->str == NULL)
- {
- destroy_list(dest);
-
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
-
- return JB_ERR_MEMORY;
- }
- }
- /* else { cur_dest->str = NULL; } - implied by zalloc */
- }
-
- dest->last = cur_dest;
+ cur_dest->str = strdup(cur_src->str);
+ cur_src = cur_src->next;
}
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
+ dest->last = cur_dest;
- return JB_ERR_OK;
}
@@ -799,261 +466,120 @@ jb_err list_duplicate(struct list *dest, const struct list *src)
* Duplicate items are not added.
*
* Parameters :
- * 1 : dest = pointer to destination list for merge.
+ * 1 : dest = pointer to destination for merge. Caller allocs.
* 2 : src = pointer to source for merge.
*
- * Returns : JB_ERR_OK on success
- * JB_ERR_MEMORY on out-of-memory error.
- * On error, some (but not all) of src might have
- * been copied into dest.
+ * Returns : N/A
*
*********************************************************************/
-jb_err list_append_list_unique(struct list *dest, const struct list *src)
+void list_append_list_unique(struct list *dest, const struct list *src)
{
- struct list_entry * cur;
-
- assert(src);
- assert(dest);
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
+ struct list * cur = src->next;
- for (cur = src->first; cur; cur = cur->next)
+ while (cur)
{
- if (cur->str)
- {
- if (enlist_unique(dest, cur->str, 0))
- {
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
-
- return JB_ERR_MEMORY;
- }
- }
+ enlist_unique(dest, cur->str, 0);
+ cur = cur->next;
}
-
- assert(list_is_valid(src));
- assert(list_is_valid(dest));
-
- return JB_ERR_OK;
}
/*********************************************************************
*
- * Function : list_is_empty
- *
- * Description : Test whether a list is empty. Does not change the list.
- *
- * Parameters :
- * 1 : the_list = pointer to list to test.
- *
- * Returns : Nonzero iff the list contains no entries.
- *
- *********************************************************************/
-int list_is_empty(const struct list *the_list)
-{
- assert(the_list);
- assert(list_is_valid(the_list));
-
- return (the_list->first == NULL);
-}
-
-
-/*********************************************************************
- *
- * Function : new_map
- *
- * Description : Create a new, empty map.
- *
- * Parameters : N/A
- *
- * Returns : A new, empty map, or NULL if out of memory.
- *
- *********************************************************************/
-struct map *new_map(void)
-{
- return (struct map *) zalloc(sizeof(struct map));
-}
-
-
-/*********************************************************************
+ * Function : map
*
- * Function : free_map
+ * Description : Add a mapping from given name to given value to a
+ * given map.
*
- * Description : Free the memory occupied by a map and its
- * depandant strings
+ * Note: Since all strings will be free()d in free_map()
+ * later, use the copy flags for constants or
+ * strings that will be independantly free()d.
*
* Parameters :
- * 1 : the_map = map to be freed. May be NULL.
+ * 1 : map = map to add to
+ * 2 : name = name to add
+ * 3 : nc = flag set if a copy of name should be used
+ * 4 : value = value to add
+ * 5 : vc = flag set if a copy of value should be used
*
- * Returns : N/A
+ * Returns : pointer to extended map, or NULL if failiure
*
*********************************************************************/
-void free_map(struct map *the_map)
+struct map *map(struct map *map, char *name, int nc, char *value, int vc)
{
- struct map_entry *cur_entry;
- struct map_entry *next_entry;
+ struct map *cur;
- if (the_map == NULL)
+ if (NULL == (cur = zalloc(sizeof(*cur))))
{
- return;
+ return(NULL);
}
- for (cur_entry = the_map->first; cur_entry != NULL; cur_entry = next_entry)
- {
- freez(cur_entry->name);
- freez(cur_entry->value);
-
- next_entry = cur_entry->next;
- free(cur_entry);
- }
+ cur->name = nc ? strdup(name) : name;
+ cur->value = vc ? strdup(value) : value;
+ cur->next = map;
- the_map->first = the_map->last = NULL;
+ return(cur);
- free(the_map);
}
/*********************************************************************
*
- * Function : map
- *
- * Description : Add a mapping from given name to given value to a
- * given map.
- *
- * Note: Since all strings will be free()d in free_map()
- * later, set the copy flags for constants or
- * strings that will be independantly free()d.
- *
- * Note2: This function allows NULL parameters - it
- * returns JB_ERR_MEMORY in that case.
- *
- * Note3: If this function returns JB_ERR_MEMORY,
- * it will free(name) unless you specify
- * name_needs_copying, and similarly it will
- * free(value) unless you specify
- * value_needs_copying.
- *
- * Due to Note2 and Note3 above, the following code
- * is legal, and will never crash or leak memory even
- * if the system runs out of memory:
- *
- * err = map(mymap, "xyz", 1, html_encode(somestring), 0);
+ * Function : lookup
*
- * err will be set to JB_ERR_MEMORY if either call runs
- * out-of-memory. Without these features, you would
- * need to check the return value of html_encode in the
- * above example for NULL, which (at least) doubles the
- * amount of error-checking code needed.
+ * Description : Look up an item with a given name in a map, and
+ * return its value
*
* Parameters :
- * 1 : the_map = map to add to
- * 2 : name = name to add
- * 3 : name_needs_copying = flag set if a copy of name should be used
- * 4 : value = value to add
- * 5 : value_needs_copying = flag set if a copy of value should be used
+ * 1 : name = name parameter to look for
*
- * Returns : JB_ERR_OK on success
- * JB_ERR_MEMORY on out-of-memory error.
+ * Returns : the value if found, else the empty string
*
*********************************************************************/
-jb_err map(struct map *the_map,
- const char *name, int name_needs_copying,
- const char *value, int value_needs_copying)
+char *lookup(struct map *map, char *name)
{
- struct map_entry *new_entry;
+ struct map *p = map;
- assert(the_map);
-
- if ( (NULL == value)
- || (NULL == name)
- || (NULL == (new_entry = zalloc(sizeof(*new_entry)))) )
+ while (p)
{
- if ((name != NULL) && (!name_needs_copying))
+ if (!strcmp(name, p->name))
{
- free((char *)name);
+ return p->value;
}
- if ((value != NULL) && (!value_needs_copying))
- {
- free((char *)value);
- }
- return JB_ERR_MEMORY;
- }
-
- if (name_needs_copying)
- {
- if (NULL == (name = strdup(name)))
- {
- free(new_entry);
- if (!value_needs_copying)
- {
- free((char *)value);
- }
- return JB_ERR_MEMORY;
- }
- }
-
- if (value_needs_copying)
- {
- if (NULL == (value = strdup(value)))
- {
- free((char *)name);
- free(new_entry);
- return JB_ERR_MEMORY;
- }
- }
-
- new_entry->name = name;
- new_entry->value = value;
- /* new_entry->next = NULL; - implied by zalloc */
-
- if (the_map->last)
- {
- the_map->last->next = new_entry;
- the_map->last = new_entry;
- }
- else
- {
- the_map->first = new_entry;
- the_map->last = new_entry;
+ p = p->next;
}
+ return "";
- return JB_ERR_OK;
}
/*********************************************************************
*
- * Function : lookup
+ * Function : free_map
*
- * Description : Look up an item with a given name in a map, and
- * return its value
+ * Description : Free the memory occupied by a map and its
+ * depandant strings
*
* Parameters :
- * 1 : the_map = map to look in
- * 2 : name = name parameter to look for
+ * 1 : list = list to bee freed
*
- * Returns : the value if found, else the empty string.
- * Return value is alloced as part of the map, so
- * it is freed when the map is destroyed. Caller
- * must not free or modify it.
+ * Returns : N/A
*
*********************************************************************/
-const char *lookup(const struct map *the_map, const char *name)
+void free_map(struct map *map)
{
- const struct map_entry *cur_entry;
-
- assert(the_map);
- assert(name);
+ struct map *p = map;
- for (cur_entry = the_map->first; cur_entry != NULL; cur_entry = cur_entry->next)
+ while (p)
{
- if (!strcmp(name, cur_entry->name))
- {
- return cur_entry->value;
- }
+ free(p->name);
+ free(p->value);
+
+ map = p->next;
+ free(p);
+ p = map;
}
- return "";
+
}
diff --git a/list.h b/list.h
index afa44238..bbaa5aa1 100644
--- a/list.h
+++ b/list.h
@@ -1,6 +1,6 @@
-#ifndef LIST_H_INCLUDED
-#define LIST_H_INCLUDED
-#define LIST_H_VERSION "$Id: list.h,v 1.11 2002/03/24 13:25:43 swa Exp $"
+#ifndef _LIST_H
+#define _LIST_H
+#define LIST_H_VERSION "$Id: list.h,v 1.3 2001/06/03 11:03:48 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/list.h,v $
@@ -10,7 +10,7 @@
* `destroy_list', `enlist' and `list_to_text'
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
* by and Copyright (C) 1997 Anonymous Coders and
@@ -36,40 +36,6 @@
*
* Revisions :
* $Log: list.h,v $
- * Revision 1.11 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.10 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.9 2001/10/23 21:21:03 jongfoster
- * New error handling - error codes are now jb_errs, not ints.
- * Changed the way map() handles out-of-memory, to dramatically
- * reduce the amount of error-checking clutter needed.
- *
- * Revision 1.8 2001/09/16 17:30:24 jongfoster
- * Fixing a compiler warning.
- *
- * Revision 1.7 2001/09/16 13:20:29 jongfoster
- * Rewrite of list library. Now has seperate header and list_entry
- * structures. Also added a large sprinking of assert()s to the list
- * code.
- *
- * Revision 1.6 2001/08/05 16:06:20 jongfoster
- * Modifiying "struct map" so that there are now separate header and
- * "map_entry" structures. This means that functions which modify a
- * map no longer need to return a pointer to the modified map.
- * Also, it no longer reverses the order of the entries (which may be
- * important with some advanced template substitutions).
- *
- * Revision 1.5 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.4 2001/06/29 13:30:37 oes
- * - Introduced enlist_unique_header()
- * - Removed logentry from cancelled commit
- *
* Revision 1.3 2001/06/03 11:03:48 oes
* introduced functions for new list type "map": map(), lookup(),
* free_map(), and extended enlist_unique
@@ -104,48 +70,25 @@ extern "C" {
#endif
-/*
- * struct list
- *
- * A linked list class.
- */
-
-extern void init_list (struct list *the_list);
-extern void destroy_list (struct list *the_list);
-
-extern jb_err enlist (struct list *the_list, const char *str);
-extern jb_err enlist_unique (struct list *the_list, const char *str, size_t num_significant_chars);
-extern jb_err enlist_unique_header (struct list *the_list, const char *name, const char *value);
-extern jb_err enlist_first (struct list *the_list, const char *str);
-extern jb_err list_append_list_unique(struct list *dest, const struct list *src);
-extern jb_err list_duplicate (struct list *dest, const struct list *src);
-
-extern int list_remove_item(struct list *the_list, const char *str);
-extern int list_remove_list(struct list *dest, const struct list *src);
-extern void list_remove_all (struct list *the_list);
-
-extern int list_is_empty(const struct list *the_list);
+extern void enlist(struct list *h, const char *s);
+extern void enlist_unique(struct list *header, const char *str, int n);
+extern void enlist_unique_header(struct list *header, const char *name, const char *value);
+extern void enlist_first(struct list *header, const char *str);
-extern char * list_to_text(const struct list *the_list);
+extern int list_remove_item(struct list *header, const char *str);
+extern void list_append_list_unique(struct list *dest, const struct list *src);
+extern void list_append_list_unique(struct list *dest, const struct list *src);
+extern int list_remove_list(struct list *header, const struct list *to_remove);
-/*
- * struct map
- *
- * A class which maps names to values.
- *
- * Note: You must allocate this through new_map() and free it
- * through free_map().
- */
-
-extern struct map * new_map (void);
-extern void free_map (struct map * the_map);
+extern void list_duplicate(struct list *dest, const struct list *src);
-extern int map (struct map * the_map,
- const char * name, int name_needs_copying,
- const char * value, int value_needs_copying);
-extern const char * lookup (const struct map * the_map, const char * name);
+extern void destroy_list(struct list *h);
+extern char *list_to_text(struct list *h);
+extern struct map* map(struct map* map, char *name, int nc, char *value, int vc);
+extern char *lookup(struct map *list, char *name);
+extern void free_map(struct map *list);
/* Revision control strings from this header and associated .c file */
extern const char list_rcs[];
@@ -155,7 +98,7 @@ extern const char list_h_rcs[];
} /* extern "C" */
#endif
-#endif /* ndef LIST_H_INCLUDED */
+#endif /* ndef _LIST_H */
/*
Local Variables:
diff --git a/loadcfg.c b/loadcfg.c
index 10bba47e..d999b026 100644
--- a/loadcfg.c
+++ b/loadcfg.c
@@ -1,21 +1,21 @@
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.39 2002/03/24 13:25:43 swa Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.18 2001/07/13 14:01:14 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
*
* Purpose : Loads settings from the configuration file into
- * global variables. This file contains both the
+ * global variables. This file contains both the
* routine to load the configuration and the global
* variables it writes to.
*
* Copyright : Written by and Copyright (C) 2001 the SourceForge
- * Privoxy team. http://www.privoxy.org/
+ * IJBSWA team. http://ijbswa.sourceforge.net
*
* Based on the Internet Junkbuster originally written
- * by and Copyright (C) 1997 Anonymous Coders and
+ * by and Copyright (C) 1997 Anonymous Coders and
* Junkbusters Corporation. http://www.junkbusters.com
*
- * This program is free software; you can redistribute it
+ * 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
@@ -35,96 +35,6 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.39 2002/03/24 13:25:43 swa Exp $"
*
* Revisions :
* $Log: loadcfg.c,v $
- * Revision 1.39 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.38 2002/03/24 13:05:48 jongfoster
- * Renaming re_filterfile to filterfile
- *
- * Revision 1.37 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.36 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.35 2002/03/07 03:52:44 oes
- * Set logging to tty for --no-daemon mode
- *
- * Revision 1.34 2002/03/06 23:14:35 jongfoster
- * Trivial cosmetic changes to make function comments easier to find.
- *
- * Revision 1.33 2002/03/05 04:52:42 oes
- * Deleted non-errlog debugging code
- *
- * Revision 1.32 2002/03/04 18:24:53 oes
- * Re-enabled output of unknown config directive hash
- *
- * Revision 1.31 2002/03/03 15:07:20 oes
- * Re-enabled automatic config reloading
- *
- * Revision 1.30 2002/01/22 23:31:43 jongfoster
- * Replacing strsav() with string_append()
- *
- * Revision 1.29 2002/01/17 21:02:30 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Renaming free_url to free_url_spec, since it frees a struct url_spec.
- *
- * Revision 1.28 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.27 2001/11/07 00:02:13 steudten
- * Add line number in error output for lineparsing for
- * actionsfile and configfile.
- * Special handling for CLF added.
- *
- * Revision 1.26 2001/11/05 21:41:43 steudten
- * Add changes to be a real daemon just for unix os.
- * (change cwd to /, detach from controlling tty, set
- * process group and session leader to the own process.
- * Add DBG() Macro.
- * Add some fatal-error log message for failed malloc().
- * Add '-d' if compiled with 'configure --with-debug' to
- * enable debug output.
- *
- * Revision 1.25 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.24 2001/10/23 21:40:30 jongfoster
- * Added support for enable-edit-actions and enable-remote-toggle config
- * file options.
- *
- * Revision 1.23 2001/10/07 15:36:00 oes
- * Introduced new config option "buffer-limit"
- *
- * Revision 1.22 2001/09/22 16:36:59 jongfoster
- * Removing unused parameter fs from read_config_line()
- *
- * Revision 1.21 2001/09/16 17:10:43 jongfoster
- * Moving function savearg() here, since it was the only thing left in
- * showargs.c.
- *
- * Revision 1.20 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.19 2001/07/15 17:45:16 jongfoster
- * Removing some unused #includes
- *
* Revision 1.18 2001/07/13 14:01:14 oes
* - Removed all #ifdef PCRS
* - Removed vim-settings
@@ -285,7 +195,6 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.39 2002/03/24 13:25:43 swa Exp $"
#include
#include
#include
-#include
#ifdef _WIN32
@@ -301,11 +210,9 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.39 2002/03/24 13:25:43 swa Exp $"
#else /* ifndef _WIN32 */
-#ifndef __OS2__
# include
-# include
-#endif
# include
+# include
# include
# include
@@ -316,11 +223,14 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.39 2002/03/24 13:25:43 swa Exp $"
#include "jcc.h"
#include "filters.h"
#include "loaders.h"
+#include "showargs.h"
+#include "parsers.h"
+#include "killpopup.h"
#include "miscutil.h"
#include "errlog.h"
+#include "jbsockets.h"
+#include "gateway.h"
#include "ssplit.h"
-#include "encode.h"
-#include "urlmatch.h"
const char loadcfg_h_rcs[] = LOADCFG_H_VERSION;
@@ -335,10 +245,10 @@ const char loadcfg_h_rcs[] = LOADCFG_H_VERSION;
#define ijb_isupper(__X) isupper((int)(unsigned char)(__X))
#define ijb_tolower(__X) tolower((int)(unsigned char)(__X))
-#ifdef FEATURE_TOGGLE
+#ifdef TOGGLE
/* by haroon - indicates if ijb is enabled */
int g_bToggleIJB = 1; /* JunkBusters is enabled by default. */
-#endif /* def FEATURE_TOGGLE */
+#endif
/* The filename of the configfile */
const char *configfile = NULL;
@@ -367,13 +277,9 @@ static struct file_list *current_configfile = NULL;
#define hash_actions_file 1196306641ul /* "actionsfile" */
#define hash_admin_address 4112573064ul /* "admin-address" */
-#define hash_buffer_limit 1881726070ul /* "buffer-limit */
#define hash_confdir 1978389ul /* "confdir" */
#define hash_debug 78263ul /* "debug" */
#define hash_deny_access 1227333715ul /* "deny-access" */
-#define hash_enable_edit_actions 2517097536ul /* "enable-edit-actions" */
-#define hash_enable_remote_toggle 2979744683ul /* "enable-remote-toggle" */
-#define hash_filterfile 250887266ul /* "filterfile" */
#define hash_forward 2029845ul /* "forward" */
#define hash_forward_socks4 3963965521ul /* "forward-socks4" */
#define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */
@@ -383,6 +289,7 @@ static struct file_list *current_configfile = NULL;
#define hash_logfile 2114766ul /* "logfile" */
#define hash_permit_access 3587953268ul /* "permit-access" */
#define hash_proxy_info_url 3903079059ul /* "proxy-info-url" */
+#define hash_re_filterfile 3877522444ul /* "re_filterfile" */
#define hash_single_threaded 4250084780ul /* "single-threaded" */
#define hash_suppress_blocklists 1948693308ul /* "suppress-blocklists" */
#define hash_toggle 447966ul /* "toggle" */
@@ -401,7 +308,6 @@ static struct file_list *current_configfile = NULL;
#define hash_show_on_task_bar 215410365ul /* "show-on-task-bar" */
-static void savearg(char *command, char *argument, struct configuration_spec * config);
/*********************************************************************
*
@@ -419,7 +325,7 @@ void unload_configfile (void * data)
{
struct configuration_spec * config = (struct configuration_spec *)data;
struct forward_spec *cur_fwd = config->forward;
-#ifdef FEATURE_ACL
+#ifdef ACL_FILES
struct access_control_list *cur_acl = config->acl;
while (cur_acl != NULL)
@@ -429,12 +335,12 @@ void unload_configfile (void * data)
cur_acl = next_acl;
}
config->acl = NULL;
-#endif /* def FEATURE_ACL */
+#endif /* def ACL_FILES */
while (cur_fwd != NULL)
{
struct forward_spec * next_fwd = cur_fwd->next;
- free_url_spec(cur_fwd->url);
+ free_url(cur_fwd->url);
freez(cur_fwd->gateway_host);
freez(cur_fwd->forward_host);
@@ -442,57 +348,37 @@ void unload_configfile (void * data)
cur_fwd = next_fwd;
}
config->forward = NULL;
-
-#ifdef FEATURE_COOKIE_JAR
+
+#ifdef JAR_FILES
if ( NULL != config->jar )
{
fclose( config->jar );
config->jar = NULL;
}
-#endif /* def FEATURE_COOKIE_JAR */
+#endif /* def JAR_FILES */
- freez(config->confdir);
- freez(config->logdir);
+ freez((char *)config->confdir);
+ freez((char *)config->logdir);
- freez(config->haddr);
- freez(config->logfile);
+ freez((char *)config->haddr);
+ freez((char *)config->logfile);
- freez(config->actions_file);
- freez(config->admin_address);
- freez(config->proxy_info_url);
- freez(config->proxy_args);
+ freez((char *)config->actions_file);
+ freez((char *)config->admin_address);
+ freez((char *)config->proxy_info_url);
+ freez((char *)config->proxy_args);
-#ifdef FEATURE_COOKIE_JAR
- freez(config->jarfile);
-#endif /* def FEATURE_COOKIE_JAR */
+#ifdef JAR_FILES
+ freez((char *)config->jarfile);
+#endif /* def JAR_FILES */
- freez(config->re_filterfile);
+#ifndef SPLIT_PROXY_ARGS
+ freez((char *)config->suppress_message);
+#endif /* ndef SPLIT_PROXY_ARGS */
-}
+ freez((char *)config->re_filterfile);
-
-#ifdef FEATURE_GRACEFUL_TERMINATION
-/*********************************************************************
- *
- * Function : unload_current_config_file
- *
- * Description : Unloads current config file - reset to state at
- * beginning of program.
- *
- * Parameters : None
- *
- * Returns : N/A
- *
- *********************************************************************/
-void unload_current_config_file(void)
-{
- if (current_configfile)
- {
- current_configfile->unloader = unload_configfile;
- current_configfile = NULL;
- }
}
-#endif
/*********************************************************************
@@ -502,7 +388,7 @@ void unload_current_config_file(void)
* Description : Load the config file and all parameters.
*
* Parameters :
- * 1 : csp = Client state (the config member will be
+ * 1 : csp = Client state (the config member will be
* filled in by this function).
*
* Returns : 0 => Ok, everything else is an error.
@@ -516,9 +402,8 @@ struct configuration_spec * load_config(void)
struct configuration_spec * config = NULL;
struct client_state * fake_csp;
struct file_list *fs;
- unsigned long linenum = 0;
- if ( !check_file_changed(current_configfile, configfile, &fs))
+ if (!check_file_changed(current_configfile, configfile, &fs))
{
/* No need to load */
return ((struct configuration_spec *)current_configfile->f);
@@ -531,9 +416,9 @@ struct configuration_spec * load_config(void)
log_error(LOG_LEVEL_INFO, "loading configuration file '%s':", configfile);
-#ifdef FEATURE_TOGGLE
+#ifdef TOGGLE
g_bToggleIJB = 1;
-#endif /* def FEATURE_TOGGLE */
+#endif
fs->f = config = (struct configuration_spec *)zalloc(sizeof(*config));
@@ -547,9 +432,9 @@ struct configuration_spec * load_config(void)
/*
* This is backwards from how it's usually done.
- * Following the usual pattern, "fs" would be stored in a member
+ * Following the usual pattern, "fs" would be stored in a member
* variable in "csp", and then we'd access "config" from "fs->f",
- * using a cast. However, "config" is used so often that a
+ * using a cast. However, "config" is used so often that a
* cast each time would be very ugly, and the extra indirection
* would waste CPU cycles. Therefore we store "config" in
* "csp->config", and "fs" in "csp->config->config_file_list".
@@ -562,8 +447,6 @@ struct configuration_spec * load_config(void)
config->multi_threaded = 1;
config->hport = HADDR_PORT;
- config->buffer_limit = 4096 * 1024;
- config->proxy_args = strdup("");
if ((configfp = fopen(configfile, "r")) == NULL)
{
@@ -572,14 +455,14 @@ struct configuration_spec * load_config(void)
/* Never get here - LOG_LEVEL_FATAL causes program exit */
}
- while (read_config_line(buf, sizeof(buf), configfp, &linenum) != NULL)
+ while (read_config_line(buf, sizeof(buf), configfp, fs) != NULL)
{
char cmd[BUFFER_SIZE];
char arg[BUFFER_SIZE];
char tmp[BUFFER_SIZE];
-#ifdef FEATURE_ACL
+#ifdef ACL_FILES
struct access_control_list *cur_acl;
-#endif /* def FEATURE_ACL */
+#endif /* def ACL_FILES */
struct forward_spec *cur_fwd;
int vec_count;
char *vec[3];
@@ -625,50 +508,43 @@ struct configuration_spec * load_config(void)
switch( hash_string( cmd ) )
{
-/* *************************************************************************
+/****************************************************************************
* actionsfile actions-file-name
* In confdir by default
- * *************************************************************************/
+ ****************************************************************************/
case hash_actions_file :
- freez(config->actions_file);
+ freez((char *)config->actions_file);
config->actions_file = make_path(config->confdir, arg);
continue;
-/* *************************************************************************
+/****************************************************************************
* admin-address email-address
- * *************************************************************************/
+ ****************************************************************************/
case hash_admin_address :
- freez(config->admin_address);
+ freez((char *)config->admin_address);
config->admin_address = strdup(arg);
- continue;
+ continue;
-/* *************************************************************************
- * buffer-limit n
- * *************************************************************************/
- case hash_buffer_limit :
- config->buffer_limit = (size_t) 1024 * atoi(arg);
- continue;
-
-/* *************************************************************************
+/****************************************************************************
* confdir directory-name
- * *************************************************************************/
+ ****************************************************************************/
case hash_confdir :
- freez(config->confdir);
- config->confdir = make_path( NULL, arg);
- continue;
+ freez((char *)config->confdir);
+ config->confdir = strdup(arg);
+ continue;
-/* *************************************************************************
+/****************************************************************************
* debug n
* Specifies debug level, multiple values are ORed together.
- * *************************************************************************/
+ ****************************************************************************/
case hash_debug :
config->debug |= atoi(arg);
continue;
-/* *************************************************************************
+/****************************************************************************
* deny-access source-ip[/significant-bits] [dest-ip[/significant-bits]]
- * *************************************************************************/
-#ifdef FEATURE_ACL
+ ****************************************************************************/
+#ifdef ACL_FILES
case hash_deny_access:
vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
@@ -676,7 +552,7 @@ struct configuration_spec * load_config(void)
{
log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
"deny-access directive in configuration file.");
- string_append(&config->proxy_args,
+ config->proxy_args = strsav( config->proxy_args,
" \nWARNING: Wrong number of parameters for "
"deny-access directive in configuration file.