From d354d986c64e91569fadba96cd69a89b4093ac53 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 31 Aug 2008 15:59:03 +0000 Subject: [PATCH] There's no reason to let remote toggling support depend on FEATURE_CGI_EDIT_ACTIONS, so make sure it doesn't. --- ChangeLog | 9 ++++ cgi.c | 13 +++-- cgiedit.c | 145 ++++++++++++++++++++++++++++-------------------------- cgiedit.h | 17 ++++--- loadcfg.c | 13 +++-- 5 files changed, 112 insertions(+), 85 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bd0f96a..dfe69925 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,16 @@ -------------------------------------------------------------------- ChangeLog for Privoxy -------------------------------------------------------------------- +*** Since 3.0.10 + +- Support for remote toggling is controlled by the configure + option --disable-toggle only. In previous versions it also + depended on the action editor and thus configuring with the + --disable-editor option would disable remote toggling support + as well. + *** Version 3.0.10 *** + - Ordinary configuration file changes no longer cause program termination on OS/2 if the name of the logfile hasn't been changed as well. This regression probably crept in with the diff --git a/cgi.c b/cgi.c index 072c5c5a..1baa283b 100644 --- a/cgi.c +++ b/cgi.c @@ -1,4 +1,4 @@ -const char cgi_rcs[] = "$Id: cgi.c,v 1.109 2008/07/26 09:40:27 fabiankeil Exp $"; +const char cgi_rcs[] = "$Id: cgi.c,v 1.110 2008/08/31 14:55:43 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgi.c,v $ @@ -38,6 +38,11 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.109 2008/07/26 09:40:27 fabiankeil Exp $" * * Revisions : * $Log: cgi.c,v $ + * Revision 1.110 2008/08/31 14:55:43 fabiankeil + * Add a @date@ symbol to include a date(1)-like time string + * in templates. Modified version of the patch Endre Szabo + * submitted in #2026468. + * * Revision 1.109 2008/07/26 09:40:27 fabiankeil * Remove the unconditional block in get_http_time(). * It's pointless now that it's no longer used to limit @@ -642,9 +647,9 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.109 2008/07/26 09:40:27 fabiankeil Exp $" #include "miscutil.h" #include "cgisimple.h" #include "jbsockets.h" -#ifdef FEATURE_CGI_EDIT_ACTIONS +#if defined(FEATURE_CGI_EDIT_ACTIONS) || defined(FEATURE_TOGGLE) #include "cgiedit.h" -#endif /* def FEATURE_CGI_EDIT_ACTIONS */ +#endif /* defined(FEATURE_CGI_EDIT_ACTIONS) || defined (FEATURE_TOGGLE) */ #include "loadcfg.h" /* loadcfg.h is for global_toggle_state only */ #ifdef FEATURE_PTHREAD @@ -690,13 +695,13 @@ static const struct cgi_dispatcher cgi_dispatchers[] = { cgi_show_url_info, "Look up which actions apply to a URL and why", TRUE }, -#ifdef FEATURE_CGI_EDIT_ACTIONS #ifdef FEATURE_TOGGLE { "toggle", cgi_toggle, "Toggle Privoxy on or off", FALSE }, #endif /* def FEATURE_TOGGLE */ +#ifdef FEATURE_CGI_EDIT_ACTIONS { "edit-actions", /* Edit the actions list */ cgi_edit_actions, NULL, FALSE }, diff --git a/cgiedit.c b/cgiedit.c index 372ab7f6..6d742b7c 100644 --- a/cgiedit.c +++ b/cgiedit.c @@ -1,4 +1,4 @@ -const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.60 2008/03/15 14:52:35 fabiankeil Exp $"; +const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.61 2008/03/24 18:12:52 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $ @@ -42,6 +42,9 @@ const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.60 2008/03/15 14:52:35 fabiankeil * * Revisions : * $Log: cgiedit.c,v $ + * Revision 1.61 2008/03/24 18:12:52 fabiankeil + * Use sizeof() more often. + * * Revision 1.60 2008/03/15 14:52:35 fabiankeil * Add CGI editor support for the "disable all filters of this type" * directives "-client-header-filter", "-server-header-filter", @@ -4511,75 +4514,6 @@ jb_err cgi_edit_actions_section_swap(struct client_state *csp, return cgi_redirect(rsp, target); } -#ifdef FEATURE_TOGGLE -/********************************************************************* - * - * Function : cgi_toggle - * - * Description : CGI function that adds a new empty section to - * an actions file. - * - * Parameters : - * 1 : csp = Current client state (buffers, headers, etc...) - * 2 : rsp = http_response data structure for output - * 3 : parameters = map of cgi parameters - * - * CGI Parameters : - * set : If present, how to change toggle setting: - * "enable", "disable", "toggle", or none (default). - * mini : If present, use mini reply template. - * - * Returns : JB_ERR_OK on success - * JB_ERR_MEMORY on out-of-memory - * - *********************************************************************/ -jb_err cgi_toggle(struct client_state *csp, - struct http_response *rsp, - const struct map *parameters) -{ - struct map *exports; - char mode; - const char *template_name; - - assert(csp); - assert(rsp); - assert(parameters); - - if (0 == (csp->config->feature_flags & RUNTIME_FEATURE_CGI_TOGGLE)) - { - return cgi_error_disabled(csp, rsp); - } - - mode = get_char_param(parameters, "set"); - - if (mode == 'E') - { - /* Enable */ - global_toggle_state = 1; - } - else if (mode == 'D') - { - /* Disable */ - global_toggle_state = 0; - } - else if (mode == 'T') - { - /* Toggle */ - global_toggle_state = !global_toggle_state; - } - - if (NULL == (exports = default_exports(csp, "toggle"))) - { - return JB_ERR_MEMORY; - } - - template_name = (get_char_param(parameters, "mini") - ? "toggle-mini" - : "toggle"); - - return template_fill_for_cgi(csp, template_name, exports, rsp); -} -#endif /* def FEATURE_TOGGLE */ /********************************************************************* * @@ -4894,9 +4828,78 @@ static jb_err actions_from_radio(const struct map * parameters, return err; } +#endif /* def FEATURE_CGI_EDIT_ACTIONS */ -#endif /* def FEATURE_CGI_EDIT_ACTIONS */ +#ifdef FEATURE_TOGGLE +/********************************************************************* + * + * Function : cgi_toggle + * + * Description : CGI function that adds a new empty section to + * an actions file. + * + * Parameters : + * 1 : csp = Current client state (buffers, headers, etc...) + * 2 : rsp = http_response data structure for output + * 3 : parameters = map of cgi parameters + * + * CGI Parameters : + * set : If present, how to change toggle setting: + * "enable", "disable", "toggle", or none (default). + * mini : If present, use mini reply template. + * + * Returns : JB_ERR_OK on success + * JB_ERR_MEMORY on out-of-memory + * + *********************************************************************/ +jb_err cgi_toggle(struct client_state *csp, + struct http_response *rsp, + const struct map *parameters) +{ + struct map *exports; + char mode; + const char *template_name; + + assert(csp); + assert(rsp); + assert(parameters); + + if (0 == (csp->config->feature_flags & RUNTIME_FEATURE_CGI_TOGGLE)) + { + return cgi_error_disabled(csp, rsp); + } + + mode = get_char_param(parameters, "set"); + + if (mode == 'E') + { + /* Enable */ + global_toggle_state = 1; + } + else if (mode == 'D') + { + /* Disable */ + global_toggle_state = 0; + } + else if (mode == 'T') + { + /* Toggle */ + global_toggle_state = !global_toggle_state; + } + + if (NULL == (exports = default_exports(csp, "toggle"))) + { + return JB_ERR_MEMORY; + } + + template_name = (get_char_param(parameters, "mini") + ? "toggle-mini" + : "toggle"); + + return template_fill_for_cgi(csp, template_name, exports, rsp); +} +#endif /* def FEATURE_TOGGLE */ /* diff --git a/cgiedit.h b/cgiedit.h index 7bb344d9..178a83cb 100644 --- a/cgiedit.h +++ b/cgiedit.h @@ -1,9 +1,9 @@ #ifndef CGIEDIT_H_INCLUDED #define CGIEDIT_H_INCLUDED -#define CGIEDIT_H_VERSION "$Id: cgiedit.h,v 1.7.2.2 2004/02/17 13:30:23 oes Exp $" +#define CGIEDIT_H_VERSION "$Id: cgiedit.h,v 1.9 2006/07/18 14:48:45 david__schmidt Exp $" /********************************************************************* * - * File : $Source: /cvsroot/ijbswa/current/Attic/cgiedit.h,v $ + * File : $Source: /cvsroot/ijbswa/current/cgiedit.h,v $ * * Purpose : CGI-based actionsfile editor. * @@ -37,6 +37,10 @@ * * Revisions : * $Log: cgiedit.h,v $ + * Revision 1.9 2006/07/18 14:48:45 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) + * * Revision 1.7.2.2 2004/02/17 13:30:23 oes * Moved cgi_error_disabled() from cgiedit.c to * cgi.c to re-enable build with --disable-editor. @@ -143,11 +147,12 @@ extern jb_err cgi_edit_actions_section_add (struct client_state *csp, extern jb_err cgi_edit_actions_section_swap (struct client_state *csp, struct http_response *rsp, const struct map *parameters); -extern jb_err cgi_toggle (struct client_state *csp, - struct http_response *rsp, - const struct map *parameters); #endif /* def FEATURE_CGI_EDIT_ACTIONS */ - +#ifdef FEATURE_TOGGLE +extern jb_err cgi_toggle(struct client_state *csp, + struct http_response *rsp, + const struct map *parameters); +#endif /* def FEATURE_TOGGLE */ /* Revision control strings from this header and associated .c file */ extern const char cgiedit_rcs[]; diff --git a/loadcfg.c b/loadcfg.c index d3b4a2b0..504ab228 100644 --- a/loadcfg.c +++ b/loadcfg.c @@ -1,4 +1,4 @@ -const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.78 2008/08/02 08:23:22 fabiankeil Exp $"; +const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.79 2008/08/30 12:03:07 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $ @@ -35,6 +35,9 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.78 2008/08/02 08:23:22 fabiankeil * * Revisions : * $Log: loadcfg.c,v $ + * Revision 1.79 2008/08/30 12:03:07 fabiankeil + * Remove FEATURE_COOKIE_JAR. + * * Revision 1.78 2008/08/02 08:23:22 fabiankeil * If the enforce-blocks directive is used with FEATURE_FORCE_LOAD * disabled, log a message that blocks will always be enforced @@ -1007,7 +1010,7 @@ struct configuration_spec * load_config(void) /* ************************************************************************* * enable-remote-toggle 0|1 * *************************************************************************/ -#ifdef FEATURE_CGI_EDIT_ACTIONS +#ifdef FEATURE_TOGGLE case hash_enable_remote_toggle: if ((*arg != '\0') && (0 != atoi(arg))) { @@ -1018,7 +1021,7 @@ struct configuration_spec * load_config(void) config->feature_flags &= ~RUNTIME_FEATURE_CGI_TOGGLE; } continue; -#endif /* def FEATURE_CGI_EDIT_ACTIONS */ +#endif /* def FEATURE_TOGGLE */ /* ************************************************************************* * enable-remote-http-toggle 0|1 @@ -1598,8 +1601,10 @@ struct configuration_spec * load_config(void) #endif /* ndef FEATURE_ACL */ #ifndef FEATURE_CGI_EDIT_ACTIONS case hash_enable_edit_actions: +#endif /* ndef FEATURE_CGI_EDIT_ACTIONS */ +#ifndef FEATURE_TOGGLE case hash_enable_remote_toggle: -#endif /* def FEATURE_CGI_EDIT_ACTIONS */ +#endif /* ndef FEATURE_TOGGLE */ #ifndef FEATURE_ACL case hash_permit_access: #endif /* ndef FEATURE_ACL */ -- 2.39.2