X-Git-Url: http://www.privoxy.org/gitweb/%40user-manual%40%40actions-help-prefix%40HIDE-IF-MODIFIED-SINCE?a=blobdiff_plain;f=loadcfg.c;h=d92dfa1983ca7efa9e40cb3cc4bbf824779c7f3f;hb=5e64295a7ed3662f734abfb34d50a0f1a9dc5377;hp=82bd91638b8428e983c538ebf31d62ad437b5fa6;hpb=43da0ce639b1cf540198b2f63e790d9127725343;p=privoxy.git diff --git a/loadcfg.c b/loadcfg.c index 82bd9163..d92dfa19 100644 --- a/loadcfg.c +++ b/loadcfg.c @@ -1,4 +1,4 @@ -const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.5 2001/05/25 22:34:30 jongfoster Exp $"; +const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.12 2001/06/05 20:04:09 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $ @@ -35,6 +35,110 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.5 2001/05/25 22:34:30 jongfoster * * Revisions : * $Log: loadcfg.c,v $ + * Revision 1.12 2001/06/05 20:04:09 jongfoster + * Now uses _snprintf() in place of snprintf() under Win32. + * + * Revision 1.11 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.10 2001/06/03 19:11:54 oes + * introduced confdir option + * + * Revision 1.10 2001/06/03 11:03:48 oes + * Makefile/in + * + * introduced cgi.c + * + * actions.c: + * + * adapted to new enlist_unique arg format + * + * conf loadcfg.c + * + * introduced confdir option + * + * filters.c filtrers.h + * + * extracted-CGI relevant stuff + * + * jbsockets.c + * + * filled comment + * + * jcc.c + * + * support for new cgi mechansim + * + * list.c list.h + * + * functions for new list type: "map" + * extended enlist_unique + * + * miscutil.c .h + * introduced bindup() + * + * parsers.c parsers.h + * + * deleted const struct interceptors + * + * pcrs.c + * added FIXME + * + * project.h + * + * added struct map + * added struct http_response + * changes struct interceptors to struct cgi_dispatcher + * moved HTML stuff to cgi.h + * + * re_filterfile: + * + * changed + * + * showargs.c + * NO TIME LEFT + * + * Revision 1.9 2001/06/01 20:06:24 jongfoster + * Removed support for "tinygif" option - moved to actions file. + * + * Revision 1.8 2001/05/31 21:27:13 jongfoster + * Removed many options from the config file and into the + * "actions" file: add_forwarded, suppress_vanilla_wafer, + * wafer, add_header, user_agent, referer, from + * Also globally replaced "permission" with "action". + * + * Revision 1.7 2001/05/29 09:50:24 jongfoster + * Unified blocklist/imagelist/permissionslist. + * File format is still under discussion, but the internal changes + * are (mostly) done. + * + * Also modified interceptor behaviour: + * - We now intercept all URLs beginning with one of the following + * prefixes (and *only* these prefixes): + * * http://i.j.b/ + * * http://ijbswa.sf.net/config/ + * * http://ijbswa.sourceforge.net/config/ + * - New interceptors "home page" - go to http://i.j.b/ to see it. + * - Internal changes so that intercepted and fast redirect pages + * are not replaced with an image. + * - Interceptors now have the option to send a binary page direct + * to the client. (i.e. ijb-send-banner uses this) + * - Implemented show-url-info interceptor. (Which is why I needed + * the above interceptors changes - a typical URL is + * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif". + * The previous mechanism would not have intercepted that, and + * if it had been intercepted then it then it would have replaced + * it with an image.) + * + * Revision 1.6 2001/05/26 00:28:36 jongfoster + * Automatic reloading of config file. + * Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32). + * Most of the global variables have been moved to a new + * struct configuration_spec, accessed through csp->config->globalname + * Most of the globals remaining are used by the Win32 GUI. + * * Revision 1.5 2001/05/25 22:34:30 jongfoster * Hard tabs->Spaces * @@ -131,6 +235,9 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.5 2001/05/25 22:34:30 jongfoster # include "w32log.h" # endif /* ndef _WIN_CONSOLE */ +/* VC++ has "_snprintf", not "snprintf" */ +#define snprintf _snprintf + #else /* ifndef _WIN32 */ # include @@ -142,6 +249,7 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.5 2001/05/25 22:34:30 jongfoster #endif #include "loadcfg.h" +#include "list.h" #include "jcc.h" #include "filters.h" #include "loaders.h" @@ -166,15 +274,6 @@ 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)) -static const char VANILLA_WAFER[] = - "NOTICE=TO_WHOM_IT_MAY_CONCERN_" - "Do_not_send_me_any_copyrighted_information_other_than_the_" - "document_that_I_am_requesting_or_any_of_its_necessary_components._" - "In_particular_do_not_send_me_any_cookies_that_" - "are_subject_to_a_claim_of_copyright_by_anybody._" - "Take_notice_that_I_refuse_to_be_bound_by_any_license_condition_" - "(copyright_or_otherwise)_applying_to_any_cookie._"; - #ifdef TOGGLE /* by haroon - indicates if ijb is enabled */ int g_bToggleIJB = 1; /* JunkBusters is enabled by default. */ @@ -203,44 +302,34 @@ static struct file_list *current_configfile = NULL; * config file and read the number from the error message in the log). */ -#define hash_trustfile 56494766ul -#define hash_trust_info_url 449869467ul -#define hash_debug 78263ul -#define hash_tinygif 2227702ul -#define hash_add_forwarded_header 3191044770ul -#define hash_single_threaded 4250084780ul -#define hash_suppress_vanilla_wafer 3121233547ul -#define hash_wafer 89669ul -#define hash_add_header 237434619ul -#define hash_permissions_file 3825730796lu /* "permissionsfile" */ -#define hash_logfile 2114766ul -#define hash_blockfile 48845391ul -#define hash_imagefile 51447891ul -#define hash_jarfile 2046641ul -#define hash_listen_address 1255650842ul + +#define hash_aclfile 1908516ul +#define hash_actions_file 3825730796ul /* FIXME "permissionsfile" */ +#define hash_debug 78263ul +#define hash_confdir 1978389lu +#define hash_logdir 422889lu #define hash_forwardfile 1268669141ul -#define hash_aclfile 1908516ul +#define hash_jarfile 2046641ul +#define hash_listen_address 1255650842ul +#define hash_logfile 2114766ul #define hash_re_filterfile 3877522444ul -#define hash_user_agent 283326691ul -#define hash_referrer 10883969ul -#define hash_referer 2176719ul -#define hash_from 16264ul -#define hash_fast_redirects 464873764lu -#define hash_hide_console 2048809870ul -#define hash_include_stats 2174146548ul +#define hash_single_threaded 4250084780ul #define hash_suppress_blocklists 1948693308ul -#define hash_toggle 447966ul +#define hash_toggle 447966ul +#define hash_trust_info_url 449869467ul +#define hash_trustfile 56494766ul + +#define hash_hide_console 2048809870ul #define hash_activity_animation 1817904738ul -#define hash_log_messages 2291744899ul -#define hash_log_highlight_messages 4032101240ul +#define hash_close_button_minimizes 3651284693ul #define hash_log_buffer_size 2918070425ul -#define hash_log_max_lines 2868344173ul #define hash_log_font_name 2866730124ul #define hash_log_font_size 2866731014ul -#define hash_show_on_task_bar 215410365ul -#define hash_close_button_minimizes 3651284693ul - +#define hash_log_highlight_messages 4032101240ul +#define hash_log_max_lines 2868344173ul +#define hash_log_messages 2291744899ul +#define hash_show_on_task_bar 215410365ul /********************************************************************* @@ -266,28 +355,20 @@ void unload_configfile (void * data) config->jar = NULL; } #endif /* def JAR_FILES */ -#if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) - freez((char *)config->tinygifurl); -#endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */ - freez((char *)config->from); + freez((char *)config->confdir); + freez((char *)config->logdir); + freez((char *)config->haddr); - freez((char *)config->uagent); - freez((char *)config->referrer); freez((char *)config->logfile); - freez((char *)config->blockfile); - freez((char *)config->permissions_file); + freez((char *)config->actions_file); freez((char *)config->forwardfile); #ifdef ACL_FILES freez((char *)config->aclfile); #endif /* def ACL_FILES */ -#ifdef USE_IMAGE_LIST - freez((char *)config->imagefile); -#endif /* def USE_IMAGE_LIST */ - #ifdef JAR_FILES freez((char *)config->jarfile); #endif /* def JAR_FILES */ @@ -322,9 +403,7 @@ struct configuration_spec * load_config(void) char *p, *q; FILE *configfp = NULL; struct configuration_spec * config = NULL; - int suppress_vanilla_wafer; struct client_state * fake_csp; - struct file_list *fs; if (!check_file_changed(current_configfile, configfile, &fs)) @@ -372,7 +451,6 @@ struct configuration_spec * load_config(void) */ config->multi_threaded = 1; - config->default_permissions = PERMIT_RE_FILTER; config->hport = HADDR_PORT; if ((configfp = fopen(configfile, "r")) == NULL) @@ -432,7 +510,7 @@ struct configuration_spec * load_config(void) #ifdef TRUST_FILES case hash_trustfile : freez((char *)config->trustfile); - config->trustfile = strdup(arg); + config->trustfile = make_path(config->confdir, arg); continue; case hash_trust_info_url : @@ -444,87 +522,34 @@ struct configuration_spec * load_config(void) config->debug |= atoi(arg); continue; -#if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) - case hash_tinygif : - freez((char *)config->tinygifurl); - config->tinygif = atoi(arg); - if(3 == config->tinygif) - { - p = arg; - while((*p >= '0') && (*p <= '9')) - { - p++; - } - while((*p == ' ') || (*p == '\t')) - { - p++; - } - if (*p) - { - q = malloc(strlen(p) + 5); - if (q) - { - strcpy(q, p); - strcat(q, "\r\n\r\n"); - config->tinygifurl = q; - } - } - } - if ((config->tinygif != 1) && - (config->tinygif != 2) && - ((config->tinygif != 3) || (config->tinygifurl==NULL)) ) - { - log_error(LOG_LEVEL_ERROR, "tinygif setting invalid."); - } - continue; -#endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */ + case hash_confdir : + freez((char *)config->confdir); + config->confdir = strdup(arg); + continue; - case hash_add_forwarded_header : - config->add_forwarded = 1; - continue; + case hash_logdir : + freez((char *)config->logdir); + config->logdir = strdup(arg); + continue; case hash_single_threaded : config->multi_threaded = 0; continue; - case hash_suppress_vanilla_wafer : - suppress_vanilla_wafer = 1; - continue; - - case hash_wafer : - enlist(config->wafer_list, arg); - continue; - - case hash_add_header : - enlist(config->xtra_list, arg); - continue; - - case hash_permissions_file : - freez((char *)config->permissions_file); - config->permissions_file = strdup(arg); + case hash_actions_file : + freez((char *)config->actions_file); + config->actions_file = make_path(config->confdir, arg); continue; case hash_logfile : freez((char *)config->logfile); - config->logfile = strdup(arg); - continue; - - case hash_blockfile : - freez((char *)config->blockfile); - config->blockfile = strdup(arg); + config->logfile = make_path(config->logdir, arg); continue; -#ifdef USE_IMAGE_LIST - case hash_imagefile : - freez((char *)config->imagefile); - config->imagefile = strdup(arg); - continue; -#endif /* def USE_IMAGE_LIST */ - #ifdef JAR_FILES case hash_jarfile : freez((char *)config->jarfile); - config->jarfile = strdup(arg); + config->jarfile = make_path(config->logdir, arg); continue; #endif /* def JAR_FILES */ @@ -535,13 +560,13 @@ struct configuration_spec * load_config(void) case hash_forwardfile : freez((char *)config->forwardfile); - config->forwardfile = strdup(arg); + config->forwardfile = make_path(config->confdir, arg); continue; #ifdef ACL_FILES case hash_aclfile : freez((char *)config->aclfile); - config->aclfile = strdup(arg); + config->aclfile = make_path(config->confdir, arg); continue; #endif /* def ACL_FILES */ @@ -552,32 +577,6 @@ struct configuration_spec * load_config(void) continue; #endif /* def PCRS */ - case hash_user_agent : - freez((char *)config->uagent); - config->uagent = strdup(arg); - continue; - - /* - * Offer choice of correct spelling according to dictionary, - * or the misspelling used in the HTTP spec. - */ - case hash_referrer : - case hash_referer : - freez((char *)config->referrer); - config->referrer = strdup(arg); - continue; - - case hash_from : - freez((char *)config->from); - config->from = strdup(arg); - continue; - -#ifdef FAST_REDIRECTS - case hash_fast_redirects : - config->fast_redirects = 1; - continue; -#endif /* def FAST_REDIRECTS */ - #ifdef _WIN_CONSOLE case hash_hide_console : hideConsole = 1; @@ -646,9 +645,6 @@ struct configuration_spec * load_config(void) /* Warnings about unsupported features */ -#ifndef USE_IMAGE_LIST - case hash_imagefile : -#endif /* ndef USE_IMAGE_LIST */ #ifndef PCRS case hash_re_filterfile : #endif /* ndef PCRS */ @@ -669,18 +665,12 @@ struct configuration_spec * load_config(void) #ifndef _WIN_CONSOLE case hash_hide_console : #endif /* ndef _WIN_CONSOLE */ -#if !defined(DETECT_MSIE_IMAGES) && !defined(USE_IMAGE_LIST) - case hash_tinygif : -#endif /* !defined(DETECT_MSIE_IMAGES) && !defined(USE_IMAGE_LIST) */ #ifndef JAR_FILES case hash_jarfile : #endif /* ndef JAR_FILES */ #ifndef ACL_FILES case hash_aclfile : #endif /* ndef ACL_FILES */ -#ifndef FAST_REDIRECTS - case hash_fast_redirects : -#endif /* ndef FAST_REDIRECTS */ #ifdef SPLIT_PROXY_ARGS case hash_suppress_blocklists : #endif /* def SPLIT_PROXY_ARGS */ @@ -699,7 +689,7 @@ struct configuration_spec * load_config(void) if (p != NULL) { sprintf( p, "
\nWARNING: unrecognized directive : %s

\n", buf ); - config->proxy_args->invocation = strsav( config->proxy_args->invocation, p ); + config->proxy_args_invocation = strsav( config->proxy_args_invocation, p ); freez( p ); } continue; @@ -710,23 +700,11 @@ struct configuration_spec * load_config(void) init_error_log(Argv[0], config->logfile, config->debug); - if (config->permissions_file) + if (config->actions_file) { - add_loader(load_permissions_file, config); + add_loader(load_actions_file, config); } - if (config->blockfile) - { - add_loader(load_blockfile, config); - } - -#ifdef USE_IMAGE_LIST - if (config->imagefile) - { - add_loader(load_imagefile, config); - } -#endif /* def USE_IMAGE_LIST */ - if (config->forwardfile) { add_loader(load_forwardfile, config); @@ -745,13 +723,13 @@ struct configuration_spec * load_config(void) add_loader(load_re_filterfile, config); } #endif /* def PCRS */ - -#ifdef TRUST_FILES - if (config->trustfile) - { - add_loader(load_trustfile, config); - } -#endif + +#ifdef TRUST_FILES + if (config->trustfile) + { + add_loader(load_trustfile, config); + } +#endif #ifdef JAR_FILES if ( NULL != config->jarfile ) @@ -809,22 +787,6 @@ struct configuration_spec * load_config(void) } freez(fake_csp); -#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 ((config->jarfile != NULL) - && (config->wafer_list->next == NULL) - && (suppress_vanilla_wafer == 0)) - { - enlist(config->wafer_list, VANILLA_WAFER); - } -#endif /* def JAR_FILES */ - - end_proxy_args(config); - #ifndef SPLIT_PROXY_ARGS if (!suppress_blocklists) { @@ -835,21 +797,17 @@ struct configuration_spec * load_config(void) /* FIXME: this is a kludge for win32 */ #if defined(_WIN32) && !defined (_WIN_CONSOLE) - g_blockfile = config->blockfile; - g_permissions_file = config->permissions_file; + g_actions_file = config->actions_file; g_forwardfile = config->forwardfile; #ifdef ACL_FILES g_aclfile = config->aclfile; #endif /* def ACL_FILES */ -#ifdef USE_IMAGE_LIST - g_imagefile = config->imagefile; -#endif /* def USE_IMAGE_LIST */ -#ifdef PCRS - g_re_filterfile = config->re_filterfile; -#endif -#ifdef TRUST_FILES - g_trustfile = config->trustfile; -#endif +#ifdef PCRS + g_re_filterfile = config->re_filterfile; +#endif +#ifdef TRUST_FILES + g_trustfile = config->trustfile; +#endif #endif /* defined(_WIN32) && !defined (_WIN_CONSOLE) */