Show enablement/disablement status in almost all templates.
[privoxy.git] / loadcfg.c
1 const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.24 2001/10/23 21:40:30 jongfoster Exp $";
2 /*********************************************************************
3  *
4  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
5  *
6  * Purpose     :  Loads settings from the configuration file into
7  *                global variables.  This file contains both the
8  *                routine to load the configuration and the global
9  *                variables it writes to.
10  *
11  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
12  *                IJBSWA team.  http://ijbswa.sourceforge.net
13  *
14  *                Based on the Internet Junkbuster originally written
15  *                by and Copyright (C) 1997 Anonymous Coders and
16  *                Junkbusters Corporation.  http://www.junkbusters.com
17  *
18  *                This program is free software; you can redistribute it
19  *                and/or modify it under the terms of the GNU General
20  *                Public License as published by the Free Software
21  *                Foundation; either version 2 of the License, or (at
22  *                your option) any later version.
23  *
24  *                This program is distributed in the hope that it will
25  *                be useful, but WITHOUT ANY WARRANTY; without even the
26  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
27  *                PARTICULAR PURPOSE.  See the GNU General Public
28  *                License for more details.
29  *
30  *                The GNU General Public License should be included with
31  *                this file.  If not, you can view it at
32  *                http://www.gnu.org/copyleft/gpl.html
33  *                or write to the Free Software Foundation, Inc., 59
34  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
35  *
36  * Revisions   :
37  *    $Log: loadcfg.c,v $
38  *    Revision 1.24  2001/10/23 21:40:30  jongfoster
39  *    Added support for enable-edit-actions and enable-remote-toggle config
40  *    file options.
41  *
42  *    Revision 1.23  2001/10/07 15:36:00  oes
43  *    Introduced new config option "buffer-limit"
44  *
45  *    Revision 1.22  2001/09/22 16:36:59  jongfoster
46  *    Removing unused parameter fs from read_config_line()
47  *
48  *    Revision 1.21  2001/09/16 17:10:43  jongfoster
49  *    Moving function savearg() here, since it was the only thing left in
50  *    showargs.c.
51  *
52  *    Revision 1.20  2001/07/30 22:08:36  jongfoster
53  *    Tidying up #defines:
54  *    - All feature #defines are now of the form FEATURE_xxx
55  *    - Permanently turned off WIN_GUI_EDIT
56  *    - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
57  *
58  *    Revision 1.19  2001/07/15 17:45:16  jongfoster
59  *    Removing some unused #includes
60  *
61  *    Revision 1.18  2001/07/13 14:01:14  oes
62  *     - Removed all #ifdef PCRS
63  *     - Removed vim-settings
64  *
65  *    Revision 1.17  2001/06/29 13:31:03  oes
66  *    - Improved comments
67  *    - Fixed (actionsfile) and sorted hashes
68  *    - Introduced admin_address and proxy-info-url
69  *      as config parameters
70  *    - Renamed config->proxy_args_invocation (which didn't have
71  *      the invocation but the options!) to config->proxy_args
72  *    - Various adaptions
73  *    - Removed logentry from cancelled commit
74  *
75  *    Revision 1.16  2001/06/09 10:55:28  jongfoster
76  *    Changing BUFSIZ ==> BUFFER_SIZE
77  *
78  *    Revision 1.15  2001/06/07 23:13:40  jongfoster
79  *    Merging ACL and forward files into config file.
80  *    Cosmetic: Sorting config file options alphabetically.
81  *    Cosmetic: Adding brief syntax comments to config file options.
82  *
83  *    Revision 1.14  2001/06/07 14:46:25  joergs
84  *    Missing make_path() added for re_filterfile.
85  *
86  *    Revision 1.13  2001/06/05 22:33:54  jongfoster
87  *
88  *    Fixed minor memory leak.
89  *    Also now uses make_path to prepend the pathnames.
90  *
91  *    Revision 1.12  2001/06/05 20:04:09  jongfoster
92  *    Now uses _snprintf() in place of snprintf() under Win32.
93  *
94  *    Revision 1.11  2001/06/04 18:31:58  swa
95  *    files are now prefixed with either `confdir' or `logdir'.
96  *    `make redhat-dist' replaces both entries confdir and logdir
97  *    with redhat values
98  *
99  *    Revision 1.10  2001/06/03 19:11:54  oes
100  *    introduced confdir option
101  *
102  *    Revision 1.9  2001/06/01 20:06:24  jongfoster
103  *    Removed support for "tinygif" option - moved to actions file.
104  *
105  *    Revision 1.8  2001/05/31 21:27:13  jongfoster
106  *    Removed many options from the config file and into the
107  *    "actions" file: add_forwarded, suppress_vanilla_wafer,
108  *    wafer, add_header, user_agent, referer, from
109  *    Also globally replaced "permission" with "action".
110  *
111  *    Revision 1.7  2001/05/29 09:50:24  jongfoster
112  *    Unified blocklist/imagelist/permissionslist.
113  *    File format is still under discussion, but the internal changes
114  *    are (mostly) done.
115  *
116  *    Also modified interceptor behaviour:
117  *    - We now intercept all URLs beginning with one of the following
118  *      prefixes (and *only* these prefixes):
119  *        * http://i.j.b/
120  *        * http://ijbswa.sf.net/config/
121  *        * http://ijbswa.sourceforge.net/config/
122  *    - New interceptors "home page" - go to http://i.j.b/ to see it.
123  *    - Internal changes so that intercepted and fast redirect pages
124  *      are not replaced with an image.
125  *    - Interceptors now have the option to send a binary page direct
126  *      to the client. (i.e. ijb-send-banner uses this)
127  *    - Implemented show-url-info interceptor.  (Which is why I needed
128  *      the above interceptors changes - a typical URL is
129  *      "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
130  *      The previous mechanism would not have intercepted that, and
131  *      if it had been intercepted then it then it would have replaced
132  *      it with an image.)
133  *
134  *    Revision 1.6  2001/05/26 00:28:36  jongfoster
135  *    Automatic reloading of config file.
136  *    Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32).
137  *    Most of the global variables have been moved to a new
138  *    struct configuration_spec, accessed through csp->config->globalname
139  *    Most of the globals remaining are used by the Win32 GUI.
140  *
141  *    Revision 1.5  2001/05/25 22:34:30  jongfoster
142  *    Hard tabs->Spaces
143  *
144  *    Revision 1.4  2001/05/22 18:46:04  oes
145  *
146  *    - Enabled filtering banners by size rather than URL
147  *      by adding patterns that replace all standard banner
148  *      sizes with the "Junkbuster" gif to the re_filterfile
149  *
150  *    - Enabled filtering WebBugs by providing a pattern
151  *      which kills all 1x1 images
152  *
153  *    - Added support for PCRE_UNGREEDY behaviour to pcrs,
154  *      which is selected by the (nonstandard and therefore
155  *      capital) letter 'U' in the option string.
156  *      It causes the quantifiers to be ungreedy by default.
157  *      Appending a ? turns back to greedy (!).
158  *
159  *    - Added a new interceptor ijb-send-banner, which
160  *      sends back the "Junkbuster" gif. Without imagelist or
161  *      MSIE detection support, or if tinygif = 1, or the
162  *      URL isn't recognized as an imageurl, a lame HTML
163  *      explanation is sent instead.
164  *
165  *    - Added new feature, which permits blocking remote
166  *      script redirects and firing back a local redirect
167  *      to the browser.
168  *      The feature is conditionally compiled, i.e. it
169  *      can be disabled with --disable-fast-redirects,
170  *      plus it must be activated by a "fast-redirects"
171  *      line in the config file, has its own log level
172  *      and of course wants to be displayed by show-proxy-args
173  *      Note: Boy, all the #ifdefs in 1001 locations and
174  *      all the fumbling with configure.in and acconfig.h
175  *      were *way* more work than the feature itself :-(
176  *
177  *    - Because a generic redirect template was needed for
178  *      this, tinygif = 3 now uses the same.
179  *
180  *    - Moved GIFs, and other static HTTP response templates
181  *      to project.h
182  *
183  *    - Some minor fixes
184  *
185  *    - Removed some >400 CRs again (Jon, you really worked
186  *      a lot! ;-)
187  *
188  *    Revision 1.3  2001/05/20 01:21:20  jongfoster
189  *    Version 2.9.4 checkin.
190  *    - Merged popupfile and cookiefile, and added control over PCRS
191  *      filtering, in new "permissionsfile".
192  *    - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
193  *      file error you now get a message box (in the Win32 GUI) rather
194  *      than the program exiting with no explanation.
195  *    - Made killpopup use the PCRS MIME-type checking and HTTP-header
196  *      skipping.
197  *    - Removed tabs from "config"
198  *    - Moved duplicated url parsing code in "loaders.c" to a new funcition.
199  *    - Bumped up version number.
200  *
201  *    Revision 1.2  2001/05/17 23:01:01  oes
202  *     - Cleaned CRLF's from the sources and related files
203  *
204  *    Revision 1.1.1.1  2001/05/15 13:58:58  oes
205  *    Initial import of version 2.9.3 source tree
206  *
207  *
208  *********************************************************************/
209 \f
210
211 #include "config.h"
212
213 #include <stdio.h>
214 #include <sys/types.h>
215 #include <stdlib.h>
216 #include <string.h>
217 #include <signal.h>
218 #include <fcntl.h>
219 #include <errno.h>
220 #include <ctype.h>
221
222 #ifdef _WIN32
223
224 # include <windows.h>
225
226 # include "win32.h"
227 # ifndef _WIN_CONSOLE
228 #  include "w32log.h"
229 # endif /* ndef _WIN_CONSOLE */
230
231 /* VC++ has "_snprintf", not "snprintf" */
232 #define snprintf _snprintf
233
234 #else /* ifndef _WIN32 */
235
236 #ifndef __OS2__
237 # include <unistd.h>
238 # include <sys/wait.h>
239 #endif
240 # include <sys/time.h>
241 # include <sys/stat.h>
242 # include <signal.h>
243
244 #endif
245
246 #include "loadcfg.h"
247 #include "list.h"
248 #include "jcc.h"
249 #include "filters.h"
250 #include "loaders.h"
251 #include "miscutil.h"
252 #include "errlog.h"
253 #include "ssplit.h"
254 #include "encode.h"
255
256 const char loadcfg_h_rcs[] = LOADCFG_H_VERSION;
257
258 /*
259  * Fix a problem with Solaris.  There should be no effect on other
260  * platforms.
261  * Solaris's isspace() is a macro which uses it's argument directly
262  * as an array index.  Therefore we need to make sure that high-bit
263  * characters generate +ve values, and ideally we also want to make
264  * the argument match the declared parameter type of "int".
265  */
266 #define ijb_isupper(__X) isupper((int)(unsigned char)(__X))
267 #define ijb_tolower(__X) tolower((int)(unsigned char)(__X))
268
269 #ifdef FEATURE_TOGGLE
270 /* by haroon - indicates if ijb is enabled */
271 int g_bToggleIJB        = 1;   /* JunkBusters is enabled by default. */
272 #endif /* def FEATURE_TOGGLE */
273
274 /* The filename of the configfile */
275 const char *configfile  = NULL;
276
277 /*
278  * CGI functions will later need access to the invocation args,
279  * so we will make argc and argv global.
280  */
281 int Argc = 0;
282 const char **Argv = NULL;
283
284 static struct file_list *current_configfile = NULL;
285
286
287 /*
288  * This takes the "cryptic" hash of each keyword and aliases them to
289  * something a little more readable.  This also makes changing the
290  * hash values easier if they should change or the hash algorthm changes.
291  * Use the included "hash" program to find out what the hash will be
292  * for any string supplied on the command line.  (Or just put it in the
293  * config file and read the number from the error message in the log).
294  *
295  * Please keep this list sorted alphabetically (but with the Windows
296  * console and GUI specific options last).
297  */
298
299 #define hash_actions_file              1196306641ul /* "actionsfile" */
300 #define hash_admin_address             4112573064ul /* "admin-address" */
301 #define hash_buffer_limit              1881726070ul /* "buffer-limit */
302 #define hash_confdir                      1978389ul /* "confdir" */
303 #define hash_debug                          78263ul /* "debug" */
304 #define hash_deny_access               1227333715ul /* "deny-access" */
305 #define hash_enable_edit_actions       2517097536ul /* "enable-edit-actions" */
306 #define hash_enable_remote_toggle      2979744683ul /* "enable-remote-toggle" */
307 #define hash_forward                      2029845ul /* "forward" */
308 #define hash_forward_socks4            3963965521ul /* "forward-socks4" */
309 #define hash_forward_socks4a           2639958518ul /* "forward-socks4a" */
310 #define hash_jarfile                      2046641ul /* "jarfile" */
311 #define hash_listen_address            1255650842ul /* "listen-address" */
312 #define hash_logdir                        422889ul /* "logdir" */
313 #define hash_logfile                      2114766ul /* "logfile" */
314 #define hash_permit_access             3587953268ul /* "permit-access" */
315 #define hash_proxy_info_url            3903079059ul /* "proxy-info-url" */
316 #define hash_re_filterfile             3877522444ul /* "re_filterfile" */
317 #define hash_single_threaded           4250084780ul /* "single-threaded" */
318 #define hash_suppress_blocklists       1948693308ul /* "suppress-blocklists" */
319 #define hash_toggle                        447966ul /* "toggle" */
320 #define hash_trust_info_url             430331967ul /* "trust-info-url" */
321 #define hash_trustfile                   56494766ul /* "trustfile" */
322
323 #define hash_activity_animation        1817904738ul /* "activity-animation" */
324 #define hash_close_button_minimizes    3651284693ul /* "close-button-minimizes" */
325 #define hash_hide_console              2048809870ul /* "hide-console" */
326 #define hash_log_buffer_size           2918070425ul /* "log-buffer-size" */
327 #define hash_log_font_name             2866730124ul /* "log-font-name" */
328 #define hash_log_font_size             2866731014ul /* "log-font-size" */
329 #define hash_log_highlight_messages    4032101240ul /* "log-highlight-messages" */
330 #define hash_log_max_lines             2868344173ul /* "log-max-lines" */
331 #define hash_log_messages              2291744899ul /* "log-messages" */
332 #define hash_show_on_task_bar           215410365ul /* "show-on-task-bar" */
333
334
335 static void savearg(char *c, char *o, struct configuration_spec * config);
336
337
338 /*********************************************************************
339  *
340  * Function    :  unload_configfile
341  *
342  * Description :  Free the config structure and all components.
343  *
344  * Parameters  :
345  *          1  :  data: struct configuration_spec to unload
346  *
347  * Returns     :  N/A
348  *
349  *********************************************************************/
350 void unload_configfile (void * data)
351 {
352    struct configuration_spec * config = (struct configuration_spec *)data;
353    struct forward_spec *cur_fwd = config->forward;
354 #ifdef FEATURE_ACL
355    struct access_control_list *cur_acl = config->acl;
356
357    while (cur_acl != NULL)
358    {
359       struct access_control_list * next_acl = cur_acl->next;
360       free(cur_acl);
361       cur_acl = next_acl;
362    }
363    config->acl = NULL;
364 #endif /* def FEATURE_ACL */
365
366    while (cur_fwd != NULL)
367    {
368       struct forward_spec * next_fwd = cur_fwd->next;
369       free_url(cur_fwd->url);
370
371       freez(cur_fwd->gateway_host);
372       freez(cur_fwd->forward_host);
373       free(cur_fwd);
374       cur_fwd = next_fwd;
375    }
376    config->forward = NULL;
377
378 #ifdef FEATURE_COOKIE_JAR
379    if ( NULL != config->jar )
380    {
381       fclose( config->jar );
382       config->jar = NULL;
383    }
384 #endif /* def FEATURE_COOKIE_JAR */
385
386    freez(config->confdir);
387    freez(config->logdir);
388
389    freez(config->haddr);
390    freez(config->logfile);
391
392    freez(config->actions_file);
393    freez(config->admin_address);
394    freez(config->proxy_info_url);
395    freez(config->proxy_args);
396
397 #ifdef FEATURE_COOKIE_JAR
398    freez(config->jarfile);
399 #endif /* def FEATURE_COOKIE_JAR */
400
401    freez(config->re_filterfile);
402
403 }
404
405
406 /*********************************************************************
407  *
408  * Function    :  load_config
409  *
410  * Description :  Load the config file and all parameters.
411  *
412  * Parameters  :
413  *          1  :  csp = Client state (the config member will be
414  *                filled in by this function).
415  *
416  * Returns     :  0 => Ok, everything else is an error.
417  *
418  *********************************************************************/
419 struct configuration_spec * load_config(void)
420 {
421    char buf[BUFFER_SIZE];
422    char *p, *q;
423    FILE *configfp = NULL;
424    struct configuration_spec * config = NULL;
425    struct client_state * fake_csp;
426    struct file_list *fs;
427
428    if (!check_file_changed(current_configfile, configfile, &fs))
429    {
430       /* No need to load */
431       return ((struct configuration_spec *)current_configfile->f);
432    }
433    if (!fs)
434    {
435       log_error(LOG_LEVEL_FATAL, "can't check configuration file '%s':  %E",
436                 configfile);
437    }
438
439    log_error(LOG_LEVEL_INFO, "loading configuration file '%s':", configfile);
440
441 #ifdef FEATURE_TOGGLE
442    g_bToggleIJB      = 1;
443 #endif /* def FEATURE_TOGGLE */
444
445    fs->f = config = (struct configuration_spec *)zalloc(sizeof(*config));
446
447    if (config==NULL)
448    {
449       freez(fs->filename);
450       freez(fs);
451       log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
452       /* Never get here - LOG_LEVEL_FATAL causes program exit */
453    }
454
455    /*
456     * This is backwards from how it's usually done.
457     * Following the usual pattern, "fs" would be stored in a member
458     * variable in "csp", and then we'd access "config" from "fs->f",
459     * using a cast.  However, "config" is used so often that a
460     * cast each time would be very ugly, and the extra indirection
461     * would waste CPU cycles.  Therefore we store "config" in
462     * "csp->config", and "fs" in "csp->config->config_file_list".
463     */
464    config->config_file_list = fs;
465
466    /*
467     * Set to defaults
468     */
469
470    config->multi_threaded    = 1;
471    config->hport             = HADDR_PORT;
472    config->buffer_limit      = 4096 * 1024;
473
474    if ((configfp = fopen(configfile, "r")) == NULL)
475    {
476       log_error(LOG_LEVEL_FATAL, "can't open configuration file '%s':  %E",
477               configfile);
478       /* Never get here - LOG_LEVEL_FATAL causes program exit */
479    }
480
481    while (read_config_line(buf, sizeof(buf), configfp) != NULL)
482    {
483       char cmd[BUFFER_SIZE];
484       char arg[BUFFER_SIZE];
485       char tmp[BUFFER_SIZE];
486 #ifdef FEATURE_ACL
487       struct access_control_list *cur_acl;
488 #endif /* def FEATURE_ACL */
489       struct forward_spec *cur_fwd;
490       int vec_count;
491       char *vec[3];
492
493       strcpy(tmp, buf);
494
495       /* Copy command (i.e. up to space or tab) into cmd */
496       p = buf;
497       q = cmd;
498       while (*p && (*p != ' ') && (*p != '\t'))
499       {
500          *q++ = *p++;
501       }
502       *q = '\0';
503
504       /* Skip over the whitespace in buf */
505       while (*p && ((*p == ' ') || (*p == '\t')))
506       {
507          p++;
508       }
509
510       /* Copy the argument into arg */
511       strcpy(arg, p);
512
513       /* Should never happen, but check this anyway */
514       if (*cmd == '\0')
515       {
516          continue;
517       }
518
519       /* Make sure the command field is lower case */
520       for (p=cmd; *p; p++)
521       {
522          if (ijb_isupper(*p))
523          {
524             *p = ijb_tolower(*p);
525          }
526       }
527
528       /* Save the argument for show-proxy-args */
529       savearg(cmd, arg, config);
530
531
532       switch( hash_string( cmd ) )
533       {
534 /****************************************************************************
535  * actionsfile actions-file-name
536  * In confdir by default
537  ****************************************************************************/
538          case hash_actions_file :
539             freez(config->actions_file);
540             config->actions_file = make_path(config->confdir, arg);
541             continue;
542
543 /****************************************************************************
544  * admin-address email-address
545  ****************************************************************************/
546          case hash_admin_address :
547             freez(config->admin_address);
548             config->admin_address = strdup(arg);
549             continue;
550
551 /****************************************************************************
552  * buffer-limit n
553  ****************************************************************************/
554          case hash_buffer_limit :
555             config->buffer_limit = (size_t) 1024 * atoi(arg);
556             continue;
557
558 /****************************************************************************
559  * confdir directory-name
560  ****************************************************************************/
561          case hash_confdir :
562             freez(config->confdir);
563             config->confdir = strdup(arg);
564             continue;
565
566 /****************************************************************************
567  * debug n
568  * Specifies debug level, multiple values are ORed together.
569  ****************************************************************************/
570          case hash_debug :
571             config->debug |= atoi(arg);
572             continue;
573
574 /****************************************************************************
575  * deny-access source-ip[/significant-bits] [dest-ip[/significant-bits]]
576  ****************************************************************************/
577 #ifdef FEATURE_ACL
578          case hash_deny_access:
579             vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
580
581             if ((vec_count != 1) && (vec_count != 2))
582             {
583                log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
584                      "deny-access directive in configuration file.");
585                config->proxy_args = strsav( config->proxy_args,
586                   "<br>\nWARNING: Wrong number of parameters for "
587                   "deny-access directive in configuration file.<br><br>\n");
588                continue;
589             }
590
591             /* allocate a new node */
592             cur_acl = (struct access_control_list *) zalloc(sizeof(*cur_acl));
593
594             if (cur_acl == NULL)
595             {
596                log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
597                /* Never get here - LOG_LEVEL_FATAL causes program exit */
598                continue;
599             }
600             cur_acl->action = ACL_DENY;
601
602             if (acl_addr(vec[0], cur_acl->src) < 0)
603             {
604                log_error(LOG_LEVEL_ERROR, "Invalid source IP for deny-access "
605                      "directive in configuration file: \"%s\"", vec[0]);
606                config->proxy_args = strsav( config->proxy_args,
607                   "<br>\nWARNING: Invalid source IP for deny-access directive"
608                   " in configuration file: \"");
609                config->proxy_args = strsav( config->proxy_args,
610                   vec[0]);
611                config->proxy_args = strsav( config->proxy_args,
612                   "\"<br><br>\n");
613                freez(cur_acl);
614                continue;
615             }
616             if (vec_count == 2)
617             {
618                if (acl_addr(vec[1], cur_acl->dst) < 0)
619                {
620                   log_error(LOG_LEVEL_ERROR, "Invalid destination IP for deny-access "
621                         "directive in configuration file: \"%s\"", vec[0]);
622                   config->proxy_args = strsav( config->proxy_args,
623                      "<br>\nWARNING: Invalid destination IP for deny-access directive"
624                      " in configuration file: \"");
625                   config->proxy_args = strsav( config->proxy_args,
626                      vec[0]);
627                   config->proxy_args = strsav( config->proxy_args,
628                      "\"<br><br>\n");
629                   freez(cur_acl);
630                   continue;
631                }
632             }
633
634             /*
635              * Add it to the list.  Note we reverse the list to get the
636              * behaviour the user expects.  With both the ACL and
637              * actions file, the last match wins.  However, the internal
638              * implementations are different:  The actions file is stored
639              * in the same order as the file, and scanned completely.
640              * With the ACL, we reverse the order as we load it, then
641              * when we scan it we stop as soon as we get a match.
642              */
643             cur_acl->next  = config->acl;
644             config->acl = cur_acl;
645
646             continue;
647 #endif /* def FEATURE_ACL */
648
649 /****************************************************************************
650  * enable-edit-actions 0|1
651  ****************************************************************************/
652 #ifdef FEATURE_CGI_EDIT_ACTIONS
653          case hash_enable_edit_actions:
654             if ((*arg != '\0') && (0 != atoi(arg)))
655             {
656                config->feature_flags |= RUNTIME_FEATURE_CGI_EDIT_ACTIONS;
657             }
658             else
659             {
660                config->feature_flags &= ~RUNTIME_FEATURE_CGI_EDIT_ACTIONS;
661             }
662             continue;
663 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
664
665 /****************************************************************************
666  * enable-remote-toggle 0|1
667  ****************************************************************************/
668 #ifdef FEATURE_CGI_EDIT_ACTIONS
669          case hash_enable_remote_toggle:
670             if ((*arg != '\0') && (0 != atoi(arg)))
671             {
672                config->feature_flags |= RUNTIME_FEATURE_CGI_TOGGLE;
673             }
674             else
675             {
676                config->feature_flags &= ~RUNTIME_FEATURE_CGI_TOGGLE;
677             }
678             continue;
679 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
680
681 /****************************************************************************
682  * forward url-pattern (.|http-proxy-host[:port])
683  ****************************************************************************/
684          case hash_forward:
685             vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
686
687             if (vec_count != 2)
688             {
689                log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for forward "
690                      "directive in configuration file.");
691                config->proxy_args = strsav( config->proxy_args,
692                   "<br>\nWARNING: Wrong number of parameters for "
693                   "forward directive in configuration file.");
694                continue;
695             }
696
697             /* allocate a new node */
698             cur_fwd = zalloc(sizeof(*cur_fwd));
699             if (cur_fwd == NULL)
700             {
701                log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
702                /* Never get here - LOG_LEVEL_FATAL causes program exit */
703                continue;
704             }
705
706             cur_fwd->type = SOCKS_NONE;
707
708             /* Save the URL pattern */
709             if (create_url_spec(cur_fwd->url, vec[0]))
710             {
711                log_error(LOG_LEVEL_ERROR, "Bad URL specifier for forward "
712                      "directive in configuration file.");
713                config->proxy_args = strsav( config->proxy_args,
714                   "<br>\nWARNING: Bad URL specifier for "
715                   "forward directive in configuration file.");
716                continue;
717             }
718
719             /* Parse the parent HTTP proxy host:port */
720             p = vec[1];
721
722             if (strcmp(p, ".") != 0)
723             {
724                cur_fwd->forward_host = strdup(p);
725
726                if ((p = strchr(cur_fwd->forward_host, ':')))
727                {
728                   *p++ = '\0';
729                   cur_fwd->forward_port = atoi(p);
730                }
731
732                if (cur_fwd->forward_port <= 0)
733                {
734                   cur_fwd->forward_port = 8000;
735                }
736             }
737
738             /* Add to list. */
739             cur_fwd->next = config->forward;
740             config->forward = cur_fwd;
741
742             continue;
743
744 /****************************************************************************
745  * forward-socks4 url-pattern socks-proxy[:port] (.|http-proxy[:port])
746  ****************************************************************************/
747          case hash_forward_socks4:
748             vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
749
750             if (vec_count != 3)
751             {
752                log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
753                      "forward-socks4 directive in configuration file.");
754                config->proxy_args = strsav( config->proxy_args,
755                   "<br>\nWARNING: Wrong number of parameters for "
756                   "forward-socks4 directive in configuration file.");
757                continue;
758             }
759
760             /* allocate a new node */
761             cur_fwd = zalloc(sizeof(*cur_fwd));
762             if (cur_fwd == NULL)
763             {
764                log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
765                /* Never get here - LOG_LEVEL_FATAL causes program exit */
766                continue;
767             }
768
769             cur_fwd->type = SOCKS_4;
770
771             /* Save the URL pattern */
772             if (create_url_spec(cur_fwd->url, vec[0]))
773             {
774                log_error(LOG_LEVEL_ERROR, "Bad URL specifier for forward-socks4 "
775                      "directive in configuration file.");
776                config->proxy_args = strsav( config->proxy_args,
777                   "<br>\nWARNING: Bad URL specifier for "
778                   "forward-socks4 directive in configuration file.");
779                continue;
780             }
781
782             /* Parse the SOCKS proxy host[:port] */
783             p = vec[1];
784
785             if (strcmp(p, ".") != 0)
786             {
787                cur_fwd->gateway_host = strdup(p);
788
789                if ((p = strchr(cur_fwd->gateway_host, ':')))
790                {
791                   *p++ = '\0';
792                   cur_fwd->gateway_port = atoi(p);
793                }
794                if (cur_fwd->gateway_port <= 0)
795                {
796                   cur_fwd->gateway_port = 1080;
797                }
798             }
799
800             /* Parse the parent HTTP proxy host[:port] */
801             p = vec[2];
802
803             if (strcmp(p, ".") != 0)
804             {
805                cur_fwd->forward_host = strdup(p);
806
807                if ((p = strchr(cur_fwd->forward_host, ':')))
808                {
809                   *p++ = '\0';
810                   cur_fwd->forward_port = atoi(p);
811                }
812
813                if (cur_fwd->forward_port <= 0)
814                {
815                   cur_fwd->forward_port = 8000;
816                }
817             }
818
819             /* Add to list. */
820             cur_fwd->next = config->forward;
821             config->forward = cur_fwd;
822
823             continue;
824
825 /****************************************************************************
826  * forward-socks4a url-pattern socks-proxy[:port] (.|http-proxy[:port])
827  ****************************************************************************/
828          case hash_forward_socks4a:
829             vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
830
831             if (vec_count != 3)
832             {
833                log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
834                      "forward-socks4a directive in configuration file.");
835                config->proxy_args = strsav( config->proxy_args,
836                   "<br>\nWARNING: Wrong number of parameters for "
837                   "forward-socks4a directive in configuration file.");
838                continue;
839             }
840
841             /* allocate a new node */
842             cur_fwd = zalloc(sizeof(*cur_fwd));
843             if (cur_fwd == NULL)
844             {
845                log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
846                /* Never get here - LOG_LEVEL_FATAL causes program exit */
847                continue;
848             }
849
850             cur_fwd->type = SOCKS_4A;
851
852             /* Save the URL pattern */
853             if (create_url_spec(cur_fwd->url, vec[0]))
854             {
855                log_error(LOG_LEVEL_ERROR, "Bad URL specifier for forward-socks4a "
856                      "directive in configuration file.");
857                config->proxy_args = strsav( config->proxy_args,
858                   "<br>\nWARNING: Bad URL specifier for "
859                   "forward-socks4a directive in configuration file.");
860                continue;
861             }
862
863             /* Parse the SOCKS proxy host[:port] */
864             p = vec[1];
865
866             cur_fwd->gateway_host = strdup(p);
867
868             if ((p = strchr(cur_fwd->gateway_host, ':')))
869             {
870                *p++ = '\0';
871                cur_fwd->gateway_port = atoi(p);
872             }
873             if (cur_fwd->gateway_port <= 0)
874             {
875                cur_fwd->gateway_port = 1080;
876             }
877
878             /* Parse the parent HTTP proxy host[:port] */
879             p = vec[2];
880
881             if (strcmp(p, ".") != 0)
882             {
883                cur_fwd->forward_host = strdup(p);
884
885                if ((p = strchr(cur_fwd->forward_host, ':')))
886                {
887                   *p++ = '\0';
888                   cur_fwd->forward_port = atoi(p);
889                }
890
891                if (cur_fwd->forward_port <= 0)
892                {
893                   cur_fwd->forward_port = 8000;
894                }
895             }
896
897             /* Add to list. */
898             cur_fwd->next = config->forward;
899             config->forward = cur_fwd;
900
901             continue;
902
903 /****************************************************************************
904  * jarfile jar-file-name
905  * In logdir by default
906  ****************************************************************************/
907 #ifdef FEATURE_COOKIE_JAR
908          case hash_jarfile :
909             freez(config->jarfile);
910             config->jarfile = make_path(config->logdir, arg);
911             continue;
912 #endif /* def FEATURE_COOKIE_JAR */
913
914 /****************************************************************************
915  * listen-address [ip][:port]
916  ****************************************************************************/
917          case hash_listen_address :
918             freez(config->haddr);
919             config->haddr = strdup(arg);
920             continue;
921
922 /****************************************************************************
923  * logdir directory-name
924  ****************************************************************************/
925          case hash_logdir :
926             freez(config->logdir);
927             config->logdir = strdup(arg);
928             continue;
929
930 /****************************************************************************
931  * logfile log-file-name
932  * In logdir by default
933  ****************************************************************************/
934          case hash_logfile :
935             freez(config->logfile);
936             config->logfile = make_path(config->logdir, arg);
937             continue;
938
939 /****************************************************************************
940  * permit-access source-ip[/significant-bits] [dest-ip[/significant-bits]]
941  ****************************************************************************/
942 #ifdef FEATURE_ACL
943          case hash_permit_access:
944             vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
945
946             if ((vec_count != 1) && (vec_count != 2))
947             {
948                log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
949                      "permit-access directive in configuration file.");
950                config->proxy_args = strsav( config->proxy_args,
951                   "<br>\nWARNING: Wrong number of parameters for "
952                   "permit-access directive in configuration file.<br><br>\n");
953
954                continue;
955             }
956
957             /* allocate a new node */
958             cur_acl = (struct access_control_list *) zalloc(sizeof(*cur_acl));
959
960             if (cur_acl == NULL)
961             {
962                log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
963                /* Never get here - LOG_LEVEL_FATAL causes program exit */
964                continue;
965             }
966             cur_acl->action = ACL_PERMIT;
967
968             if (acl_addr(vec[0], cur_acl->src) < 0)
969             {
970                log_error(LOG_LEVEL_ERROR, "Invalid source IP for permit-access "
971                      "directive in configuration file: \"%s\"", vec[0]);
972                config->proxy_args = strsav( config->proxy_args,
973                   "<br>\nWARNING: Invalid source IP for permit-access directive"
974                   " in configuration file: \"");
975                config->proxy_args = strsav( config->proxy_args,
976                   vec[0]);
977                config->proxy_args = strsav( config->proxy_args,
978                   "\"<br><br>\n");
979                freez(cur_acl);
980                continue;
981             }
982             if (vec_count == 2)
983             {
984                if (acl_addr(vec[1], cur_acl->dst) < 0)
985                {
986                   log_error(LOG_LEVEL_ERROR, "Invalid destination IP for "
987                         "permit-access directive in configuration file: \"%s\"",
988                         vec[0]);
989                   config->proxy_args = strsav( config->proxy_args,
990                      "<br>\nWARNING: Invalid destination IP for permit-access directive"
991                      " in configuration file: \"");
992                   config->proxy_args = strsav( config->proxy_args,
993                      vec[0]);
994                   config->proxy_args = strsav( config->proxy_args,
995                      "\"<br><br>\n");
996                   freez(cur_acl);
997                   continue;
998                }
999             }
1000
1001             /*
1002              * Add it to the list.  Note we reverse the list to get the
1003              * behaviour the user expects.  With both the ACL and
1004              * actions file, the last match wins.  However, the internal
1005              * implementations are different:  The actions file is stored
1006              * in the same order as the file, and scanned completely.
1007              * With the ACL, we reverse the order as we load it, then
1008              * when we scan it we stop as soon as we get a match.
1009              */
1010             cur_acl->next  = config->acl;
1011             config->acl = cur_acl;
1012
1013             continue;
1014 #endif /* def FEATURE_ACL */
1015
1016 /****************************************************************************
1017  * proxy-info-url url
1018  ****************************************************************************/
1019          case hash_proxy_info_url :
1020             freez(config->proxy_info_url);
1021             config->proxy_info_url = strdup(arg);
1022             continue;
1023
1024 /****************************************************************************
1025  * re_filterfile file-name
1026  * In confdir by default.
1027  ****************************************************************************/
1028          case hash_re_filterfile :
1029             freez(config->re_filterfile);
1030             config->re_filterfile = make_path(config->confdir, arg);
1031             continue;
1032
1033 /****************************************************************************
1034  * single-threaded
1035  ****************************************************************************/
1036          case hash_single_threaded :
1037             config->multi_threaded = 0;
1038             continue;
1039
1040 /****************************************************************************
1041  * toggle (0|1)
1042  ****************************************************************************/
1043 #ifdef FEATURE_TOGGLE
1044          case hash_toggle :
1045             g_bToggleIJB = atoi(arg);
1046             continue;
1047 #endif /* def FEATURE_TOGGLE */
1048
1049 /****************************************************************************
1050  * trust-info-url url
1051  ****************************************************************************/
1052 #ifdef FEATURE_TRUST
1053          case hash_trust_info_url :
1054             enlist(config->trust_info, arg);
1055             continue;
1056 #endif /* def FEATURE_TRUST */
1057
1058 /****************************************************************************
1059  * trustfile filename
1060  * (In confdir by default.)
1061  ****************************************************************************/
1062 #ifdef FEATURE_TRUST
1063          case hash_trustfile :
1064             freez(config->trustfile);
1065             config->trustfile = make_path(config->confdir, arg);
1066             continue;
1067 #endif /* def FEATURE_TRUST */
1068
1069
1070 /****************************************************************************
1071  * Win32 Console options:
1072  ****************************************************************************/
1073
1074 /****************************************************************************
1075  * hide-console
1076  ****************************************************************************/
1077 #ifdef _WIN_CONSOLE
1078          case hash_hide_console :
1079             hideConsole = 1;
1080             continue;
1081 #endif /*def _WIN_CONSOLE*/
1082
1083
1084 /****************************************************************************
1085  * Win32 GUI options:
1086  ****************************************************************************/
1087
1088 #if defined(_WIN32) && ! defined(_WIN_CONSOLE)
1089 /****************************************************************************
1090  * activity-animation (0|1)
1091  ****************************************************************************/
1092          case hash_activity_animation :
1093             g_bShowActivityAnimation = atoi(arg);
1094             continue;
1095
1096 /****************************************************************************
1097  *  close-button-minimizes (0|1)
1098  ****************************************************************************/
1099          case hash_close_button_minimizes :
1100             g_bCloseHidesWindow = atoi(arg);
1101             continue;
1102
1103 /****************************************************************************
1104  * log-buffer-size (0|1)
1105  ****************************************************************************/
1106          case hash_log_buffer_size :
1107             g_bLimitBufferSize = atoi(arg);
1108             continue;
1109
1110 /****************************************************************************
1111  * log-font-name fontnane
1112  ****************************************************************************/
1113          case hash_log_font_name :
1114             strcpy( g_szFontFaceName, arg );
1115             continue;
1116
1117 /****************************************************************************
1118  * log-font-size n
1119  ****************************************************************************/
1120          case hash_log_font_size :
1121             g_nFontSize = atoi(arg);
1122             continue;
1123
1124 /****************************************************************************
1125  * log-highlight-messages (0|1)
1126  ****************************************************************************/
1127          case hash_log_highlight_messages :
1128             g_bHighlightMessages = atoi(arg);
1129             continue;
1130
1131 /****************************************************************************
1132  * log-max-lines n
1133  ****************************************************************************/
1134          case hash_log_max_lines :
1135             g_nMaxBufferLines = atoi(arg);
1136             continue;
1137
1138 /****************************************************************************
1139  * log-messages (0|1)
1140  ****************************************************************************/
1141          case hash_log_messages :
1142             g_bLogMessages = atoi(arg);
1143             continue;
1144
1145 /****************************************************************************
1146  * show-on-task-bar (0|1)
1147  ****************************************************************************/
1148          case hash_show_on_task_bar :
1149             g_bShowOnTaskBar = atoi(arg);
1150             continue;
1151
1152 #endif /* defined(_WIN32) && ! defined(_WIN_CONSOLE) */
1153
1154
1155 /****************************************************************************/
1156 /* Warnings about unsupported features                                      */
1157 /****************************************************************************/
1158 #ifndef FEATURE_ACL
1159          case hash_deny_access:
1160 #endif /* ndef FEATURE_ACL */
1161 #ifndef FEATURE_CGI_EDIT_ACTIONS
1162          case hash_enable_edit_actions:
1163          case hash_enable_remote_toggle:
1164 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
1165 #ifndef FEATURE_COOKIE_JAR
1166          case hash_jarfile :
1167 #endif /* ndef FEATURE_COOKIE_JAR */
1168 #ifndef FEATURE_ACL
1169          case hash_permit_access:
1170 #endif /* ndef FEATURE_ACL */
1171 #ifndef FEATURE_TOGGLE
1172          case hash_toggle :
1173 #endif /* ndef FEATURE_TOGGLE */
1174 #ifndef FEATURE_TRUST
1175          case hash_trustfile :
1176          case hash_trust_info_url :
1177 #endif /* ndef FEATURE_TRUST */
1178
1179 #ifndef _WIN_CONSOLE
1180          case hash_hide_console :
1181 #endif /* ndef _WIN_CONSOLE */
1182
1183 #if defined(_WIN_CONSOLE) || ! defined(_WIN32)
1184          case hash_activity_animation :
1185          case hash_close_button_minimizes :
1186          case hash_log_buffer_size :
1187          case hash_log_font_name :
1188          case hash_log_font_size :
1189          case hash_log_highlight_messages :
1190          case hash_log_max_lines :
1191          case hash_log_messages :
1192          case hash_show_on_task_bar :
1193 #endif /* defined(_WIN_CONSOLE) || ! defined(_WIN32) */
1194             /* These warnings are annoying - so hide them. -- Jon */
1195             /* log_error(LOG_LEVEL_INFO, "Unsupported directive \"%s\" ignored.", cmd); */
1196             continue;
1197
1198 /****************************************************************************/
1199          default :
1200 /****************************************************************************/
1201             /*
1202              * I decided that I liked this better as a warning than an
1203              * error.  To change back to an error, just change log level
1204              * to LOG_LEVEL_FATAL.
1205              */
1206             log_error(LOG_LEVEL_ERROR, "Unrecognized directive (%luul) in "
1207                   "configuration file: \"%s\"", hash_string( cmd ), buf);
1208             config->proxy_args = strsav( config->proxy_args, "<br>\nWARNING: unrecognized directive : ");
1209             config->proxy_args = strsav( config->proxy_args, buf);
1210             config->proxy_args = strsav( config->proxy_args, "<br><br>\n");
1211             continue;
1212
1213 /****************************************************************************/
1214       } /* end switch( hash_string(cmd) ) */
1215    } /* end while ( read_config_line(...) ) */
1216
1217    fclose(configfp);
1218
1219    init_error_log(Argv[0], config->logfile, config->debug);
1220
1221    if (config->actions_file)
1222    {
1223       add_loader(load_actions_file, config);
1224    }
1225
1226    if (config->re_filterfile)
1227    {
1228       add_loader(load_re_filterfile, config);
1229    }
1230
1231 #ifdef FEATURE_TRUST
1232    if (config->trustfile)
1233    {
1234       add_loader(load_trustfile, config);
1235    }
1236 #endif /* def FEATURE_TRUST */
1237
1238 #ifdef FEATURE_COOKIE_JAR
1239    if ( NULL != config->jarfile )
1240    {
1241       if ( NULL == (config->jar = fopen(config->jarfile, "a")) )
1242       {
1243          log_error(LOG_LEVEL_FATAL, "can't open jarfile '%s': %E", config->jarfile);
1244          /* Never get here - LOG_LEVEL_FATAL causes program exit */
1245       }
1246       setbuf(config->jar, NULL);
1247    }
1248 #endif /* def FEATURE_COOKIE_JAR */
1249
1250    if ( NULL == config->haddr )
1251    {
1252       config->haddr = strdup( HADDR_DEFAULT );
1253    }
1254
1255    if ( NULL != config->haddr )
1256    {
1257       if ((p = strchr(config->haddr, ':')))
1258       {
1259          *p++ = '\0';
1260          if (*p)
1261          {
1262             config->hport = atoi(p);
1263          }
1264       }
1265
1266       if (config->hport <= 0)
1267       {
1268          *--p = ':';
1269          log_error(LOG_LEVEL_FATAL, "invalid bind port spec %s", config->haddr);
1270          /* Never get here - LOG_LEVEL_FATAL causes program exit */
1271       }
1272       if (*config->haddr == '\0')
1273       {
1274          config->haddr = NULL;
1275       }
1276    }
1277
1278    /*
1279     * Want to run all the loaders once now.
1280     *
1281     * Need to set up a fake csp, so they can get to the config.
1282     */
1283    fake_csp = (struct client_state *) zalloc (sizeof(*fake_csp));
1284    fake_csp->config = config;
1285
1286    if (run_loader(fake_csp))
1287    {
1288       freez(fake_csp);
1289       log_error(LOG_LEVEL_FATAL, "A loader failed while loading config file. Exiting.");
1290       /* Never get here - LOG_LEVEL_FATAL causes program exit */
1291    }
1292    freez(fake_csp);
1293
1294 /* FIXME: this is a kludge for win32 */
1295 #if defined(_WIN32) && !defined (_WIN_CONSOLE)
1296
1297    g_actions_file     = config->actions_file;
1298    g_re_filterfile    = config->re_filterfile;
1299
1300 #ifdef FEATURE_TRUST
1301    g_trustfile        = config->trustfile;
1302 #endif /* def FEATURE_TRUST */
1303
1304
1305 #endif /* defined(_WIN32) && !defined (_WIN_CONSOLE) */
1306 /* FIXME: end kludge */
1307
1308
1309    config->need_bind = 1;
1310
1311    if (current_configfile)
1312    {
1313       struct configuration_spec * oldcfg = (struct configuration_spec *)
1314                                            current_configfile->f;
1315       /*
1316        * Check if config->haddr,hport == oldcfg->haddr,hport
1317        *
1318        * The following could be written more compactly as a single,
1319        * (unreadably long) if statement.
1320        */
1321       config->need_bind = 0;
1322       if (config->hport != oldcfg->hport)
1323       {
1324          config->need_bind = 1;
1325       }
1326       else if (config->haddr == NULL)
1327       {
1328          if (oldcfg->haddr != NULL)
1329          {
1330             config->need_bind = 1;
1331          }
1332       }
1333       else if (oldcfg->haddr == NULL)
1334       {
1335          config->need_bind = 1;
1336       }
1337       else if (0 != strcmp(config->haddr, oldcfg->haddr))
1338       {
1339          config->need_bind = 1;
1340       }
1341
1342       current_configfile->unloader = unload_configfile;
1343    }
1344
1345    fs->next = files->next;
1346    files->next = fs;
1347
1348    current_configfile = fs;
1349
1350    return (config);
1351 }
1352
1353
1354 /*********************************************************************
1355  *
1356  * Function    :  savearg
1357  *
1358  * Description :  Called from `load_config'.  It saves each non-empty
1359  *                and non-comment line from config into a list.  This
1360  *                list is used to create the show-proxy-args page.
1361  *
1362  * Parameters  :
1363  *          1  :  c = config setting that was found
1364  *          2  :  o = the setting's argument (if any)
1365  *
1366  * Returns     :  N/A
1367  *
1368  *********************************************************************/
1369 static void savearg(char *c, char *o, struct configuration_spec * config)
1370 {
1371    char buf[BUFFER_SIZE];
1372
1373    *buf = '\0';
1374
1375    if ( ( NULL != c ) && ( '\0' != *c ) )
1376    {
1377       if ((c = html_encode(c)))
1378       {
1379          sprintf(buf, "<a href=\"" REDIRECT_URL "option#%s\">%s</a> ", c, c);
1380       }
1381       freez(c);
1382    }
1383    if ( ( NULL != o ) && ( '\0' != *o ) )
1384    {
1385       if ((o = html_encode(o)))
1386       {
1387          if (strncmpic(o, "http://", 7) == 0)
1388          {
1389             strcat(buf, "<a href=\"");
1390             strcat(buf, o);
1391             strcat(buf, "\">");
1392             strcat(buf, o);
1393             strcat(buf, "</a>");
1394          }
1395          else
1396          {
1397             strcat(buf, o);
1398          }
1399       }
1400       freez(o);
1401    }
1402
1403    strcat(buf, "<br>\n");
1404
1405    config->proxy_args = strsav(config->proxy_args, buf);
1406
1407 }
1408
1409
1410 /*
1411   Local Variables:
1412   tab-width: 3
1413   end:
1414 */