X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=loadcfg.c;h=7593f0fe113913c8bfe7db06b19a337b20265cf9;hb=439046b4f88535a962b4d7333bfbb16fd563fc7e;hp=eb24cd62a0db210354908d0121fc9d51f06cd944;hpb=d8982e3498262713258ac2208c71a03af8de2061;p=privoxy.git
diff --git a/loadcfg.c b/loadcfg.c
index eb24cd62..7593f0fe 100644
--- a/loadcfg.c
+++ b/loadcfg.c
@@ -1,4 +1,4 @@
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.50 2006/07/18 14:48:46 david__schmidt Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.61 2007/03/16 16:47:35 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
@@ -8,7 +8,7 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.50 2006/07/18 14:48:46 david__sch
* routine to load the configuration and the global
* variables it writes to.
*
- * Copyright : Written by and Copyright (C) 2001 the SourceForge
+ * Copyright : Written by and Copyright (C) 2001-2007 the SourceForge
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
@@ -35,6 +35,60 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.50 2006/07/18 14:48:46 david__sch
*
* Revisions :
* $Log: loadcfg.c,v $
+ * Revision 1.61 2007/03/16 16:47:35 fabiankeil
+ * - Mention other reasons why acl directive loading might have failed.
+ * - Don't log the acl source if the acl destination is to blame.
+ *
+ * Revision 1.60 2007/01/27 13:09:16 fabiankeil
+ * Add new config option "templdir" to
+ * change the templates directory.
+ *
+ * Revision 1.59 2006/12/31 17:56:38 fabiankeil
+ * Added config option accept-intercepted-requests
+ * and disabled it by default.
+ *
+ * Revision 1.58 2006/12/31 14:24:29 fabiankeil
+ * Fix gcc43 compiler warnings.
+ *
+ * Revision 1.57 2006/12/21 12:57:48 fabiankeil
+ * Add config option "split-large-forms"
+ * to work around the browser bug reported
+ * in BR #1570678.
+ *
+ * Revision 1.56 2006/12/17 17:04:51 fabiankeil
+ * Move the
in the generated HTML for the config
+ * options from the beginning of the string to its end.
+ * Keeps the white space in balance.
+ *
+ * Revision 1.55 2006/11/28 15:31:52 fabiankeil
+ * Fix memory leak in case of config file reloads.
+ *
+ * Revision 1.54 2006/10/21 16:04:22 fabiankeil
+ * Modified kludge for win32 to make ming32 menu
+ * "Options/Edit Filters" (sort of) work again.
+ * Same limitations as for the action files apply.
+ * Fixes BR 1567373.
+ *
+ * Revision 1.53 2006/09/06 18:45:03 fabiankeil
+ * Incorporate modified version of Roland Rosenfeld's patch to
+ * optionally access the user-manual via Privoxy. Closes patch 679075.
+ *
+ * Formatting changed to Privoxy style, added call to
+ * cgi_error_no_template if the requested file doesn't
+ * exist and modified check whether or not Privoxy itself
+ * should serve the manual. Should work cross-platform now.
+ *
+ * Revision 1.52 2006/09/06 10:43:32 fabiankeil
+ * Added config option enable-remote-http-toggle
+ * to specify if Privoxy should recognize special
+ * headers (currently only X-Filter) to change its
+ * behaviour. Disabled by default.
+ *
+ * Revision 1.51 2006/09/06 09:23:37 fabiankeil
+ * Make number of retries in case of forwarded-connect problems
+ * a config file option (forwarded-connect-retries) and use 0 as
+ * default.
+ *
* Revision 1.50 2006/07/18 14:48:46 david__schmidt
* Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
* with what was really the latest development (the v_3_0_branch branch)
@@ -426,41 +480,46 @@ static struct file_list *current_configfile = NULL;
* console and GUI specific options last).
*/
-#define hash_actions_file 1196306641ul /* "actionsfile" */
-#define hash_admin_address 4112573064ul /* "admin-address" */
-#define hash_buffer_limit 1881726070ul /* "buffer-limit */
-#define hash_confdir 1978389ul /* "confdir" */
-#define hash_debug 78263ul /* "debug" */
-#define hash_deny_access 1227333715ul /* "deny-access" */
-#define hash_enable_edit_actions 2517097536ul /* "enable-edit-actions" */
-#define hash_enable_remote_toggle 2979744683ul /* "enable-remote-toggle" */
-#define hash_filterfile 250887266ul /* "filterfile" */
-#define hash_forward 2029845ul /* "forward" */
-#define hash_forward_socks4 3963965521ul /* "forward-socks4" */
-#define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */
-#define hash_forwarded_connect_retries 101465292ul /* "forwarded-connect-retries" */
-#define hash_jarfile 2046641ul /* "jarfile" */
-#define hash_listen_address 1255650842ul /* "listen-address" */
-#define hash_logdir 422889ul /* "logdir" */
-#define hash_logfile 2114766ul /* "logfile" */
-#define hash_permit_access 3587953268ul /* "permit-access" */
-#define hash_proxy_info_url 3903079059ul /* "proxy-info-url" */
-#define hash_single_threaded 4250084780ul /* "single-threaded" */
-#define hash_suppress_blocklists 1948693308ul /* "suppress-blocklists" */
-#define hash_toggle 447966ul /* "toggle" */
-#define hash_trust_info_url 430331967ul /* "trust-info-url" */
-#define hash_trustfile 56494766ul /* "trustfile" */
-#define hash_usermanual 1416668518ul /* "user-manual" */
-#define hash_activity_animation 1817904738ul /* "activity-animation" */
-#define hash_close_button_minimizes 3651284693ul /* "close-button-minimizes" */
-#define hash_hide_console 2048809870ul /* "hide-console" */
-#define hash_log_buffer_size 2918070425ul /* "log-buffer-size" */
-#define hash_log_font_name 2866730124ul /* "log-font-name" */
-#define hash_log_font_size 2866731014ul /* "log-font-size" */
-#define hash_log_highlight_messages 4032101240ul /* "log-highlight-messages" */
-#define hash_log_max_lines 2868344173ul /* "log-max-lines" */
-#define hash_log_messages 2291744899ul /* "log-messages" */
-#define hash_show_on_task_bar 215410365ul /* "show-on-task-bar" */
+#define hash_actions_file 1196306641ul /* "actionsfile" */
+#define hash_accept_intercepted_requests 1513024973ul /* "accept-intercepted-requests" */
+#define hash_admin_address 4112573064ul /* "admin-address" */
+#define hash_buffer_limit 1881726070ul /* "buffer-limit */
+#define hash_confdir 1978389ul /* "confdir" */
+#define hash_debug 78263ul /* "debug" */
+#define hash_deny_access 1227333715ul /* "deny-access" */
+#define hash_enable_edit_actions 2517097536ul /* "enable-edit-actions" */
+#define hash_enable_remote_toggle 2979744683ul /* "enable-remote-toggle" */
+#define hash_enable_remote_http_toggle 110543988ul /* "enable-remote-http-toggle" */
+#define hash_enforce_blocks 1862427469ul /* "enforce-blocks" */
+#define hash_filterfile 250887266ul /* "filterfile" */
+#define hash_forward 2029845ul /* "forward" */
+#define hash_forward_socks4 3963965521ul /* "forward-socks4" */
+#define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */
+#define hash_forwarded_connect_retries 101465292ul /* "forwarded-connect-retries" */
+#define hash_jarfile 2046641ul /* "jarfile" */
+#define hash_listen_address 1255650842ul /* "listen-address" */
+#define hash_logdir 422889ul /* "logdir" */
+#define hash_logfile 2114766ul /* "logfile" */
+#define hash_permit_access 3587953268ul /* "permit-access" */
+#define hash_proxy_info_url 3903079059ul /* "proxy-info-url" */
+#define hash_single_threaded 4250084780ul /* "single-threaded" */
+#define hash_split_large_cgi_forms 671658948ul /* "split-large-cgi-forms" */
+#define hash_suppress_blocklists 1948693308ul /* "suppress-blocklists" */
+#define hash_templdir 11067889ul /* "templdir" */
+#define hash_toggle 447966ul /* "toggle" */
+#define hash_trust_info_url 430331967ul /* "trust-info-url" */
+#define hash_trustfile 56494766ul /* "trustfile" */
+#define hash_usermanual 1416668518ul /* "user-manual" */
+#define hash_activity_animation 1817904738ul /* "activity-animation" */
+#define hash_close_button_minimizes 3651284693ul /* "close-button-minimizes" */
+#define hash_hide_console 2048809870ul /* "hide-console" */
+#define hash_log_buffer_size 2918070425ul /* "log-buffer-size" */
+#define hash_log_font_name 2866730124ul /* "log-font-name" */
+#define hash_log_font_size 2866731014ul /* "log-font-size" */
+#define hash_log_highlight_messages 4032101240ul /* "log-highlight-messages" */
+#define hash_log_max_lines 2868344173ul /* "log-max-lines" */
+#define hash_log_messages 2291744899ul /* "log-messages" */
+#define hash_show_on_task_bar 215410365ul /* "show-on-task-bar" */
static void savearg(char *command, char *argument, struct configuration_spec * config);
@@ -517,6 +576,7 @@ void unload_configfile (void * data)
freez(config->confdir);
freez(config->logdir);
+ freez(config->templdir);
freez(config->haddr);
freez(config->logfile);
@@ -525,6 +585,8 @@ void unload_configfile (void * data)
{
freez(config->actions_file_short[i]);
freez(config->actions_file[i]);
+ freez(config->re_filterfile_short[i]);
+ freez(config->re_filterfile[i]);
}
freez(config->admin_address);
@@ -643,6 +705,9 @@ struct configuration_spec * load_config(void)
config->usermanual = strdup(USER_MANUAL_URL);
config->proxy_args = strdup("");
config->forwarded_connect_retries = 0;
+ config->feature_flags &= ~RUNTIME_FEATURE_CGI_TOGGLE;
+ config->feature_flags &= ~RUNTIME_FEATURE_SPLIT_LARGE_FORMS;
+ config->feature_flags &= ~RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS;
if ((configfp = fopen(configfile, "r")) == NULL)
{
@@ -694,7 +759,7 @@ struct configuration_spec * load_config(void)
{
if (ijb_isupper(*p))
{
- *p = ijb_tolower(*p);
+ *p = (char)ijb_tolower(*p);
}
}
@@ -732,6 +797,19 @@ struct configuration_spec * load_config(void)
config->actions_file[i] = make_path(config->confdir, p);
free(p);
continue;
+/* *************************************************************************
+ * accept-intercepted-requests
+ * *************************************************************************/
+ case hash_accept_intercepted_requests:
+ if ((*arg != '\0') && (0 != atoi(arg)))
+ {
+ config->feature_flags |= RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS;
+ }
+ else
+ {
+ config->feature_flags &= ~RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS;
+ }
+ continue;
/* *************************************************************************
* admin-address email-address
@@ -745,7 +823,7 @@ struct configuration_spec * load_config(void)
* buffer-limit n
* *************************************************************************/
case hash_buffer_limit :
- config->buffer_limit = (size_t) 1024 * atoi(arg);
+ config->buffer_limit = (size_t)(1024 * atoi(arg));
continue;
/* *************************************************************************
@@ -794,11 +872,11 @@ struct configuration_spec * load_config(void)
if (acl_addr(vec[0], cur_acl->src) < 0)
{
- log_error(LOG_LEVEL_ERROR, "Invalid source IP for deny-access "
- "directive in configuration file: \"%s\"", vec[0]);
+ log_error(LOG_LEVEL_ERROR, "Invalid source address, port or netmask "
+ "for deny-access directive in configuration file: \"%s\"", vec[0]);
string_append(&config->proxy_args,
- "
\nWARNING: Invalid source IP for deny-access directive"
- " in configuration file: \"");
+ "
\nWARNING: Invalid source address, port or netmask "
+ "for deny-access directive in configuration file: \"");
string_append(&config->proxy_args,
vec[0]);
string_append(&config->proxy_args,
@@ -810,13 +888,13 @@ struct configuration_spec * load_config(void)
{
if (acl_addr(vec[1], cur_acl->dst) < 0)
{
- log_error(LOG_LEVEL_ERROR, "Invalid destination IP for deny-access "
- "directive in configuration file: \"%s\"", vec[0]);
+ log_error(LOG_LEVEL_ERROR, "Invalid destination address, port or netmask "
+ "for deny-access directive in configuration file: \"%s\"", vec[1]);
string_append(&config->proxy_args,
- "
\nWARNING: Invalid destination IP for deny-access directive"
- " in configuration file: \"");
+ "
\nWARNING: Invalid destination address, port or netmask "
+ "for deny-access directive in configuration file: \"");
string_append(&config->proxy_args,
- vec[0]);
+ vec[1]);
string_append(&config->proxy_args,
"\"
\n");
freez(cur_acl);
@@ -871,6 +949,36 @@ struct configuration_spec * load_config(void)
continue;
#endif /* def FEATURE_CGI_EDIT_ACTIONS */
+/* *************************************************************************
+ * enable-remote-http-toggle 0|1
+ * *************************************************************************/
+ case hash_enable_remote_http_toggle:
+ if ((*arg != '\0') && (0 != atoi(arg)))
+ {
+ config->feature_flags |= RUNTIME_FEATURE_HTTP_TOGGLE;
+ }
+ else
+ {
+ config->feature_flags &= ~RUNTIME_FEATURE_HTTP_TOGGLE;
+ }
+ continue;
+
+/* *************************************************************************
+ * hash_enforce_blocks 0|1
+ * *************************************************************************/
+#ifdef FEATURE_FORCE_LOAD
+ case hash_enforce_blocks:
+ if ((*arg != '\0') && (0 != atoi(arg)))
+ {
+ config->feature_flags |= RUNTIME_FEATURE_ENFORCE_BLOCKS;
+ }
+ else
+ {
+ config->feature_flags &= ~RUNTIME_FEATURE_ENFORCE_BLOCKS;
+ }
+ continue;
+#endif /* def FEATURE_FORCE_LOAD */
+
/* *************************************************************************
* filterfile file-name
* In confdir by default.
@@ -1195,11 +1303,11 @@ struct configuration_spec * load_config(void)
if (acl_addr(vec[0], cur_acl->src) < 0)
{
- log_error(LOG_LEVEL_ERROR, "Invalid source IP for permit-access "
- "directive in configuration file: \"%s\"", vec[0]);
+ log_error(LOG_LEVEL_ERROR, "Invalid source address, port or netmask "
+ "for permit-access directive in configuration file: \"%s\"", vec[0]);
string_append(&config->proxy_args,
- "
\nWARNING: Invalid source IP for permit-access directive"
- " in configuration file: \"");
+ "
\nWARNING: Invalid source address, port or netmask for "
+ "permit-access directive in configuration file: \"");
string_append(&config->proxy_args,
vec[0]);
string_append(&config->proxy_args,
@@ -1211,14 +1319,13 @@ struct configuration_spec * load_config(void)
{
if (acl_addr(vec[1], cur_acl->dst) < 0)
{
- log_error(LOG_LEVEL_ERROR, "Invalid destination IP for "
- "permit-access directive in configuration file: \"%s\"",
- vec[0]);
+ log_error(LOG_LEVEL_ERROR, "Invalid destination address, port or netmask "
+ "for permit-access directive in configuration file: \"%s\"", vec[1]);
string_append(&config->proxy_args,
- "
\nWARNING: Invalid destination IP for permit-access directive"
- " in configuration file: \"");
+ "
\nWARNING: Invalid destination address, port or netmask for "
+ "permit-access directive in configuration file: \"");
string_append(&config->proxy_args,
- vec[0]);
+ vec[1]);
string_append(&config->proxy_args,
"\"
\n");
freez(cur_acl);
@@ -1256,6 +1363,28 @@ struct configuration_spec * load_config(void)
config->multi_threaded = 0;
continue;
+/* *************************************************************************
+ * split-large-cgi-forms
+ * *************************************************************************/
+ case hash_split_large_cgi_forms :
+ if ((*arg != '\0') && (0 != atoi(arg)))
+ {
+ config->feature_flags |= RUNTIME_FEATURE_SPLIT_LARGE_FORMS;
+ }
+ else
+ {
+ config->feature_flags &= ~RUNTIME_FEATURE_SPLIT_LARGE_FORMS;
+ }
+ continue;
+
+/* *************************************************************************
+ * templdir directory-name
+ * *************************************************************************/
+ case hash_templdir :
+ freez(config->templdir);
+ config->templdir = make_path(NULL, arg);
+ continue;
+
/* *************************************************************************
* toggle (0|1)
* *************************************************************************/
@@ -1526,7 +1655,7 @@ struct configuration_spec * load_config(void)
g_default_actions_file = config->actions_file[1]; /* FIXME Hope this is default.action */
g_user_actions_file = config->actions_file[2]; /* FIXME Hope this is user.action */
- g_re_filterfile = config->re_filterfile;
+ g_re_filterfile = config->re_filterfile[0]; /* FIXME Hope this is default.filter */
#ifdef FEATURE_TRUST
g_trustfile = config->trustfile;
@@ -1613,8 +1742,18 @@ static void savearg(char *command, char *argument, struct configuration_spec * c
* Add config option name embedded in
* link to it's section in the user-manual
*/
- buf = strdup("\n
usermanual);
+ buf = strdup("\nusermanual, "file://", 7) ||
+ !strncmpic(config->usermanual, "http", 4))
+ {
+ string_append(&buf, config->usermanual);
+ }
+ else
+ {
+ string_append(&buf, "http://");
+ string_append(&buf, CGI_SITE_2_HOST);
+ string_append(&buf, "/user-manual/");
+ }
string_append(&buf, CONFIG_HELP_PREFIX);
string_join (&buf, string_toupper(command));
string_append(&buf, "\">");
@@ -1651,6 +1790,7 @@ static void savearg(char *command, char *argument, struct configuration_spec * c
}
}
+ string_append(&buf, "
");
string_join(&config->proxy_args, buf);
}