-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