# Sample Configuration file for the Internet Junkbuster 2.0
#
-# $Id: config,v 1.2 2001/04/30 03:05:11 rodney Exp $
+# $Id: config,v 1.2 2001/05/17 22:37:46 oes Exp $
#
# Table of Contents
#
-# 1. INTRODUCTION
+# 1. INTRODUCTION
# 2. FORMAT OF THE CONFIGURATION FILE
# 3. OTHER CONFIGURATION FILES
-# 4. GENERAL OPTIONS
+# 4. GENERAL OPTIONS
# 5. WINDOWS GUI OPTIONS
#
# 1. INTRODUCTION
#
# Default: Don't block anything.
#
-blockfile ./blocklist
+blockfile ./blocklist
#
# The imagefile contains regular expressions, one per line, of URLs
#
# Default: Block all URLs as HTML requests.
#
-imagefile ./imagelist
+imagefile ./imagelist
#
-# The popfile contains regular expressions, one per line, of sites
-# where Junkbuster should disable Javascript popups.
+# The permissions file contains patterns to specify the
+# cookie and filtering rules to apply to each site.
#
-# Default: No popup filtering.
+# Default: Cookies to and from all destinations are filtered.
+# Popups are disabled for all sites.
+# All sites are filtered if re_filterfile specified.
#
-popupfile ./popup
+permissionsfile ./permissionsfile
#
# The re_filterfile contains content modification rules. These rules
#
# Default: No content modification.
#
-re_filterfile ./re_filterfile
-
-#
-# The cookiefile defines how Junkbuster should treat cookies: filter
-# them out; permit them; permit them only one-way from your browser
-# to the site, etc. You can set this on a site-by-site basis, so
-# that you can, for example, use cookies at sites you trust while
-# filtering them out everywhere else.
-#
-# Default: Cookies to and from all destinations are filtered.
-#
-cookiefile ./cookiefile
+re_filterfile ./re_filterfile
#
# The logfile is where all logging and error messages are written.
#
# Default: Log to the standard error channel, not to a file
#
-logfile ./junkbuster.log
+logfile ./junkbuster.log
#
# The jarfile defines where Junkbuster stores the cookies it
#
# Default: Don't store intercepted cookies
#
-#jarfile ./jarfile
+#jarfile ./jarfile
#
# The forwardfile defines domain-specific forwarding of HTTP
#
# Default: Make all connections directly.
#
-forwardfile ./forward
+forwardfile ./forward
#
# Generally, Junkbuster is used as a personal proxy. The default
# Default: No access control. Everybody that can reach junkbuster
# will be served.
#
-#aclfile ./aclfile
+#aclfile ./aclfile
#
# 4. OPTIONS
# how Junkbuster operates.
#
-#
-# If 're_filter_all' is set, (commented in) Junkbuster will attempt
-# content modification (see 're_filterfile' above) on all requests.
-#
-# Default: Content modification takes only place if no cookie would
-# be sent to the server.
-#
-#re_filter_all
-
#
# If 'add-forwarded-header' is set, an "X-Forwarded-For:"
# specification will be added to each request header. Generally,
#
# VALUE EFFECT
# ===== ======
-# default Kill the referrer-header from the client.
-# . Pass the referrer unchanged.
+# default Kill the referrer-header from the client.
+# . Pass the referrer unchanged.
# @ Pass the referrer if the server is in the cookie file,
# kill the referrer otherwise.
# L Pass the referrer if the server is in the cookie file,
#
# Default: see above
#
-referer L
+referer L
#
# Some browsers provide a "From:" header that gives Web sites your
#
# Default: see above
#
-from spam-me-senseless@sittingduck.xqq
+#from spam-me-senseless@sittingduck.xqq
#
# The 'tinygif' option lets you change how Junkbuster treats blocked
#
# VALUE EFFECT
# ===== ======
-# 0 Send HTML
-# 1 Send a GIF of one transparent pixel
-# 2 Send a GIF with the word "JUNKBUSTER"
-# 3 <url> Send a redirect to the image indicated by the <url>
+# 0 Send HTML
+# 1 Send a GIF of one transparent pixel
+# 2 Send a GIF with the word "JUNKBUSTER"
+# 3 <url> Send a redirect to the image indicated by the <url>
#
# As an example of the last option:
#
#
# Default: 0, i.e. send HTML
#
-tinygif 2
+tinygif 2
#
# The debug option sets the level of debugging information to log in
#
# Default: 0, i.e. log nothing but errors and infos
#
-debug 1
+debug 1
#
# Junkbuster normally uses "multi-threading", a software technique
# Warning: Setting this to 0 will result in the buffer to grow
# infinitely and eat up all your memory!
#
-#Win32-only: log-buffer-size 1
+#Win32-only: log-buffer-size 1
-# log-max-lines {number of lines, e.g., '200'}
+# log-max-lines {number of lines, e.g., '200'}
#
# Maximum number of lines held in the log buffer. See above.
#
-#Win32-only: log-max-lines 200
+#Win32-only: log-max-lines 200
# log-highlight-messages {1 or 0}
#
#define _CONFIG_H
/*********************************************************************
*
- * File : $Source: /home/administrator/cvs/ijb/acconfig.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/config.h,v $
*
* Purpose : This file should be the first thing included in every
* .c file. (Before even system headers). It contains
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Revisions :
- * $Log: acconfig.h,v $
+ * $Log: config.h,v $
+ * Revision 1.1.1.1 2001/05/15 13:58:49 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
\f
/*
* Version number - Point (_._.X)
*/
-#define VERSION_POINT 3
+#define VERSION_POINT 4
/*
* Version number, as a string
*/
-#define VERSION "2.9.3"
+#define VERSION "2.9.4"
/*
* Regular expression matching for URLs. (Highly recommended). If this is
VERSION_MAJOR=2
VERSION_MINOR=9
-VERSION_POINT=3
+VERSION_POINT=4
dnl Process this file with autoconf to produce a configure script.
dnl
-dnl $Id: configure.in,v 1.2 2001/05/13 22:04:51 administrator Exp $
+dnl $Id: configure.in,v 1.1.1.1 2001/05/15 13:58:50 oes Exp $
dnl
dnl Written by and Copyright (C) 2001 the SourceForge
dnl IJBSWA team. http://ijbswa.sourceforge.net
dnl Temple Place - Suite 330, Boston, MA 02111-1307, USA.
dnl
dnl $Log: configure.in,v $
+dnl Revision 1.1.1.1 2001/05/15 13:58:50 oes
+dnl Initial import of version 2.9.3 source tree
+dnl
dnl
AC_INIT(jcc.c)
AC_CONFIG_HEADER(config.h)
VERSION_MAJOR=2
VERSION_MINOR=9
-VERSION_POINT=3
+VERSION_POINT=4
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
+++ /dev/null
-#
-# This is /etc/junkbuster/cookefile which was put here by a junkbuster rpm
-#
-# Last modified on Sun Jan 31 22:36:03 1999 (CEST)
-#
-# --------------------------------------------------------------------------
-#
-# Newest version is always available from
-#
-# http://www.waldherr.org/cookiefile
-#
-# Read http://www.waldherr.org/junkbuster/update.shtml on how to keep
-# this file up-to-date.
-#
-# For more detail, see http://www.junkbusters.com/ht/en/ijbfaq.html#cookies
-#
-# Empty lines and lines beginning with a # are ignored.
-# To permit an entire site to set cookies, simply include its domain name:
-# really-trustyworthy-people.org
-#
-# You can allow cookies out, but stop them coming in:
-# >send-user-cookies.com
-#
-#>egroups.com
-#>tvguide.com
-#>wired.com/news/
-#americanexpress.com
-#cnn.com
-#www.nytimes.com
-#yahoo.com
-#amazon.de
-#amazon.co.uk
-#slashdot.org
-#www.palmgear.com
-#onelist.com
-#freshmeat.net
-
-# Sites that need cookies
-javasoft.com
-sun.com
-msdn.microsoft.com
-sourceforge.net
-yahoo.com
-anonymizer.com
-
-# Experimenting
-ashleycars.co.uk
-
-# Shopping
-dabs.com
-overclockers.co.uk
-worldpay.com # for quietpc.com
-jungle.com
-scan.co.uk
-
-#Shopping: Micro Warehouse's site
-#inmac.co.uk
-#technomatic.co.uk
-
-# This is stupid. Without these two entries, the link from McAfee's website
-# to their online UK shop gives a 500 server error.
-#mcafee.com
-#mcafeestoreuk.beyond.com
-
-
-
-
-const char filters_rcs[] = "$Id: filters.c,v 1.1 2001/05/13 21:57:06 administrator Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.1.1.1 2001/05/15 13:58:52 oes Exp $";
/*********************************************************************
*
- * File : $Source: /home/administrator/cvs/ijb/filters.c,v $
+ * File : $Source: /cvsroot/ijbswa/current/filters.c,v $
*
* Purpose : Declares functions to parse/crunch headers and pages.
* Functions declared include:
* `acl_addr', `add_stats', `block_acl', `block_imageurl',
- * `block_url', `cookie_url', `domaincmp', `dsplit',
+ * `block_url', `url_permissions', `domaincmp', `dsplit',
* `filter_popups', `forward_url',
* `ij_untrusted_url', `intercept_url', `re_process_buffer',
* `show_proxy_args', and `trust_url'
*
* Revisions :
* $Log: filters.c,v $
+ * Revision 1.1.1.1 2001/05/15 13:58:52 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
\f
struct re_filterfile_spec *b;
/* Sanity first ;-) */
- if (size <= 0) return;
+ if (size <= 0)\r
+ {\r
+ return;\r
+ }
if ( ( NULL == (fl = csp->rlist) ) || ( NULL == (b = fl->f) ) )
{
joblist = b->joblist;
- log_error(LOG_LEVEL_REF, "re_filtering %s%s (size %d) ...",
+ log_error(LOG_LEVEL_RE_FILTER, "re_filtering %s%s (size %d) ...",
csp->http->hostport, csp->http->path, size);
/* Apply all jobs from the joblist */
old=new;
}
- log_error(LOG_LEVEL_REF, " produced %d hits (new size %d).", hits, size);
+ log_error(LOG_LEVEL_RE_FILTER, " produced %d hits (new size %d).", hits, size);
if (write_socket(csp->cfd, old, size) != size)
{
/*********************************************************************
*
- * Function : cookie_url
+ * Function : url_permissions
*
- * Description : Accept this cookie, or no? See "cookiefile" setting.
+ * Description : Gets the permissions for this URL.
*
* Parameters :
* 1 : http = http_request request for blocked URLs
* 2 : csp = Current client state (buffers, headers, etc...)
*
- * Returns : NULL => accept, cookie_spec pointer to crunch.
+ * Returns : permissions bitmask specifiying what this URL can do.\r
+ * If not on list, will be default_permissions.
*
*********************************************************************/
-struct cookie_spec *cookie_url(struct http_request *http, struct client_state *csp)
+int url_permissions(struct http_request *http, struct client_state *csp)
{
struct file_list *fl;
- struct cookie_spec *b;
+ struct permissions_spec *b;
struct url_spec url[1];
- if (((fl = csp->clist) == NULL) || ((b = fl->f) == NULL))
+ if (((fl = csp->permissions_list) == NULL) || ((b = fl->f) == NULL))
{
- return(NULL);
+ return(default_permissions);
}
*url = dsplit(http->host);
/* if splitting the domain fails, punt */
- if (url->dbuf == NULL) return(NULL);
+ if (url->dbuf == NULL)\r
+ {\r
+ return(default_permissions);\r
+ }
for (b = b->next; NULL != b; b = b->next)
{
{
freez(url->dbuf);
freez(url->dvec);
- return(b);
+ return(b->permissions);
}
}
}
freez(url->dbuf);
freez(url->dvec);
- return(NULL);
+ return(default_permissions);
}
file_description = "Block List";
}
break;
- case 'c':
- if (csp->clist)
+ case 'p':
+ if (csp->permissions_list)
{
- filename = csp->clist->filename;
- file_description = "Cookie List";
+ filename = csp->permissions_list->filename;
+ file_description = "Permissions List";
}
break;
case 'f':
break;
#endif /* def USE_IMAGE_LIST */
-#ifdef KILLPOPUPS
- case 'p':
- if (csp->plist)
- {
- filename = csp->plist->filename;
- file_description = "Popup list";
- }
- break;
-#endif /* def KILLPOPUPS */
-
#ifdef PCRS
case 'r':
if (csp->rlist)
s = strsav(s, "</code></a></li>\n");
}
- if (csp->clist)
+ if (csp->permissions_list)
{
- s = strsav(s, "<li>Cookie List: <a href=\"show-proxy-args?cookie\"><code>");
- s = strsav(s, csp->clist->filename);
+ s = strsav(s, "<li>Permissions List: <a href=\"show-proxy-args?permit\"><code>");
+ s = strsav(s, csp->permissions_list->filename);
s = strsav(s, "</code></a></li>\n");
}
s = strsav(s, "</code></a></li>\n");
}
#endif /* def USE_IMAGE_LIST */
-
-#ifdef KILLPOPUPS
- if (csp->plist)
- {
- s = strsav(s, "<li>Popup List: <a href=\"show-proxy-args?popup\"><code>");
- s = strsav(s, csp->plist->filename);
- s = strsav(s, "</code></a></li>\n");
- }
-#endif /* def KILLPOPUPS */
-
+\r
#ifdef PCRS
if (csp->rlist)
{
}
#endif /* def USE_IMAGE_LIST */
-#ifdef KILLPOPUPS
- if (csp->plist)
- {
- s = strsav(s, csp->plist->proxy_args);
- }
-#endif /* def KILLPOPUPS */
-
#ifdef PCRS
if (csp->rlist)
{
#ifndef _FILTERS_H
#define _FILTERS_H
-#define FILTERS_H_VERSION "$Id: filters.h,v 1.1 2001/05/13 21:57:06 administrator Exp $"
+#define FILTERS_H_VERSION "$Id: filters.h,v 1.1.1.1 2001/05/15 13:58:52 oes Exp $"
/*********************************************************************
*
- * File : $Source: /home/administrator/cvs/ijb/filters.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/filters.h,v $
*
* Purpose : Declares functions to parse/crunch headers and pages.
* Functions declared include:
* `acl_addr', `add_stats', `block_acl', `block_imageurl',
- * `block_url', `cookie_url', `domaincmp', `dsplit',
+ * `block_url', `url_permissions', `domaincmp', `dsplit',
* `filter_popups', `forward_url'
* `ij_untrusted_url', `intercept_url', `re_process_buffer',
* `show_proxy_args', and `trust_url'
*
* Revisions :
* $Log: filters.h,v $
+ * Revision 1.1.1.1 2001/05/15 13:58:52 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
\f\r
extern int block_imageurl_using_imagelist(struct http_request *http, struct client_state *csp);
#endif /* def USE_IMAGE_LIST */
-extern struct cookie_spec *cookie_url(struct http_request *http, struct client_state *csp);
+extern int url_permissions(struct http_request *http, struct client_state *csp);
extern const struct gateway *forward_url(struct http_request *http, struct client_state *csp);
extern struct url_spec dsplit(char *domain);
-const char jcc_rcs[] = "$Id: jcc.c,v 1.1.1.1 2001/05/15 13:58:56 oes Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.2 2001/05/17 22:34:44 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
*
* Revisions :
* $Log: jcc.c,v $
+ * Revision 1.2 2001/05/17 22:34:44 oes
+ * - Added hint on GIF char array generation to jcc.c
+ * - Cleaned CRLF's from the sources and related files
+ * - Repaired logging for REF and FRC
+ *
* Revision 1.1.1.1 2001/05/15 13:58:56 oes
* Initial import of version 2.9.3 source tree
*
*********************************************************************/
static void chat(struct client_state *csp)
{
+/* This next line is a little ugly, but it simplifies the if statement below. */\r
+/* Basically if TOGGLE, then we want the if to test "csp->toggled_on", else we don't */\r
+#ifdef TOGGLE\r
+# define IS_TOGGLED_ON csp->toggled_on &&\r
+#else /* ifndef TOGGLE */\r
+# define IS_TOGGLED_ON\r
+#endif /* ndef TOGGLE */\r
+\r
+/* This next line is a little ugly, but it simplifies the if statement below. */\r
+/* Basically if TRUST_FILES, then we want the if to call "trust_url", else we don't */\r
+#ifdef TRUST_FILES\r
+# define IS_TRUSTED_URL (p = trust_url(http, csp)) ||\r
+#else /* ifndef TRUST_FILES */\r
+# define IS_TRUSTED_URL\r
+#endif /* ndef TRUST_FILES */\r
+\r
+ \r
char buf[BUFSIZ], *hdr, *p, *req;
char *err = NULL;
char *eno;
fd_set rfds;
int n, maxfd, server_body, ms_iis5_hack = 0;
- struct cookie_spec *cs;
const struct gateway *gw;
- struct http_request *http;
+ struct http_request *http;\r
+#ifdef KILLPOPUPS\r
+ int block_popups; /* bool, 1==will block popups */\r
+ int block_popups_now = 0; /* bool, 1==currently blocking popups */\r
+#endif /* def KILLPOPUPS */\r
#ifdef PCRS
- int filtering = 0;
+ int pcrs_filter; /* bool, 1==will filter through pcrs */\r
+ int filtering = 0; /* bool, 1==currently filtering through pcrs */
#endif /* def PCRS */
http = csp->http;
if(strstr(req, FORCE_PREFIX))
{
strclean(req, FORCE_PREFIX);
- log_error(LOG_LEVEL_FRC, "Enforcing request \"%s\".\n", req);
+ log_error(LOG_LEVEL_FORCE, "Enforcing request \"%s\".\n", req);
csp->force = 1;
}
else
if ((gw = forward_url(http, csp)) == NULL)
{
- log_error(LOG_LEVEL_ERROR, "gateway spec is NULL!?!? This can't happen!");
- abort();
+ log_error(LOG_LEVEL_FATAL, "gateway spec is NULL!?!? This can't happen!");
+ /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
}
/* build the http request to send to the server
freez(p);
}
}
-
+\r
/* decide what we're to do with cookies */
-
-#if defined(TOGGLE)
- /*
- * by haroon - most of credit to srt19170
- * if toggled_on flag is false IJB is disabled, pass cookies thru
- */
- if (!csp->toggled_on)
- {
- csp->accept_server_cookie = 1;
- csp->send_user_cookie = 1;
- }
- else
-#endif
-
- if ((cs = cookie_url(http, csp)))
- {
- csp->accept_server_cookie = cs->accept_server_cookie;
- csp->send_user_cookie = cs->send_user_cookie;
- }
- else
- {
- csp->accept_server_cookie = 0;
- csp->send_user_cookie = 0;
- }
+\r
+#ifdef TOGGLE\r
+ if (!csp->toggled_on)\r
+ {\r
+ /* Most compatible set of permissions */\r
+ csp->permissions = PERMIT_COOKIE_SET | PERMIT_COOKIE_READ | PERMIT_POPUPS;\r
+ }\r
+ else\r
+ {\r
+ csp->permissions = url_permissions(http, csp);\r
+ }\r
+#else /* ifndef TOGGLE */\r
+ csp->permissions = url_permissions(http, csp);\r
+#endif /* ndef TOGGLE */\r
+\r
+#ifdef KILLPOPUPS\r
+ block_popups = ((csp->permissions & PERMIT_POPUPS) == 0);\r
+#endif /* def KILLPOPUPS */\r
+#ifdef PCRS\r
+ pcrs_filter = (csp->rlist != NULL) && /* There are expressions to be used */\r
+ ((csp->permissions & PERMIT_RE_FILTER) != 0);
+#endif /* def PCRS */\r
+\r
/* grab the rest of the client's headers */
destroy_list(csp->headers);
-#ifdef TOGGLE
- /*
- * by haroon - most of credit to srt19170
- * if toggled_on flag is true then IJB is enabled, do the usual
- * otherwise avoid crunching
- */
-
-/* This next line is a little ugly, but it simplifies the if statement below. */
-/* Basically if TOGGLE, then we want the if to test "csp->toggled_on", else we don't */
-#define IS_TOGGLED_ON csp->toggled_on &&
-
-#else /* ifndef TOGGLE */
-
-/* We don't have TOGGLE, so we don't care about toggling. */
-#define IS_TOGGLED_ON
-
-#endif /* ndef TOGGLE */
-
-
-#ifdef TRUST_FILES
-/* This next line is a little ugly, but it simplifies the if statement below. */
-/* Basically if TRUST_FILES, then we want the if to call "trust_url", else we don't */
-#define IS_TRUSTED_URL (p = trust_url(http, csp)) ||
-
-#else /* ifndef TRUST_FILES */
-
-/* We don't have TRUST_FILES, so we don't care about trusted URL's. */
-#define IS_TRUSTED_URL
-
-#endif /* ndef TRUST_FILES */
+ /*\r
+ * by haroon - most of credit to srt19170\r
+ * if toggled_on flag is true then IJB is enabled, do the usual\r
+ * otherwise avoid crunching\r
+ */\r
/* Check the request against all rules, unless
* we're disabled or in force mode.
#ifdef KILLPOPUPS
/* Filter the popups on this read. */
- if ( IS_TOGGLED_ON
- ( kill_all_popups ||
- ( ( http->host != NULL ) && ( popupfile != NULL ) ) ) )
+ if (block_popups_now)
{
- filter_popups(csp, http->host, buf, n);
+ filter_popups(buf, n);
}
#endif /* def KILLPOPUPS */
* the client (along with anything else that
* may be in the buffer)
*/
-
+\r
+#ifdef KILLPOPUPS\r
+ /* Start blocking popups if appropriate. */\r
+\r
+ if (csp->is_text && /* It's a text / * MIME-Type */\r
+ !http->ssl && /* We talk plaintext */\r
+ block_popups)\r
+ {\r
+ block_popups_now = 1;\r
+ }\r
+\r
+#endif /* def KILLPOPUPS */\r
+\r
#ifdef PCRS
- /* Decide if we want to re_filter this. */
-
- if (IS_TOGGLED_ON /* Only filter if toggle is "on" */
- csp->is_text && /* It's a text / * MIME-Type */
- re_filterfile && /* There are expressions to be used */
- !http->ssl && /* We talk plaintext */
- (re_filter_all || !csp->send_user_cookie)) /* Policy allows */
+ /* Start re_filtering this if appropriate. */
+\r
+ if (csp->is_text && /* It's a text / * MIME-Type */
+ !http->ssl && /* We talk plaintext */\r
+ pcrs_filter) /* Policy allows */
{
filtering = 1;
}
if (run_loader(csp))
{
- log_error(LOG_LEVEL_ERROR, "a loader failed - must exit");
- return;
+ log_error(LOG_LEVEL_FATAL, "a loader failed - must exit");\r
+ /* Never get here - LOG_LEVEL_FATAL causes program exit */
}
if (multi_threaded)
-const char killpopup_rcs[] = "$Id: killpopup.c,v 1.1 2001/05/13 21:57:06 administrator Exp $";
+const char killpopup_rcs[] = "$Id: killpopup.c,v 1.1.1.1 2001/05/15 13:58:58 oes Exp $";
/*********************************************************************
*
- * File : $Source: /home/administrator/cvs/ijb/killpopup.c,v $
+ * File : $Source: /cvsroot/ijbswa/current/killpopup.c,v $
*
* Purpose : Handles the filtering of popups.
*
*
* Revisions :
* $Log: killpopup.c,v $
+ * Revision 1.1.1.1 2001/05/15 13:58:58 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
\f
/* Change these for debug output. *lots*. */
/*#define POPUP_VERBOSE 1*/
-/* CHANGED - added the below and shifted the more spammy stuff into it ;-) */
-#undef POPUP_VERY_VERBOSE
#undef POPUP_VERBOSE
* Function : filter_popups
*
* Description : Filter the block of data that's been read from the server.
- * IF NECESSARY.
+ * Caller is responsible for checking permissons list\r
+ * to determine if this function should be called.
*
* Parameters :
- * 1 : csp = Client state
- * 2 : host_name = hostname of originating web page to
- * look up on blocklist
- * 3 : buff = Buffer to scan and modify. Null terminated.
- * 4 : size = Buffer size, excluding null terminator.
+ * 1 : buff = Buffer to scan and modify. Null terminated.
+ * 2 : size = Buffer size, excluding null terminator.
*
* Returns : void
*
*********************************************************************/
-void filter_popups(struct client_state *csp, char *host_name, char *buff, int size)
+void filter_popups(char *buff, int size)
{
- struct popup_settings * data;
- struct popup_blocklist * cur;
- int i;
- int found = 0;
char *popup = NULL;
char *close = NULL;
char *p = NULL;
char *q = NULL; /* by BREITENB NEW! */
- if ( (!csp->plist) || ((data = csp->plist->f) == NULL) )
- {
- /* Disabled. */
- return;
- }
-
- /* If the hostname is on our list for blocking then mark it
- * as a host to block from. (This may be later changed if the
- * host is also on the list-to-allow list).
- */
-
- for (i=0; (i < 50) && (i < size); i++) /* avoid scanning binary data! */
- {
- if ((unsigned int)(buff[i])>127)
- {
-#ifdef POPUP_VERBOSE
- fprintf(logfp, "I'm not scanning binary stuff! (%i)\n",buff[i]);
-#endif
- return;
- }
- }
-
-
- for (cur = data->blocked ; cur ; cur = cur->next)
- {
- if ( host_name != 0 )
- {
- if ( strcmp( cur->host_name, host_name ) == 0 )
- {
-#ifdef POPUP_VERBOSE
- fprintf(logfp, "Blocking %s\n", host_name );
-#endif
- found = 1;
- }
- }
- }
-
- /* Force match if we're supposed to nuke _all_ popups, globally. */
- if ( kill_all_popups != 0 )
- {
-#ifdef POPUP_VERBOSE
- fprintf(logfp, "Indescriminatly nuking popups..\n" );
-#endif
- found = 1;
- }
- /* an exception-from blocking should still be an exception! by BREITENB NEW! */
-
-
- /* Now, if its allowed adjust the filtering, so it _doesn't_ happen. */
- for (cur = data->allowed ; cur ; cur = cur->next)
- {
- if ( host_name != 0 )
- {
- if ( strcmp( cur->host_name, host_name ) == 0 )
- {
-#ifdef POPUP_VERBOSE
- fprintf(logfp, "Reversing block decision for %s\n", host_name );
-#endif
- found = 0;
- }
- }
- }
-
- if ( found == 0)
- {
-#ifdef POPUP_VERBOSE
- fprintf(logfp, "Allowing %s\n", host_name );
-#endif
- return;
- }
-
while ((popup = strstr( buff, "window.open(" )) != NULL)
- /* if ( popup ) by BREITENB filter ALL popups! NEW! */
{
#ifdef POPUP_VERBOSE
fprintf(logfp, "Found start of window open" );
if (!popup) popup=strstr( buff, "<BOdy");
if (popup)
{
- q=strchr(popup,'>');
- if (q)
+ close=strchr(popup,'>');
+ if (close)
{
/* we are now between <body and the ending > */
p=strstr(popup, "onUnload");
#ifndef _KILLPOPUP_H
#define _KILLPOPUP_H
-#define KILLPOPUP_H_VERSION "$Id: killpopup.h,v 1.1 2001/05/13 21:57:06 administrator Exp $"
+#define KILLPOPUP_H_VERSION "$Id: killpopup.h,v 1.1.1.1 2001/05/15 13:58:58 oes Exp $"
/*********************************************************************
*
- * File : $Source: /home/administrator/cvs/ijb/killpopup.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/killpopup.h,v $
*
* Purpose : Handles the filtering of popups.
*
*
* Revisions :
* $Log: killpopup.h,v $
+ * Revision 1.1.1.1 2001/05/15 13:58:58 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
\f
#ifdef KILLPOPUPS
-extern void filter_popups(struct client_state *csp, char *host_name, char *buff, int size);
+extern void filter_popups(char *buff, int size);
#endif /* def KILLPOPUPS */
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.1.1.1 2001/05/15 13:58:58 oes Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.2 2001/05/17 23:01:01 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
*
* Revisions :
* $Log: loadcfg.c,v $
+ * Revision 1.2 2001/05/17 23:01:01 oes
+ * - Cleaned CRLF's from the sources and related files
+ *
* Revision 1.1.1.1 2001/05/15 13:58:58 oes
* Initial import of version 2.9.3 source tree
*
const char *configfile = NULL;
const char *blockfile = NULL;
-const char *cookiefile = NULL;
+const char *permissions_file = NULL;
const char *forwardfile = NULL;
#ifdef ACL_FILES
#ifdef USE_IMAGE_LIST
const char *imagefile = NULL;
#endif /* def USE_IMAGE_LIST */
-
-#ifdef KILLPOPUPS
-const char *popupfile = NULL;
-int kill_all_popups = 0; /* Not recommended really ... */
-#endif /* def KILLPOPUPS */
+\r
+/*\r
+ * Permissions to use for URLs not in the permissions list.\r
+ */
+int default_permissions = PERMIT_RE_FILTER;\r
#ifdef PCRS
const char *re_filterfile = NULL;
-int re_filter_all = 0;
#endif /* def PCRS */
#ifdef TRUST_FILES
#endif /* ndef SPLIT_PROXY_ARGS */
int suppress_vanilla_wafer = 0;
-int add_forwarded = 0;
+int add_forwarded = 0;
struct list wafer_list[1];
struct list xtra_list[1];
* something a little more readable. This also makes changing the
* hash values easier if they should change or the hash algorthm changes.
* Use the included "hash" program to find out what the hash will be
- * for any string supplied on the command line.
+ * for any string supplied on the command line. (Or just put it in the\r
+ * config file and read the number from the error message in the log).
*/
#define hash_trustfile 56494766ul
#define hash_suppress_vanilla_wafer 3121233547ul
#define hash_wafer 89669ul
#define hash_add_header 237434619ul
-#define hash_cookiefile 247469766ul
+#define hash_permissions_file 3825730796lu /* "permissionsfile" */\r
#define hash_logfile 2114766ul
#define hash_blockfile 48845391ul
#define hash_imagefile 51447891ul
#define hash_listen_address 1255650842ul
#define hash_forwardfile 1268669141ul
#define hash_aclfile 1908516ul
-#define hash_popupfile 54623516ul
-#define hash_kill_all_popups 2311539906ul
#define hash_re_filterfile 3877522444ul
-#define hash_re_filter_all 3877521376ul
#define hash_user_agent 283326691ul
#define hash_referrer 10883969ul
#define hash_referer 2176719ul
* Returns : configret : 0 => Ok, everything else is an error.
* Note: we use configret since a signal handler cannot
* return a value, and this function does double duty.
- * Ie. Is is called from main and from signal( SIGHUP );
+ * Ie. Is is called from main and from signal( SIGHUP );\r
*
*********************************************************************/
void load_config( int signum )
char *p, *q;
FILE *configfp = NULL;
- configret = 0;
+ configret = 0; /* FIXME: This is obsolete, always 0. */
config_changed = 1;
log_error(LOG_LEVEL_INFO, "loading configuration file '%s':", configfile);
/* (Waste of memory [not quite a "leak"] here. The
- * last blockfile/popupfile/... etc will not be
+ * last blockfile/permissions file/... etc will not be
* unloaded until we load a new one. If the
- * block/popup/... feature has been disabled in
+ * block/... feature has been disabled in
* the new config file, then we're wasting some
* memory we could otherwise reclaim.
*/
* But leave changing the logfile until after we're done loading.
*/
- #ifdef JAR_FILES
+#ifdef JAR_FILES
if ( NULL != jar )
{
fclose( jar );
jar = NULL;
}
- #endif /* def JAR_FILES */
+#endif /* def JAR_FILES */
debug = 0;
- multi_threaded = 1;
+ multi_threaded = 1;\r
+\r
+ default_permissions = PERMIT_RE_FILTER;
#if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
tinygif = 0;
hideConsole = 0;
#endif /*def _WIN_CONSOLE*/
-#ifdef PCRS
- re_filter_all = 0;
-#endif /* def PCRS */
-
-#ifdef KILLPOPUPS
- kill_all_popups = 0;
-#endif /* def KILLPOPUPS */
-
#ifdef TOGGLE
g_bToggleIJB = 1;
#endif
freez((char *)blockfile);
- freez((char *)cookiefile);
+ freez((char *)permissions_file);
freez((char *)forwardfile);
#ifdef ACL_FILES
freez((char *)jarfile);
#endif /* def JAR_FILES */
-#ifdef KILLPOPUPS
- freez((char *)popupfile);
-#endif /* def KILLPOPUPS */
-
#ifndef SPLIT_PROXY_ARGS
freez((char *)suppress_message);
#endif /* ndef SPLIT_PROXY_ARGS */
{
if ((configfp = fopen(configfile, "r")) == NULL)
{
- log_error(LOG_LEVEL_ERROR, "can't open configuration file '%s': %E",
+ log_error(LOG_LEVEL_FATAL, "can't open configuration file '%s': %E",
configfile);
- configret = 1;
- return;
+ /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
}
}
enlist(xtra_list, arg);
continue;
- case hash_cookiefile :
- freez((char *)cookiefile);
- cookiefile = strdup(arg);
+ case hash_permissions_file :
+ freez((char *)permissions_file);
+ permissions_file = strdup(arg);
continue;
case hash_logfile :
continue;
#endif /* def ACL_FILES */
-#ifdef KILLPOPUPS
- case hash_popupfile :
- freez((char *)popupfile);
- popupfile = strdup(arg);
- continue;
-
- case hash_kill_all_popups :
- kill_all_popups = 1;
- continue;
-#endif /* def KILLPOPUPS */
-
#ifdef PCRS
case hash_re_filterfile :
freez((char *)re_filterfile);
re_filterfile = strdup(arg);
continue;
-
- case hash_re_filter_all :
- re_filter_all = 1;
- log_error(LOG_LEVEL_REF, "re_filter policy is %s.",
- re_filter_all ? "RADICAL" : "SEMI-SMART");
- continue;
#endif /* def PCRS */
case hash_user_agent :
#endif /* ndef USE_IMAGE_LIST */
#ifndef PCRS
case hash_re_filterfile :
- case hash_re_filter_all :
#endif /* ndef PCRS */
#ifndef TOGGLE
case hash_toggle :
#if !defined(DETECT_MSIE_IMAGES) && !defined(USE_IMAGE_LIST)
case hash_tinygif :
#endif /* !defined(DETECT_MSIE_IMAGES) && !defined(USE_IMAGE_LIST) */
-#ifndef KILLPOPUPS
- case hash_popupfile :
- case hash_kill_all_popups :
-#endif /* ndef KILLPOPUPS */
#ifndef JAR_FILES
case hash_jarfile :
#endif /* ndef JAR_FILES */
continue;
default :
+ /*\r
+ * I decided that I liked this better as a warning than an\r
+ * error. To change back to an error, just change log level\r
+ * to LOG_LEVEL_FATAL.\r
+ */\r
log_error(LOG_LEVEL_ERROR, "Unrecognized directive (%lulu) in "
"configuration file: \"%s\"", hash_string( cmd ), buf);
p = malloc( BUFSIZ );
proxy_args->invocation = strsav( proxy_args->invocation, p );
freez( p );
}
- /*
- * I decided that I liked this better as a warning than an
- * error.
- */
-
- /*
- * configret = 1;
- * return;
- */
continue;
}
}
init_error_log(Argv[0], logfile, debug);
- if (cookiefile)
+ if (permissions_file)
{
- add_loader(load_cookiefile);
+ add_loader(load_permissions_file);
}
if (blockfile)
}
#endif /* def ACL_FILES */
-#ifdef KILLPOPUPS
- if (popupfile)
- {
- add_loader(load_popupfile);
- }
-#endif /* def KILLPOPUPS */
-
#ifdef PCRS
if (re_filterfile)
{
{
if ( NULL == (jar = fopen(jarfile, "a")) )
{
- log_error(LOG_LEVEL_ERROR, "can't open jarfile '%s': %E", jarfile);
- configret = 1;
- return;
+ log_error(LOG_LEVEL_FATAL, "can't open jarfile '%s': %E", jarfile);
+ /* Never get here - LOG_LEVEL_FATAL causes program exit */
}
setbuf(jar, NULL);
}
if (hport <= 0)
{
*--p = ':';
- log_error(LOG_LEVEL_ERROR, "invalid bind port spec %s", haddr);
- configret = 1;
- return;
+ log_error(LOG_LEVEL_FATAL, "invalid bind port spec %s", haddr);
+ /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
}
if (*haddr == '\0')
{
if (run_loader(NULL))
{
- configret = 1;
- return;
+ log_error(LOG_LEVEL_FATAL, "A loader failed while loading config file. Exiting.");\r
+ /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
}
#ifdef JAR_FILES
#ifndef _LOADCFG_H
#define _LOADCFG_H
-#define LOADCFG_H_VERSION "$Id: loadcfg.h,v 1.1.1.1 2001/05/15 13:58:58 oes Exp $"
+#define LOADCFG_H_VERSION "$Id: loadcfg.h,v 1.2 2001/05/17 23:01:01 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loadcfg.h,v $
*
* Revisions :
* $Log: loadcfg.h,v $
+ * Revision 1.2 2001/05/17 23:01:01 oes
+ * - Cleaned CRLF's from the sources and related files
+ *
* Revision 1.1.1.1 2001/05/15 13:58:58 oes
* Initial import of version 2.9.3 source tree
*
#endif /* def ACL_FILES */
extern const char *blockfile;
-extern const char *cookiefile;
+extern const char *permissions_file;
extern const char *forwardfile;
#ifdef USE_IMAGE_LIST
extern const char *imagefile;
#endif /* def USE_IMAGE_LIST */
-#ifdef KILLPOPUPS
-extern const char *popupfile;
-#endif /* def KILLPOPUPS */
-
#ifdef TRUST_FILES
extern const char *trustfile;
#endif /* def TRUST_FILES */
extern const char *re_filterfile;
#endif /* def PCRS */
-#ifdef PCRS
-extern int re_filter_all;
-#endif /* def PCRS */
-
-#ifdef KILLPOPUPS
-extern int kill_all_popups; /* Not recommended really .. */
-#endif /* def KILLPOPUPS */
+extern int default_permissions;\r
#ifdef JAR_FILES
extern const char *jarfile;
extern struct proxy_args proxy_args[1];
-extern int configret;
+extern int configret; /* FIXME: This is obsolete, always 0. */
extern int config_changed;
-const char loaders_rcs[] = "$Id: loaders.c,v 1.1.1.1 2001/05/15 13:58:59 oes Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.2 2001/05/17 23:01:01 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.c,v $
*
* Revisions :
* $Log: loaders.c,v $
+ * Revision 1.2 2001/05/17 23:01:01 oes
+ * - Cleaned CRLF's from the sources and related files
+ *
* Revision 1.1.1.1 2001/05/15 13:58:59 oes
* Initial import of version 2.9.3 source tree
*
#define NLOADERS 8
static int (*loaders[NLOADERS])(struct client_state *);
-
-
+\r
+\r
/*
* Currently active files.
* These are also entered in the main linked list of files.
*/
static struct file_list *current_blockfile = NULL;
-static struct file_list *current_cookiefile = NULL;
+static struct file_list *current_permissions_file = NULL;
static struct file_list *current_forwardfile = NULL;
#ifdef ACL_FILES
static struct file_list *current_imagefile = NULL;
#endif /* def USE_IMAGE_LIST */
-#ifdef KILLPOPUPS
-static struct file_list * current_popupfile = NULL;
-#endif /* def KILLPOPUPS */
-
#ifdef TRUST_FILES
static struct file_list *current_trustfile = NULL;
#endif /* def TRUST_FILES */
#ifdef PCRS
static struct file_list *current_re_filterfile = NULL;
#endif /* def PCRS */
-
+\r
+\r
+static int create_url_spec(struct url_spec * url, char * buf);\r
+\r
/*********************************************************************
*
ncsp->blist->active = 1;
}
- if (ncsp->clist) /* cookie files */
+ if (ncsp->permissions_list) /* permissions files */
{
- ncsp->clist->active = 1;
+ ncsp->permissions_list->active = 1;
}
- /* FIXME: These were left out of the "10" release. Should they be here? */
if (ncsp->flist) /* forward files */
{
ncsp->flist->active = 1;
}
#endif /* def USE_IMAGE_LIST */
-#ifdef KILLPOPUPS
- if (ncsp->plist) /* killpopup files */
- {
- ncsp->plist->active = 1;
- }
-#endif /* def KILLPOPUPS */
-
#ifdef PCRS
if (ncsp->rlist) /* perl re files */
{
}
+/*********************************************************************\r
+ *\r
+ * Function : create_url_spec\r
+ *\r
+ * Description : Creates a "url_spec" structure from a string.\r
+ * When finished, free with unload_url().\r
+ *\r
+ * Parameters :\r
+ * 1 : url = Target url_spec to be filled in. Must be\r
+ * zeroed out before the call (e.g. using zalloc).\r
+ * 2 : buf = Source pattern, null terminated. NOTE: The\r
+ * contents of this buffer are destroyed by this\r
+ * function. If this function succeeds, the\r
+ * buffer is copied to url->spec. If this\r
+ * function fails, the contents of the buffer\r
+ * are lost forever.\r
+ *\r
+ * Returns : 0 => Ok, everything else is an error.\r
+ *\r
+ *********************************************************************/\r
+static int create_url_spec(struct url_spec * url, char * buf)\r
+{\r
+ char *p;\r
+ struct url_spec tmp_url[1];\r
+\r
+ /* paranoia - should never happen. */\r
+ if ((url == NULL) || (buf == NULL))\r
+ {\r
+ return 1;\r
+ }\r
+\r
+ /* save a copy of the orignal specification */\r
+ if ((url->spec = strdup(buf)) == NULL)\r
+ {\r
+ return 1;\r
+ }\r
+\r
+ if ((p = strchr(buf, '/')))\r
+ {\r
+ if (NULL == (url->path = strdup(p)))\r
+ {\r
+ freez(url->spec);\r
+ return 1;\r
+ }\r
+ url->pathlen = strlen(url->path);\r
+ *p = '\0';\r
+ }\r
+ else\r
+ {\r
+ url->path = NULL;\r
+ url->pathlen = 0;\r
+ }\r
+#ifdef REGEX\r
+ if (url->path)\r
+ {\r
+ int errcode;\r
+ char rebuf[BUFSIZ];\r
+\r
+ if (NULL == (url->preg = zalloc(sizeof(*url->preg))))\r
+ {\r
+ freez(url->spec);\r
+ freez(url->path);\r
+ return 1;\r
+ }\r
+\r
+ sprintf(rebuf, "^(%s)", url->path);\r
+\r
+ errcode = regcomp(url->preg, rebuf,\r
+ (REG_EXTENDED|REG_NOSUB|REG_ICASE));\r
+ if (errcode)\r
+ {\r
+ size_t errlen =\r
+ regerror(errcode,\r
+ url->preg, buf, sizeof(buf));\r
+\r
+ buf[errlen] = '\0';\r
+\r
+ log_error(LOG_LEVEL_ERROR, "error compiling %s: %s",\r
+ url->spec, buf);\r
+\r
+ freez(url->spec);\r
+ freez(url->path);\r
+ freez(url->preg);\r
+\r
+ return 1;\r
+ }\r
+ }\r
+#endif\r
+ if ((p = strchr(buf, ':')) == NULL)\r
+ {\r
+ url->port = 0;\r
+ }\r
+ else\r
+ {\r
+ *p++ = '\0';\r
+ url->port = atoi(p);\r
+ }\r
+\r
+ if ((url->domain = strdup(buf)) == NULL)\r
+ {\r
+ freez(url->spec);\r
+ freez(url->path);\r
+#ifdef REGEX\r
+ freez(url->preg);\r
+#endif /* def REGEX */\r
+ return 1;\r
+ }\r
+\r
+ /* split domain into components */\r
+\r
+ *tmp_url = dsplit(url->domain);\r
+ url->dbuf = tmp_url->dbuf;\r
+ url->dcnt = tmp_url->dcnt;\r
+ url->dvec = tmp_url->dvec;\r
+\r
+ return 0; /* OK */\r
+}\r
+\r
+\r
/*********************************************************************
*
* Function : unload_url
/*********************************************************************
*
- * Function : unload_cookiefile
+ * Function : unload_permissions_file
*
- * Description : Unloads a cookiefile.
+ * Description : Unloads a permissions file.
*
* Parameters :
- * 1 : f = the data structure associated with the cookiefile.
+ * 1 : file_data = the data structure associated with the\r
+ * permissions file.
*
* Returns : N/A
*
*********************************************************************/
-static void unload_cookiefile(void *f)
-{
- struct cookie_spec *b = (struct cookie_spec *)f;
- if (b == NULL) return;
-
- unload_cookiefile(b->next);
-
- unload_url(b->url);
-
- freez(b);
+static void unload_permissions_file(void *file_data)
+{\r
+ struct permissions_spec * next;
+ struct permissions_spec * cur = (struct permissions_spec *)file_data;
+ while (cur != NULL)\r
+ {\r
+ next = cur->next;
+ unload_url(cur->url);
+ freez(cur);\r
+ cur = next;\r
+ }
}
#endif /* def PCRS */
-#ifdef KILLPOPUPS
-/*********************************************************************
- *
- * Function : unload_popupfile
- *
- * Description : Free the lists of blocked, and allowed popup sites.
- *
- * Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- *
- * Returns : N/A
- *
- *********************************************************************/
-static void unload_popupfile(void * b)
-{
- struct popup_settings * data = (struct popup_settings *) b;
- struct popup_blocklist * cur = NULL;
- struct popup_blocklist * temp= NULL;
-
- /* Free the blocked list. */
- cur = data->blocked;
- while (cur != NULL)
- {
- temp = cur->next;
- freez (cur->host_name);
- free (cur);
- cur = temp;
- }
- data->blocked = NULL;
-
- /* Free the allowed list. */
- cur = data->allowed;
- while (cur != NULL)
- {
- temp = cur->next;
- freez (cur->host_name);
- free (cur);
- cur = temp;
- }
- data->allowed = NULL;
-
-}
-#endif /* def KILLPOPUPS */
-
-
/*********************************************************************
*
* Function : check_file_changed
* heap, with the filename and lastmodified
* fields filled, standard header giving file
* name in proxy_args, and all others zeroed.
- * (proxy_args is only filled in if
+ * (proxy_args is only filled in if !defined
* SPLIT_PROXY_ARGS and !suppress_blocklists).
*
* Returns : If file unchanged: 0 (and sets newfl == NULL)
p = linebuf + strlen(linebuf) - 1;
/*
- * Note: the (p >= retval) below is paranoia, it's not really needed.
- * When p == retval then ijb_isspace(*p) will be false and we'll drop
+ * Note: the (p >= linebuf) below is paranoia, it's not really needed.
+ * When p == linebuf then ijb_isspace(*p) will be false and we'll drop
* out of the loop.
*/
while ((p >= linebuf) && ijb_isspace(*p))
struct block_spec *b, *bl;
char buf[BUFSIZ], *p, *q;
- int port, reject;
+ int reject;
struct file_list *fs;
- struct url_spec url[1];
if (!check_file_changed(current_blockfile, blockfile, &fs))
{
}
/* allocate a new node */
- if (((b = zalloc(sizeof(*b))) == NULL)
-#ifdef REGEX
- || ((b->url->preg = zalloc(sizeof(*b->url->preg))) == NULL)
-#endif
- )
+ if ((b = zalloc(sizeof(*b))) == NULL)
{
fclose(fp);
goto load_blockfile_error;
b->next = bl->next;
bl->next = b;
- /* save a copy of the orignal specification */
- if ((b->url->spec = strdup(buf)) == NULL)
- {
- fclose(fp);
- goto load_blockfile_error;
- }
-
b->reject = reject;
-
- if ((p = strchr(buf, '/')))
- {
- b->url->path = strdup(p);
- b->url->pathlen = strlen(b->url->path);
- *p = '\0';
- }
- else
- {
- b->url->path = NULL;
- b->url->pathlen = 0;
- }
-#ifdef REGEX
- if (b->url->path)
- {
- int errcode;
- char rebuf[BUFSIZ];
-
- sprintf(rebuf, "^(%s)", b->url->path);
-
- errcode = regcomp(b->url->preg, rebuf,
- (REG_EXTENDED|REG_NOSUB|REG_ICASE));
-
- if (errcode)
- {
- size_t errlen =
- regerror(errcode,
- b->url->preg, buf, sizeof(buf));
-
- buf[errlen] = '\0';
-
- log_error(LOG_LEVEL_ERROR, "error compiling %s: %s\n",
- b->url->spec, buf);
- fclose(fp);
- goto load_blockfile_error;
- }
- }
- else
- {
- freez(b->url->preg);
- }
-#endif
- if ((p = strchr(buf, ':')) == NULL)
- {
- port = 0;
- }
- else
- {
- *p++ = '\0';
- port = atoi(p);
- }
-
- b->url->port = port;
-
- if ((b->url->domain = strdup(buf)) == NULL)
- {
- fclose(fp);
- goto load_blockfile_error;
- }
-
- /* split domain into components */
- *url = dsplit(b->url->domain);
- b->url->dbuf = url->dbuf;
- b->url->dcnt = url->dcnt;
- b->url->dvec = url->dvec;
+\r
+ /* Save the URL pattern */\r
+ if (create_url_spec(b->url, buf))\r
+ {\r
+ fclose(fp);\r
+ goto load_blockfile_error;\r
+ }\r
}
fclose(fp);
struct block_spec *b, *bl;
char buf[BUFSIZ], *p, *q;
- int port, reject;
+ int reject;
struct file_list *fs;
- struct url_spec url[1];
if (!check_file_changed(current_imagefile, imagefile, &fs))
{
}
/* allocate a new node */
- if (((b = zalloc(sizeof(*b))) == NULL)
-#ifdef REGEX
- || ((b->url->preg = zalloc(sizeof(*b->url->preg))) == NULL)
-#endif
- )
+ if ((b = zalloc(sizeof(*b))) == NULL)
{
fclose(fp);
goto load_imagefile_error;
/* add it to the list */
b->next = bl->next;
bl->next = b;
+\r
+ b->reject = reject;\r
- /* save a copy of the orignal specification */
- if ((b->url->spec = strdup(buf)) == NULL)
+ /* Save the URL pattern */\r
+ if (create_url_spec(b->url, buf))\r
{
fclose(fp);
goto load_imagefile_error;
}
-
- b->reject = reject;
-
- if ((p = strchr(buf, '/')))
- {
- b->url->path = strdup(p);
- b->url->pathlen = strlen(b->url->path);
- *p = '\0';
- }
- else
- {
- b->url->path = NULL;
- b->url->pathlen = 0;
- }
-#ifdef REGEX
- if (b->url->path)
- {
- int errcode;
- char rebuf[BUFSIZ];
-
- sprintf(rebuf, "^(%s)", b->url->path);
-
- errcode = regcomp(b->url->preg, rebuf,
- (REG_EXTENDED|REG_NOSUB|REG_ICASE));
-
- if (errcode)
- {
- size_t errlen =
- regerror(errcode,
- b->url->preg, buf, sizeof(buf));
-
- buf[errlen] = '\0';
-
- log_error(LOG_LEVEL_ERROR, "error compiling %s: %s",
- b->url->spec, buf);
- fclose(fp);
- goto load_imagefile_error;
- }
- }
- else
- {
- freez(b->url->preg);
- }
-#endif
- if ((p = strchr(buf, ':')) == NULL)
- {
- port = 0;
- }
- else
- {
- *p++ = '\0';
- port = atoi(p);
- }
-
- b->url->port = port;
-
- if ((b->url->domain = strdup(buf)) == NULL)
- {
- fclose(fp);
- goto load_imagefile_error;
- }
-
- /* split domain into components */
- *url = dsplit(b->url->domain);
- b->url->dbuf = url->dbuf;
- b->url->dcnt = url->dcnt;
- b->url->dvec = url->dvec;
}
-#ifndef SPLIT_PROXY_ARGS
- if (!suppress_blocklists)
- fs->proxy_args = strsav(fs->proxy_args, "</pre>");
-#endif /* ndef SPLIT_PROXY_ARGS */
-
+\r
fclose(fp);
#ifndef SPLIT_PROXY_ARGS
}
#endif /* def USE_IMAGE_LIST */
-
+\r
/*********************************************************************
*
- * Function : load_cookiefile
+ * Function : load_permissions_file
*
- * Description : Read and parse a cookiefile and add to files list.
+ * Description : Read and parse a permissions file and add to files\r
+ * list.
*
* Parameters :
* 1 : csp = Current client state (buffers, headers, etc...)
* Returns : 0 => Ok, everything else is an error.
*
*********************************************************************/
-int load_cookiefile(struct client_state *csp)
+int load_permissions_file(struct client_state *csp)
{
FILE *fp;
- struct cookie_spec *b, *bl;
+ struct permissions_spec *b, *bl;
char buf[BUFSIZ], *p, *q;
- int port, user_cookie, server_cookie;
- struct file_list *fs;
- struct url_spec url[1];
+ int permissions;
+ struct file_list *fs;\r
+ int i;
- if (!check_file_changed(current_cookiefile, cookiefile, &fs))
+ if (!check_file_changed(current_permissions_file, permissions_file, &fs))
{
/* No need to load */
if (csp)
{
- csp->clist = current_cookiefile;
+ csp->permissions_list = current_permissions_file;
}
return(0);
}
if (!fs)
{
- goto load_cookie_error;
+ goto load_permissions_error;
}
- fs->f = bl = (struct cookie_spec *)zalloc(sizeof(*bl));
+ fs->f = bl = (struct permissions_spec *)zalloc(sizeof(*bl));
if (bl == NULL)
{
- goto load_cookie_error;
+ goto load_permissions_error;
}
- if ((fp = fopen(cookiefile, "r")) == NULL)
+ if ((fp = fopen(permissions_file, "r")) == NULL)
{
- goto load_cookie_error;
- }
+ goto load_permissions_error;
+ }\r
+
+\r
+ /*\r
+ * default_permissions is set in this file.\r
+ *\r
+ * Reset it to default first.\r
+ */\r
+ default_permissions = PERMIT_RE_FILTER;\r
while (read_config_line(buf, sizeof(buf), fp, fs) != NULL)
{
- p = buf;
-
- switch ((int)*p)
- {
- case '>':
- server_cookie = 0;
- user_cookie = 1;
- p++;
- break;
+ p = buf;\r
+\r
+ permissions = PERMIT_COOKIE_SET | PERMIT_COOKIE_READ | PERMIT_POPUPS;\r
+\r
+ /*\r
+ * FIXME: for() loop is a kludge. Want to loop around until we\r
+ * find a non-control character. Assume there will be at most 4\r
+ * characters.\r
+ */\r
+ for (i = 0; i < 4; i++)\r
+ {\r
+ switch ((int)*p)
+ {
+ case '>':\r
+ /*\r
+ * Allow cookies to be read by the server, but do\r
+ * not allow them to be set.\r
+ */\r
+ permissions = (permissions & ~PERMIT_COOKIE_SET);
+ p++;
+ break;
- case '<':
- server_cookie = 1;
- user_cookie = 0;
- p++;
- break;
+ case '<':
+ /*\r
+ * Allow server to set cookies but do not let the\r
+ * server read them.\r
+ */\r
+ permissions = (permissions & ~PERMIT_COOKIE_READ);\r
+ p++;
+ break;
- case '~':
- server_cookie = 0;
- user_cookie = 0;
- p++;
- break;
+ case '^':\r
+ /*\r
+ * Block popups\r
+ */\r
+ permissions = (permissions & ~PERMIT_POPUPS);\r
+ p++;\r
+ break;\r
+\r
+ case '%':\r
+ /*\r
+ * Permit filtering using PCRS\r
+ */\r
+ permissions = (permissions | PERMIT_RE_FILTER);\r
+ p++;\r
+ break;\r
+\r
+ case '~':\r
+ /*\r
+ * All of the above (maximum filtering).\r
+ */
+ permissions = PERMIT_RE_FILTER;\r
+ p++;
+ break;
- default:
- server_cookie = 1;
- user_cookie = 1;
- break;
+ default:\r
+ /*\r
+ * FIXME: Should break out of the loop here.\r
+ */
+ break;
+ }\r
}
/*
* front of the pattern
*/
q = buf;
- if (p > q) while ((*q++ = *p++))
- {
- /* nop */
+ if (p > q)\r
+ {\r
+ while ((*q++ = *p++) != '\0')
+ {
+ /* nop */
+ }\r
}
- /* skip lines containing only "special" chars */
+ /* a lines containing only "special" chars sets default */
if (*buf == '\0')
- {
+ {\r
+ default_permissions = permissions;
continue;
}
/* allocate a new node */
if (((b = zalloc(sizeof(*b))) == NULL)
-#ifdef REGEX
- || ((b->url->preg = zalloc(sizeof(*b->url->preg))) == NULL)
-#endif
)
{
fclose(fp);
- goto load_cookie_error;
+ goto load_permissions_error;
}
/* add it to the list */
b->next = bl->next;
bl->next = b;
-
- /* save a copy of the orignal specification */
- if ((b->url->spec = strdup(buf)) == NULL)
- {
- fclose(fp);
- goto load_cookie_error;
- }
-
- b->send_user_cookie = user_cookie;
- b->accept_server_cookie = server_cookie;
-
- if ((p = strchr(buf, '/')))
- {
- b->url->path = strdup(p);
- b->url->pathlen = strlen(b->url->path);
- *p = '\0';
- }
- else
- {
- b->url->path = NULL;
- b->url->pathlen = 0;
- }
-#ifdef REGEX
- if (b->url->path)
- {
- int errcode;
- char rebuf[BUFSIZ];
-
- sprintf(rebuf, "^(%s)", b->url->path);
-
- errcode = regcomp(b->url->preg, rebuf,
- (REG_EXTENDED|REG_NOSUB|REG_ICASE));
- if (errcode)
- {
- size_t errlen =
- regerror(errcode,
- b->url->preg, buf, sizeof(buf));
-
- buf[errlen] = '\0';
-
- log_error(LOG_LEVEL_ERROR, "error compiling %s: %s",
- b->url->spec, buf);
- fclose(fp);
- goto load_cookie_error;
- }
- }
- else
- {
- freez(b->url->preg);
- }
-#endif
- if ((p = strchr(buf, ':')) == NULL)
- {
- port = 0;
- }
- else
- {
- *p++ = '\0';
- port = atoi(p);
- }
-
- b->url->port = port;
-
- if ((b->url->domain = strdup(buf)) == NULL)
- {
+\r
+ /* Save flags */
+ b->permissions = permissions;\r
+\r
+ /* Save the URL pattern */\r
+ if (create_url_spec(b->url, buf))\r
+ {\r
fclose(fp);
- goto load_cookie_error;
+ goto load_permissions_error;
}
-
- /* split domain into components */
-
- *url = dsplit(b->url->domain);
- b->url->dbuf = url->dbuf;
- b->url->dcnt = url->dcnt;
- b->url->dvec = url->dvec;
}
fclose(fp);
#endif /* ndef SPLIT_PROXY_ARGS */
/* the old one is now obsolete */
- if (current_cookiefile)
+ if (current_permissions_file)
{
- current_cookiefile->unloader = unload_cookiefile;
+ current_permissions_file->unloader = unload_permissions_file;
}
fs->next = files->next;
files->next = fs;
- current_cookiefile = fs;
+ current_permissions_file = fs;
if (csp)
{
- csp->clist = fs;
+ csp->permissions_list = fs;
}
return(0);
-load_cookie_error:
- log_error(LOG_LEVEL_ERROR, "can't load cookiefile '%s': %E", cookiefile);
+load_permissions_error:
+ log_error(LOG_LEVEL_ERROR, "can't load permissions file '%s': %E", permissions_file);
return(-1);
}
struct url_spec **tl;
char buf[BUFSIZ], *p, *q;
- int port, reject, trusted;
+ int reject, trusted;
struct file_list *fs;
- struct url_spec url[1];
if (!check_file_changed(current_trustfile, trustfile, &fs))
{
}
/* allocate a new node */
- if (((b = zalloc(sizeof(*b))) == NULL)
-#ifdef REGEX
- || ((b->url->preg = zalloc(sizeof(*b->url->preg))) == NULL)
-#endif
- )
+ if ((b = zalloc(sizeof(*b))) == NULL)
{
fclose(fp);
goto load_trustfile_error;
b->next = bl->next;
bl->next = b;
- /* save a copy of the orignal specification */
- if ((b->url->spec = strdup(buf)) == NULL)
- {
- fclose(fp);
- goto load_trustfile_error;
- }
-
b->reject = reject;
- if ((p = strchr(buf, '/')))
- {
- b->url->path = strdup(p);
- b->url->pathlen = strlen(b->url->path);
- *p = '\0';
- }
- else
- {
- b->url->path = NULL;
- b->url->pathlen = 0;
- }
-#ifdef REGEX
- if (b->url->path)
- {
- int errcode;
- char rebuf[BUFSIZ];
-
- sprintf(rebuf, "^(%s)", b->url->path);
-
- errcode = regcomp(b->url->preg, rebuf,
- (REG_EXTENDED|REG_NOSUB|REG_ICASE));
-
- if (errcode)
- {
- size_t errlen =
- regerror(errcode,
- b->url->preg, buf, sizeof(buf));
-
- buf[errlen] = '\0';
-
- log_error(LOG_LEVEL_ERROR, "error compiling %s: %s",
- b->url->spec, buf);
- fclose(fp);
- goto load_trustfile_error;
- }
- }
- else
- {
- freez(b->url->preg);
- }
-#endif
- if ((p = strchr(buf, ':')) == NULL)
- {
- port = 0;
- }
- else
- {
- *p++ = '\0';
- port = atoi(p);
- }
-
- b->url->port = port;
-
- if ((b->url->domain = strdup(buf)) == NULL)
+ /* Save the URL pattern */\r
+ if (create_url_spec(b->url, buf))\r
{
fclose(fp);
goto load_trustfile_error;
}
- /* split domain into components */
- *url = dsplit(b->url->domain);
- b->url->dbuf = url->dbuf;
- b->url->dcnt = url->dcnt;
- b->url->dvec = url->dvec;
-
/*
* save a pointer to URL's spec in the list of trusted URL's, too
*/
int error;
pcrs_job *dummy;
-#ifndef SPLIT_PROXY_ARGS
- char *p;
-#endif /* ndef SPLIT_PROXY_ARGS */
if (!check_file_changed(current_re_filterfile, re_filterfile, &fs))
{
/* No need to load */
/* We have a meaningful line -> make it a job */
if ((dummy = pcrs_make_job(buf, &error)) == NULL)
{
- log_error(LOG_LEVEL_REF,
+ log_error(LOG_LEVEL_RE_FILTER,
"Adding re_filter job %s failed with error %d.", buf, error);
continue;
}
{
dummy->next = bl->joblist;
bl->joblist = dummy;
- log_error(LOG_LEVEL_REF, "Adding re_filter job %s succeeded.", buf);
+ log_error(LOG_LEVEL_RE_FILTER, "Adding re_filter job %s succeeded.", buf);
}
}
#endif /* def PCRS */
-#ifdef KILLPOPUPS
-/*********************************************************************
- *
- * Function : load_popupfile
- *
- * Description : Load, and parse the popup blocklist.
- *
- * Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- *
- * Returns : 0 => success, else there was an error.
- *
- *********************************************************************/
-int load_popupfile(struct client_state *csp)
-{
- FILE *fp;
- char buf[BUFSIZ], *p, *q;
- struct popup_blocklist *entry = NULL;
- struct popup_settings * data;
- struct file_list *fs;
- p = buf;
- q = buf;
-
- if (!check_file_changed(current_popupfile, popupfile, &fs))
- {
- /* No need to load */
- if (csp)
- {
- csp->plist = current_popupfile;
- }
- return(0);
- }
- if (!fs)
- {
- goto load_popupfile_error;
- }
-
- fs->f = data = (struct popup_settings *)zalloc(sizeof(*data));
- if (data == NULL)
- {
- goto load_popupfile_error;
- }
-
- if ((fp = fopen(popupfile, "r")) == NULL)
- {
- goto load_popupfile_error;
- }
-
- while (read_config_line(buf, sizeof(buf), fp, fs) != NULL)
- {
- entry = (struct popup_blocklist*)zalloc(sizeof(struct popup_blocklist));
- if (!entry)
- {
- fclose( fp );
- goto load_popupfile_error;
- }
-
- /* Handle allowed hosts. */
- if ( *buf == '~' )
- {
- /* Rememeber: skip the tilde */
- entry->host_name = strdup( buf + 1 );
- if (!entry->host_name)
- {
- fclose( fp );
- goto load_popupfile_error;
- }
-
- entry->next = data->allowed;
- data->allowed = entry;
- }
- else
- {
- /* Blocked host */
- entry->host_name = strdup( buf );
- if (!entry->host_name)
- {
- fclose( fp );
- goto load_popupfile_error;
- }
-
- entry->next = data->blocked;
- data->blocked = entry;
- }
- }
-
- fclose( fp );
-
-#ifndef SPLIT_PROXY_ARGS
- if (!suppress_blocklists)
- {
- fs->proxy_args = strsav(fs->proxy_args, "</pre>");
- }
-#endif /* ndef SPLIT_PROXY_ARGS */
-
- /* the old one is now obsolete */
- if ( NULL != current_popupfile )
- {
- current_popupfile->unloader = unload_popupfile;
- }
-
- fs->next = files->next;
- files->next = fs;
- current_popupfile = fs;
-
- if (csp)
- {
- csp->plist = fs;
- }
-
- return( 0 );
-
-load_popupfile_error:
- log_error(LOG_LEVEL_ERROR, "can't load popupfile '%s': %E", popupfile);
- return(-1);
-
-}
-#endif /* def KILLPOPUPS */
-
-
-
/*********************************************************************
*
* Function : add_loader
#ifndef _LOADERS_H
#define _LOADERS_H
-#define LOADERS_H_VERSION "$Id: loaders.h,v 1.1 2001/05/13 21:57:06 administrator Exp $"
+#define LOADERS_H_VERSION "$Id: loaders.h,v 1.1.1.1 2001/05/15 13:59:00 oes Exp $"
/*********************************************************************
*
- * File : $Source: /home/administrator/cvs/ijb/loaders.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/loaders.h,v $
*
* Purpose : Functions to load and unload the various
* configuration files. Also contains code to manage
*
* Revisions :
* $Log: loaders.h,v $
+ * Revision 1.1.1.1 2001/05/15 13:59:00 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
\f
extern char *read_config_line(char *buf, int buflen, FILE *fp, struct file_list *fs);
extern int load_blockfile(struct client_state *csp);
-extern int load_cookiefile(struct client_state *csp);
+extern int load_permissions_file(struct client_state *csp);
extern int load_forwardfile(struct client_state *csp);
#ifdef ACL_FILES
extern int load_imagefile(struct client_state *csp);
#endif /* def USE_IMAGE_LIST */
-#ifdef KILLPOPUPS
-extern int load_popupfile(struct client_state *csp);
-#endif /* def KILLPOPUPS */
-
#ifdef TRUST_FILES
extern int load_trustfile(struct client_state *csp);
#endif /* def TRUST_FILES */
extern int load_re_filterfile(struct client_state *csp);
#endif /* def PCRS */
-#ifdef KILLPOPUPS
-extern int load_popupfile(struct client_state *csp);
-#endif /* def KILLPOPUPS */
-
/* Revision control strings from this header and associated .c file */
extern const char loaders_rcs[];
extern const char loaders_h_rcs[];
-const char parsers_rcs[] = "$Id: parsers.c,v 1.1.1.1 2001/05/15 13:59:01 oes Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.2 2001/05/17 23:02:36 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
*
* Revisions :
* $Log: parsers.c,v $
+ * Revision 1.2 2001/05/17 23:02:36 oes
+ * - Made referrer option accept 'L' as a substitute for '§'
+ *
* Revision 1.1.1.1 2001/05/15 13:59:01 oes
* Initial import of version 2.9.3 source tree
*
const struct parsers server_patterns[] = {
{ "set-cookie:", 11, server_set_cookie },
{ "connection:", 11, crumble },
-#ifdef PCRS
+#if defined(PCRS) || defined(KILLPOPUPS)
{ "Content-Type:", 13, content_type },
{ "Content-Length:", 15, crumble },
-#endif /* def PCRS */
+#endif /* defined(PCRS) || defined(KILLPOPUPS) */
{ NULL, 0, NULL }
};
}
-#ifdef PCRS
+#if defined(PCRS) || defined(KILLPOPUPS)
/*********************************************************************
*
}
-#endif /* def PCRS */
+#endif /* defined(PCRS) || defined(KILLPOPUPS) */
/*********************************************************************
if (*referrer == '@')
{
- if (csp->send_user_cookie)
+ if (csp->permissions & PERMIT_COOKIE_READ)
{
return(strdup(s));
}
if (*referrer == '§' || *referrer == 'L')
{
- if (csp->send_user_cookie)
+ if (csp->permissions & PERMIT_COOKIE_READ)
{
return(strdup(s));
}
if (*uagent == '@')
{
- if (csp->send_user_cookie)
+ if (csp->permissions & PERMIT_COOKIE_READ)
{
return(strdup(s));
}
if (*uagent == '@')
{
- if (csp->send_user_cookie)
+ if (csp->permissions & PERMIT_COOKIE_READ)
{
return(strdup(s));
}
*********************************************************************/
char *client_send_cookie(const struct parsers *v, char *s, struct client_state *csp)
{
- if (csp->send_user_cookie)
+ if (csp->permissions & PERMIT_COOKIE_READ)
{
enlist(csp->cookie_list, s + v->len + 1);
}
}
#endif /* def JAR_FILES */
- if (csp->accept_server_cookie == 0)
+ if (!(csp->permissions & PERMIT_COOKIE_SET))
{
return(crumble(v, s, csp));
}
#ifndef _PARSERS_H
#define _PARSERS_H
-#define PARSERS_H_VERSION "$Id: parsers.h,v 1.1 2001/05/13 21:57:06 administrator Exp $"
+#define PARSERS_H_VERSION "$Id: parsers.h,v 1.1.1.1 2001/05/15 13:59:01 oes Exp $"
/*********************************************************************
*
- * File : $Source: /home/administrator/cvs/ijb/parsers.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/parsers.h,v $
*
* Purpose : Declares functions to parse/crunch headers and pages.
* Functions declared include:
*
* Revisions :
* $Log: parsers.h,v $
+ * Revision 1.1.1.1 2001/05/15 13:59:01 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
\f
extern void client_x_forwarded_adder(struct client_state *csp);
extern char *server_set_cookie(const struct parsers *v, char *s, struct client_state *csp);
-#ifdef PCRS
+#if defined(PCRS) || defined(KILLPOPUPS)
extern char *content_type(const struct parsers *v, char *s, struct client_state *csp);
-#endif /* def PCRS */
+#endif /* defined(PCRS) || defined(KILLPOPUPS) */
#ifdef FORCE_LOAD
char *client_host(const struct parsers *v, char *s, struct client_state *csp);
--- /dev/null
+# Sample permissions file for the Internet Junkbuster 2.9.4
+#
+# For information, see http://ijbswa.sourceforge.net/
+#
+# Empty lines and lines beginning with a # are ignored.
+#
+# Each line has the following format:
+# [flags][domain][:port][/path]
+#
+# There should be no spaces between the components.
+#
+# The domain, port, and path parts make up the pattern used
+# to match URLs. The port part must be a number and must
+# match exactly. The domain part is matched by comparing
+# each sub-domain (between the dots) from right to left.
+# e.g.:
+# - The pattern "com" matches "anything.com"
+# - The pattern "yahoo.com" would match "mail.yahoo.com",
+# "login.yahoo.com", "www.yahoo.com", or "yahoo.com".
+# "*" characters are allowed immediately before a dot or at
+# the end of the domain, and match anything. e.g.:
+# - "microsoft.*" matches "microsoft.com" and "microsoft.net",
+# (and "www.microsoft.com", "office.microsoft.com", etc)
+# but not "microsoft.xyz.com" or "microsoft.co.uk".
+# - "ad*.*.*.*" matches "ad.doubleclick.co.uk"
+# - "*.*click.*.*" is invalid ("*" is not followed by ".")
+#
+# The path part is a prefix match (if JunkBuster was compiled
+# without REGEX), or a POSIX regular expression (if JunkBuster
+# was compiled with REXEX but not PCRE), or a PERL (PCRE)
+# regular expression (if JunkBuster was compiled with the
+# default options). "^" is automatically prepended to the RE
+# before the "/".
+#
+# Flags are:
+# > Allow cookies to be read by the website, but not set.
+# < Allow cookies to be set by the website, but not read.
+# <> Block all cookies.
+# % Enable re_filterfile processing for this site
+# ^ Block popups from this site.
+# ~ Same as all of <>%^
+# (no flags) Allow cookies and popups, don't re_filter.
+#
+# Multiple flags (up to 4) may be specified.
+#
+# If a web page's URL matches the specified pattern, then the
+# flags specified for that site are used. If it matches more
+# than one pattern, then the first match (searching top-to-bottom
+# in this file) is used.
+#
+# If a URL does not match any of the patterns in this file,
+# then the default settings are used. The default can be set
+# by a line in this file which contains flags but no pattern.
+# If this is not specified, then the default is ~
+#
+#
+# EXAMPLES:
+#
+# To permit an entire site to set cookies, simply include its domain name:
+# really-trustyworthy-people.org
+#
+# You can allow cookies out, but stop them coming in:
+# >%^send-user-cookies.com
+#
+# dabs.com requires cookies and popups:
+# %dabs.com
+#
+# Windows Update is fragile, so allow everything:
+# windowsupdate.microsoft.com
+#
+#
+#%^>tvguide.com
+#%^>wired.com/news/
+#%^americanexpress.com
+#%^cnn.com
+#%^www.nytimes.com
+#%^amazon.de
+#%^amazon.co.uk
+#%^slashdot.org
+#%^www.palmgear.com
+#%^onelist.com
+#%^freshmeat.net
+
+# Sites that need cookies
+%^javasoft.com
+%^sun.com
+%^msdn.microsoft.com
+%^sourceforge.net
+%^yahoo.com
+
+# These sites are very complex and require
+# minimal interference.
+office.microsoft.com
+windowsupdate.microsoft.com
+
+# Shopping
+dabs.com
+overclockers.co.uk
+worldpay.com # for quietpc.com
+jungle.com
+scan.co.uk
+
+# Explicitly set default to ~
+~
+
+
+# End of file
+
+++ /dev/null
-#
-# $Id: popup,v 1.1 2001/04/16 21:10:38 rodney Exp $
-#
-# This is the configuration file for blocking Javascript popup windows,
-# it specifies both hosts to block from, and hosts to allow the popups
-# from.
-#
-# The format is the hostname to block, or allow.
-#
-# eg:
-#
-# www.geocities.com # block all popups from geocities.
-#
-# ~www.trusted-host.com # Allow popups from the trusted host domain.
-#
-#
-# If a site is not explicitly blocked popups will be allowed, the
-# "allowable" syntax with "~" exists as a marker that you've explicitly
-# allowed something.
-#
-# Order is not relevant - an allowable entry overrides a blocked entry,
-# e.g.
-# ~myhost.com # Allows myhost.com
-# myhost.com # _Still_ allowed.
-#
-# Steve Kemp
-# ---
-# http://www.tardis.ed.ac.uk/~skx/junk/ for more details.
-#
-#
-
-
-
-# This is for the test page, at http://www.tardis.ed.ac.uk/~skx/junk/
-www.tardis.ed.ac.uk
-
-#
-# Samples, uncomment to use:
-#
-
-# members.tripod.co.uk
-# www.geocities.com
-# ~windowsupdates.microsoft.com
-# ~updates.microsoft.com
\ No newline at end of file
#ifndef _PROJECT_H
#define _PROJECT_H
-#define PROJECT_H_VERSION "$Id: project.h,v 1.1.1.1 2001/05/15 13:59:03 oes Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.2 2001/05/17 23:01:01 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/project.h,v $
*
* Revisions :
* $Log: project.h,v $
+ * Revision 1.2 2001/05/17 23:01:01 oes
+ * - Cleaned CRLF's from the sources and related files
+ *
* Revision 1.1.1.1 2001/05/15 13:59:03 oes
* Initial import of version 2.9.3 source tree
*
struct client_state
{
- int send_user_cookie;
- int accept_server_cookie;
+ int permissions;\r
+ \r
int cfd;
int sfd;
struct list headers[1];
struct list cookie_list[1];
-#ifdef PCRS
+#if defined(PCRS) || defined(KILLPOPUPS)
int is_text;
-#endif /* def PCRS */
+#endif /* defined(PCRS) || defined(KILLPOPUPS) */
char *x_forwarded;
/* files associated with this client */
struct file_list *blist; /* blockfile */
- struct file_list *clist; /* cookiefile */
struct file_list *flist; /* forwardfile */
+ struct file_list *permissions_list;\r
+\r
-#ifdef ACL_FILES
+#ifdef ACL_FILES\r
struct file_list *alist; /* aclfile */
#endif /* def ACL_FILES */
#ifdef USE_IMAGE_LIST
struct file_list *ilist; /* imagefile */
#endif /* def USE_IMAGE_LIST */
-
-#ifdef KILLPOPUPS
- struct file_list *plist; /* kill popup file */
-#endif /* def KILLPOPUPS */
-
+\r
#ifdef PCRS
struct file_list *rlist; /* Perl re_filterfile */
#endif /* def PCRS */
#ifdef TRUST_FILES
struct file_list *tlist; /* trustfile */
#endif /* def TRUST_FILES */
-
+\r
struct client_state *next;
};
struct block_spec
{
struct url_spec url[1];
- int reject;
+ int reject;
struct block_spec *next;
};
-
-
-struct cookie_spec
-{
- struct url_spec url[1];
- int send_user_cookie;
- int accept_server_cookie;
- struct cookie_spec *next;
-};
-
-
+\r
+
+#define PERMIT_COOKIE_SET 0x0001\r
+#define PERMIT_COOKIE_READ 0x0002\r
+#define PERMIT_RE_FILTER 0x0004\r
+#define PERMIT_POPUPS 0x0008\r
+
+struct permissions_spec\r
+{\r
+ struct url_spec url[1];\r
+ int permissions;\r
+ struct permissions_spec * next;\r
+};\r
+\r
struct forward_spec
{
struct url_spec url[1];
pcrs_job *joblist;
};
#endif /* def PCRS */
-
-
-#ifdef KILLPOPUPS
-/* Entries on popup blocklist */
-struct popup_blocklist
-{
- char *host_name;
- struct popup_blocklist *next;
-};
-
-/* Actual type used in file object */
-struct popup_settings
-{
- struct popup_blocklist *blocked;
- struct popup_blocklist *allowed;
-};
-#endif /* def KILLPOPUPS */
+\r
#ifdef ACL_FILES
#define ACL_PERMIT 1 /* accept connection request */
-const char showargs_rcs[] = "$Id: showargs.c,v 1.1.1.1 2001/05/15 13:59:03 oes Exp $";
+const char showargs_rcs[] = "$Id: showargs.c,v 1.2 2001/05/17 23:01:01 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/showargs.c,v $
*
* Revisions :
* $Log: showargs.c,v $
+ * Revision 1.2 2001/05/17 23:01:01 oes
+ * - Cleaned CRLF's from the sources and related files
+ *
* Revision 1.1.1.1 2001/05/15 13:59:03 oes
* Initial import of version 2.9.3 source tree
*
{
if ((p = realloc(old, new_len)) == NULL)
{
- log_error(LOG_LEVEL_ERROR, "realloc(%d) bytes for proxy_args failed!", new_len);
- exit(1);
+ log_error(LOG_LEVEL_FATAL, "realloc(%d) bytes for proxy_args failed!", new_len);
+ /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
}
}
else
{
if ((p = (char *)malloc(new_len)) == NULL)
{
- log_error(LOG_LEVEL_ERROR, "malloc(%d) bytes for proxy_args failed!", new_len);
- exit(1);
+ log_error(LOG_LEVEL_FATAL, "malloc(%d) bytes for proxy_args failed!", new_len);
+ /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
}
}
/*********************************************************************\r
*\r
- * File : $Source: $\r
+ * File : $Source: /cvsroot/ijbswa/current/w32.rc,v $\r
*\r
* Purpose : Windows GUI resource script.\r
*\r
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
*\r
* Revisions :\r
- * $Log:$\r
+ * $Log: w32.rc,v $
+ * Revision 1.1.1.1 2001/05/15 13:59:07 oes
+ * Initial import of version 2.9.3 source tree
+ *\r
*\r
*********************************************************************/\r
\r
MENUITEM "&Junkbuster...", ID_TOOLS_EDITJUNKBUSTER\r
MENUITEM SEPARATOR\r
MENUITEM "&Blockers...", ID_TOOLS_EDITBLOCKERS\r
- MENUITEM "&Cookies...", ID_TOOLS_EDITCOOKIES\r
+ MENUITEM "&Permissions...", ID_TOOLS_EDITPERMISSIONS\r
MENUITEM "&Forward...", ID_TOOLS_EDITFORWARD\r
#ifdef ACL_FILES\r
MENUITEM "&Access Control Lists...", ID_TOOLS_EDITACLS\r
#ifdef USE_IMAGE_LIST\r
MENUITEM "&Images...", ID_TOOLS_EDITIMAGE\r
#endif /* def USE_IMAGE_LIST */\r
-#ifdef KILLPOPUPS\r
- MENUITEM "&Popups...", ID_TOOLS_EDITPOPUPS\r
-#endif /* def KILLPOPUPS */\r
#ifdef PCRS\r
MENUITEM "Perl &Regexps...", ID_TOOLS_EDITPERLRE\r
#endif /* def PCRS */\r
MENUITEM "&Junkbuster...", ID_TOOLS_EDITJUNKBUSTER\r
MENUITEM SEPARATOR\r
MENUITEM "&Blockers...", ID_TOOLS_EDITBLOCKERS\r
- MENUITEM "&Cookies...", ID_TOOLS_EDITCOOKIES\r
+ MENUITEM "&Permissions...", ID_TOOLS_EDITPERMISSIONS\r
MENUITEM "&Forward...", ID_TOOLS_EDITFORWARD\r
#ifdef ACL_FILES\r
MENUITEM "&Access Control Lists...",ID_TOOLS_EDITACLS\r
#ifdef USE_IMAGE_LIST\r
MENUITEM "&Images...", ID_TOOLS_EDITIMAGE\r
#endif /* def USE_IMAGE_LIST */\r
-#ifdef KILLPOPUPS\r
- MENUITEM "&Popups...", ID_TOOLS_EDITPOPUPS\r
-#endif /* def KILLPOPUPS */\r
#ifdef PCRS\r
MENUITEM "Perl &Regexps...", ID_TOOLS_EDITPERLRE\r
#endif /* def PCRS */\r
-const char w32log_rcs[] = "$Id: w32log.c,v 1.1 2001/05/13 21:57:07 administrator Exp $";
+const char w32log_rcs[] = "$Id: w32log.c,v 1.1.1.1 2001/05/15 13:59:07 oes Exp $";
/*********************************************************************
*
- * File : $Source: /home/administrator/cvs/ijb/w32log.c,v $
+ * File : $Source: /cvsroot/ijbswa/current/w32log.c,v $
*
* Purpose : Functions for creating and destroying the log window,
* ouputting strings, processing messages and so on.
*
* Revisions :
* $Log: w32log.c,v $
+ * Revision 1.1.1.1 2001/05/15 13:59:07 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
\f
EditFile(blockfile);
break;
- case ID_TOOLS_EDITCOOKIES:
- EditFile(cookiefile);
+ case ID_TOOLS_EDITPERMISSIONS:
+ EditFile(permissions_file);
break;
case ID_TOOLS_EDITFORWARD:
break;
#endif
-#ifdef KILLPOPUPS
- case ID_TOOLS_EDITPOPUPS:
- EditFile(popupfile);
- break;
-#endif /* def KILLPOPUPS */
-
#ifdef TRUST_FILES
case ID_TOOLS_EDITTRUST:
EditFile(trustfile);
void OnLogInitMenu(HMENU hmenu)
{
/* Only enable editors if there is a file to edit */
- EnableMenuItem(hmenu, ID_TOOLS_EDITCOOKIES, MF_BYCOMMAND | (cookiefile ? MF_ENABLED : MF_GRAYED));
+ EnableMenuItem(hmenu, ID_TOOLS_EDITPERMISSIONS, MF_BYCOMMAND | (permissions_file ? MF_ENABLED : MF_GRAYED));
EnableMenuItem(hmenu, ID_TOOLS_EDITBLOCKERS, MF_BYCOMMAND | (blockfile ? MF_ENABLED : MF_GRAYED));
EnableMenuItem(hmenu, ID_TOOLS_EDITFORWARD, MF_BYCOMMAND | (forwardfile ? MF_ENABLED : MF_GRAYED));
#ifdef ACL_FILES
#ifdef USE_IMAGE_LIST
EnableMenuItem(hmenu, ID_TOOLS_EDITIMAGE, MF_BYCOMMAND | (imagefile ? MF_ENABLED : MF_GRAYED));
#endif /* def USE_IMAGE_LIST */
-#ifdef KILLPOPUPS
- EnableMenuItem(hmenu, ID_TOOLS_EDITPOPUPS, MF_BYCOMMAND | (popupfile ? MF_ENABLED : MF_GRAYED));
-#endif /* def KILLPOPUPS */
#ifdef PCRS
EnableMenuItem(hmenu, ID_TOOLS_EDITPERLRE, MF_BYCOMMAND | (re_filterfile ? MF_ENABLED : MF_GRAYED));
#endif
#ifndef _W32RES_H
#define _W32RES_H
-#define W32RES_H_VERSION "$Id: w32res.h,v 1.1 2001/05/13 21:57:07 administrator Exp $"
+#define W32RES_H_VERSION "$Id: w32res.h,v 1.1.1.1 2001/05/15 13:59:08 oes Exp $"
/*********************************************************************
*
- * File : $Source: /home/administrator/cvs/ijb/w32res.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/w32res.h,v $
*
* Purpose : Identifiers for Windows GUI resources.
*
*
* Revisions :
* $Log: w32res.h,v $
+ * Revision 1.1.1.1 2001/05/15 13:59:08 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
/* Break these out so they are easier to extend, but keep consecutive */
#define ID_TOOLS_EDITJUNKBUSTER 5000
#define ID_TOOLS_EDITBLOCKERS 5001
-#define ID_TOOLS_EDITCOOKIES 5002
+#define ID_TOOLS_EDITPERMISSIONS 5002
#define ID_TOOLS_EDITFORWARD 5003
#ifdef ACL_FILES
#define ID_TOOLS_EDITIMAGE 5006
#endif /* def USE_IMAGE_LIST */
-#ifdef KILLPOPUPS
-#define ID_TOOLS_EDITPOPUPS 5007
-#endif /* def KILLPOPUPS */
-
#ifdef PCRS
#define ID_TOOLS_EDITPERLRE 5008
#endif /* def PCRS */