Removing last hardcoded JunkBusters.com URLs.
[privoxy.git] / loadcfg.c
1 const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.2 2001/05/17 23:01:01 oes 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.2  2001/05/17 23:01:01  oes
39  *     - Cleaned CRLF's from the sources and related files
40  *
41  *    Revision 1.1.1.1  2001/05/15 13:58:58  oes
42  *    Initial import of version 2.9.3 source tree
43  *
44  *
45  *********************************************************************/
46 \f
47
48 #include "config.h"
49
50 #include <stdio.h>
51 #include <sys/types.h>
52 #include <stdlib.h>
53 #include <string.h>
54 #include <signal.h>
55 #include <fcntl.h>
56 #include <errno.h>
57 #include <ctype.h>
58
59 #ifdef _WIN32
60
61 # include <sys/timeb.h>
62 # include <windows.h>
63 # include <io.h>
64 # include <process.h>
65 # ifdef TOGGLE
66 #  include <time.h>
67 # endif /* def TOGGLE */
68
69 # include "win32.h"
70 # ifndef _WIN_CONSOLE
71 #  include "w32log.h"
72 # endif /* ndef _WIN_CONSOLE */
73
74 #else /* ifndef _WIN32 */
75
76 # include <unistd.h>
77 # include <sys/time.h>
78 # include <sys/wait.h>
79 # include <sys/stat.h>
80 # include <signal.h>
81
82 #endif
83
84 #include "loadcfg.h"
85 #include "jcc.h"
86 #include "filters.h"
87 #include "loaders.h"
88 #include "showargs.h"
89 #include "parsers.h"
90 #include "killpopup.h"
91 #include "miscutil.h"
92 #include "errlog.h"
93 #include "jbsockets.h"
94 #include "gateway.h"
95
96 const char loadcfg_h_rcs[] = LOADCFG_H_VERSION;
97
98 /*
99  * Fix a problem with Solaris.  There should be no effect on other
100  * platforms.
101  * Solaris's isspace() is a macro which uses it's argument directly
102  * as an array index.  Therefore we need to make sure that high-bit
103  * characters generate +ve values, and ideally we also want to make
104  * the argument match the declared parameter type of "int".
105  */
106 #define ijb_isupper(__X) isupper((int)(unsigned char)(__X))
107 #define ijb_tolower(__X) tolower((int)(unsigned char)(__X))
108
109 static const char VANILLA_WAFER[] =
110    "NOTICE=TO_WHOM_IT_MAY_CONCERN_"
111    "Do_not_send_me_any_copyrighted_information_other_than_the_"
112    "document_that_I_am_requesting_or_any_of_its_necessary_components._"
113    "In_particular_do_not_send_me_any_cookies_that_"
114    "are_subject_to_a_claim_of_copyright_by_anybody._"
115    "Take_notice_that_I_refuse_to_be_bound_by_any_license_condition_"
116    "(copyright_or_otherwise)_applying_to_any_cookie._";
117
118 #ifdef TOGGLE
119 /* by haroon - indicates if ijb is enabled */
120 int g_bToggleIJB        = 1;   /* JunkBusters is enabled by default. */
121 #endif
122
123 int debug               = 0;
124 int multi_threaded      = 1;
125
126 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
127 int tinygif             = 0;
128 const char *tinygifurl  = NULL;
129 #endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
130
131 const char *logfile     = NULL;
132
133 const char *configfile  = NULL;
134
135 const char *blockfile   = NULL;
136 const char *permissions_file  = NULL;
137 const char *forwardfile = NULL;
138
139 #ifdef ACL_FILES
140 const char *aclfile     = NULL;
141 #endif /* def ACL_FILES */
142
143 #ifdef USE_IMAGE_LIST
144 const char *imagefile   = NULL;
145 #endif /* def USE_IMAGE_LIST */
146 \r
147 /*\r
148  * Permissions to use for URLs not in the permissions list.\r
149  */
150 int default_permissions = PERMIT_RE_FILTER;\r
151
152 #ifdef PCRS
153 const char *re_filterfile = NULL;
154 #endif /* def PCRS */
155
156 #ifdef TRUST_FILES
157 const char *trustfile   = NULL;
158 #endif /* def TRUST_FILES */
159
160 #ifdef JAR_FILES
161 const char *jarfile     = NULL;
162 FILE *jar = NULL;
163 #endif /* def JAR_FILES */
164
165 const char *referrer    = NULL;
166 const char *uagent      = NULL;
167 const char *from        = NULL;
168
169 #ifndef SPLIT_PROXY_ARGS
170 const char *suppress_message = NULL;
171 #endif /* ndef SPLIT_PROXY_ARGS */
172
173 int suppress_vanilla_wafer = 0;
174 int add_forwarded          = 0;
175
176 struct list wafer_list[1];
177 struct list xtra_list[1];
178
179 #ifdef TRUST_FILES
180 struct list trust_info[1];
181 struct url_spec *trust_list[64];
182 #endif /* def TRUST_FILES */
183
184 /*
185  * Port and IP to bind to.
186  * Defaults to HADDR_DEFAULT:HADDR_PORT == 127.0.0.1:8000
187  */
188 const char *haddr = NULL;
189 int         hport = 0;
190
191 #ifndef SPLIT_PROXY_ARGS
192 int suppress_blocklists = 0;  /* suppress listing sblock and simage */
193 #endif /* ndef SPLIT_PROXY_ARGS */
194
195 struct proxy_args proxy_args[1];
196
197 int configret = 0;
198 int config_changed = 0;
199
200
201 /*
202  * The load_config function is now going to call `init_proxy_args',
203  * so it will need argc and argv.  Since load_config will also be
204  * a signal handler, we need to have these globally available.
205  */
206 int Argc = 0;
207 const char **Argv = NULL;
208
209
210 /*
211  * This takes the "cryptic" hash of each keyword and aliases them to
212  * something a little more readable.  This also makes changing the
213  * hash values easier if they should change or the hash algorthm changes.
214  * Use the included "hash" program to find out what the hash will be
215  * for any string supplied on the command line.  (Or just put it in the\r
216  * config file and read the number from the error message in the log).
217  */
218
219 #define hash_trustfile                 56494766ul
220 #define hash_trust_info_url            449869467ul
221 #define hash_debug                     78263ul
222 #define hash_tinygif                   2227702ul
223 #define hash_add_forwarded_header      3191044770ul
224 #define hash_single_threaded           4250084780ul
225 #define hash_suppress_vanilla_wafer    3121233547ul
226 #define hash_wafer                     89669ul
227 #define hash_add_header                237434619ul
228 #define hash_permissions_file          3825730796lu /* "permissionsfile" */\r
229 #define hash_logfile                   2114766ul
230 #define hash_blockfile                 48845391ul
231 #define hash_imagefile                 51447891ul
232 #define hash_jarfile                   2046641ul
233 #define hash_listen_address            1255650842ul
234 #define hash_forwardfile               1268669141ul
235 #define hash_aclfile                   1908516ul
236 #define hash_re_filterfile             3877522444ul
237 #define hash_user_agent                283326691ul
238 #define hash_referrer                  10883969ul
239 #define hash_referer                   2176719ul
240 #define hash_from                      16264ul
241 #define hash_hide_console              2048809870ul
242 #define hash_include_stats             2174146548ul
243 #define hash_suppress_blocklists       1948693308ul
244 #define hash_toggle                    447966ul
245
246 #define hash_activity_animation        1817904738ul
247 #define hash_log_messages              2291744899ul
248 #define hash_log_highlight_messages    4032101240ul
249 #define hash_log_buffer_size           2918070425ul
250 #define hash_log_max_lines             2868344173ul
251 #define hash_log_font_name             2866730124ul
252 #define hash_log_font_size             2866731014ul
253 #define hash_show_on_task_bar          215410365ul
254 #define hash_close_button_minimizes    3651284693ul
255
256
257 /*********************************************************************
258  *
259  * Function    :  load_config
260  *
261  * Description :  Load the config file and all parameters.
262  *
263  * Parameters  :
264  *          1  :  signum : this can be the signal SIGHUP or 0 (if from main).
265  *                In any case, we just ignore this and reload the config file.
266  *
267  * Returns     :  configret : 0 => Ok, everything else is an error.
268  *                Note: we use configret since a signal handler cannot
269  *                return a value, and this function does double duty.
270  *                Ie. Is is called from main and from signal( SIGHUP );\r
271  *
272  *********************************************************************/
273 void load_config( int signum )
274 {
275    char buf[BUFSIZ];
276    char *p, *q;
277    FILE *configfp = NULL;
278
279    configret = 0; /* FIXME: This is obsolete, always 0. */
280    config_changed = 1;
281
282    log_error(LOG_LEVEL_INFO, "loading configuration file '%s':", configfile);
283
284    init_proxy_args(Argc, Argv);
285
286
287    /* (Waste of memory [not quite a "leak"] here.  The 
288     * last blockfile/permissions file/... etc will not be 
289     * unloaded until we load a new one.  If the 
290     * block/... feature has been disabled in 
291     * the new config file, then we're wasting some 
292     * memory we could otherwise reclaim.
293     */
294
295    /* Disable all loaders. */
296    remove_all_loaders();
297
298    /*
299     * Reset to as close to startup state as we can.
300     * But leave changing the logfile until after we're done loading.
301     */
302
303 #ifdef JAR_FILES
304    if ( NULL != jar )
305    {
306       fclose( jar );
307       jar = NULL;
308    }
309 #endif /* def JAR_FILES */
310
311    debug             = 0;
312    multi_threaded    = 1;\r
313 \r
314    default_permissions = PERMIT_RE_FILTER;
315
316 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
317    tinygif           = 0;
318    freez((char *)tinygifurl);
319 #endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
320
321    suppress_vanilla_wafer = 0;
322    add_forwarded     = 0;
323    hport             = HADDR_PORT;
324
325 #ifdef _WIN_CONSOLE
326    hideConsole       = 0;
327 #endif /*def _WIN_CONSOLE*/
328
329 #ifdef TOGGLE
330    g_bToggleIJB      = 1;
331 #endif
332
333 #ifdef STATISTICS
334    urls_read         = 0;
335    urls_rejected     = 0;
336 #endif /* def STATISTICS */
337
338 #ifndef SPLIT_PROXY_ARGS
339    suppress_blocklists = 0;
340 #endif /* ndef SPLIT_PROXY_ARGS */
341
342    freez((char *)from);
343    freez((char *)haddr);
344    freez((char *)uagent);
345    freez((char *)referrer);
346    freez((char *)logfile);
347
348
349    freez((char *)blockfile);
350    freez((char *)permissions_file);
351    freez((char *)forwardfile);
352
353 #ifdef ACL_FILES
354    freez((char *)aclfile);
355 #endif /* def ACL_FILES */
356
357 #ifdef USE_IMAGE_LIST
358    freez((char *)imagefile);
359 #endif /* def USE_IMAGE_LIST */
360
361 #ifdef JAR_FILES
362    freez((char *)jarfile);
363 #endif /* def JAR_FILES */
364
365 #ifndef SPLIT_PROXY_ARGS
366    freez((char *)suppress_message);
367 #endif /* ndef SPLIT_PROXY_ARGS */
368
369 #ifdef TRUST_FILES
370    freez((char *)trustfile);
371 #endif /* def TRUST_FILES */
372
373 #ifdef PCRS
374    freez((char *)re_filterfile);
375 #endif /* def PCRS */
376
377    if (NULL != configfile)
378    {
379       if ((configfp = fopen(configfile, "r")) == NULL)
380       {
381          log_error(LOG_LEVEL_FATAL, "can't open configuration file '%s':  %E",
382                  configfile);
383          /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
384       }
385    }
386
387    if (NULL != configfp)
388    {
389       memset (buf, 'j', sizeof(buf));
390       while (read_config_line(buf, sizeof(buf), configfp, NULL) != NULL)
391       {
392          char cmd[BUFSIZ];
393          char arg[BUFSIZ];
394          char tmp[BUFSIZ];
395
396          strcpy(tmp, buf);
397
398          /* Copy command (i.e. up to space or tab) into cmd */
399          p = buf;
400          q = cmd;
401          while (*p && (*p != ' ') && (*p != '\t'))
402          {
403             *q++ = *p++;
404          }
405          *q = '\0';
406
407          /* Skip over the whitespace in buf */
408          while (*p && ((*p == ' ') || (*p == '\t')))
409          {
410             p++;
411          }
412
413          /* Copy the argument into arg */
414          strcpy(arg, p);
415
416          /* Should never happen, but check this anyway */
417          if (*cmd == '\0')
418          {
419             continue;
420          }
421
422          /* Make sure the command field is lower case */
423          for (p=cmd; *p; p++)
424          {
425             if (ijb_isupper(*p))
426             {
427                *p = ijb_tolower(*p);
428             }
429          }
430
431          /* Save the argument for show-proxy-args */
432          savearg(cmd, arg);
433
434
435          switch( hash_string( cmd ) )
436          {
437 #ifdef TRUST_FILES
438             case hash_trustfile :
439                freez((char *)trustfile);
440                trustfile = strdup(arg);
441                continue;
442
443             case hash_trust_info_url :
444                enlist(trust_info, arg);
445                continue;
446 #endif /* def TRUST_FILES */
447
448             case hash_debug :
449                debug |= atoi(arg);
450                continue;
451
452 #if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST)
453             case hash_tinygif :
454                freez((char *)tinygifurl);
455                tinygif = atoi(arg);
456                if(3 == tinygif)
457                {
458                   p = arg;
459                   while((*p >= '0') && (*p <= '9'))
460                   {
461                      p++;
462                   }
463                   while((*p == ' ') || (*p == '\t'))
464                   {
465                      p++;
466                   }
467                   if (*p)
468                   {
469                      q = malloc(strlen(p) + 5);
470                      if (q)
471                      {
472                         strcpy(q, p);
473                         strcat(q, "\r\n\r\n");
474                         tinygifurl = q;
475                      }
476                   }
477                }
478                if ((tinygif != 1) && 
479                    (tinygif != 2) && 
480                    ((tinygif != 3) || (tinygifurl==NULL)) )
481                {
482                   log_error(LOG_LEVEL_ERROR, "tinygif setting invalid.");
483                }
484                continue;
485 #endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
486
487             case hash_add_forwarded_header :
488                add_forwarded = 1;
489                continue;
490
491             case hash_single_threaded :
492                multi_threaded = 0;
493                continue;
494
495             case hash_suppress_vanilla_wafer :
496                suppress_vanilla_wafer = 1;
497                continue;
498
499             case hash_wafer :
500                enlist(wafer_list, arg);
501                continue;
502
503             case hash_add_header :
504                enlist(xtra_list, arg);
505                continue;
506
507             case hash_permissions_file :
508                freez((char *)permissions_file);
509                permissions_file = strdup(arg);
510                continue;
511
512             case hash_logfile :
513                freez((char *)logfile);
514                logfile = strdup(arg);
515                continue;
516
517             case hash_blockfile :
518                freez((char *)blockfile);
519                blockfile = strdup(arg);
520                continue;
521
522 #ifdef USE_IMAGE_LIST
523             case hash_imagefile :
524                freez((char *)imagefile);
525                imagefile = strdup(arg);
526                continue;
527 #endif /* def USE_IMAGE_LIST */
528
529 #ifdef JAR_FILES
530             case hash_jarfile :
531                freez((char *)jarfile);
532                jarfile = strdup(arg);
533                continue;
534 #endif /* def JAR_FILES */
535
536             case hash_listen_address :
537                freez((char *)haddr);
538                haddr = strdup(arg);
539                continue;
540
541             case hash_forwardfile :
542                freez((char *)forwardfile);
543                forwardfile = strdup(arg);
544                continue;
545
546 #ifdef ACL_FILES
547             case hash_aclfile :
548                freez((char *)aclfile);
549                aclfile = strdup(arg);
550                continue;
551 #endif /* def ACL_FILES */
552
553 #ifdef PCRS
554             case hash_re_filterfile :
555                freez((char *)re_filterfile);
556                re_filterfile = strdup(arg);
557                continue;
558 #endif /* def PCRS */
559
560             case hash_user_agent :
561                freez((char *)uagent);
562                uagent = strdup(arg);
563                continue;
564
565                /*
566                 * Offer choice of correct spelling according to dictionary,
567                 * or the misspelling used in the HTTP spec.
568                 */
569             case hash_referrer :
570             case hash_referer :
571                freez((char *)referrer);
572                referrer = strdup(arg);
573                continue;
574
575             case hash_from :
576                freez((char *)from);
577                from = strdup(arg);
578                continue;
579
580 #ifdef _WIN_CONSOLE
581             case hash_hide_console :
582                hideConsole = 1;
583                continue;
584 #endif /*def _WIN_CONSOLE*/
585
586 #ifndef SPLIT_PROXY_ARGS
587             case hash_suppress_blocklists :
588                if (arg[0] != '\0')
589                {
590                   suppress_message = strdup(arg);
591                }
592                else
593                {
594                   /* There will be NO reference in proxy-args. */
595                   suppress_message = NULL;
596                }
597
598                suppress_blocklists = 1;
599                continue;
600 #endif /* ndef SPLIT_PROXY_ARGS */
601
602 #ifdef TOGGLE
603             case hash_toggle :
604                g_bToggleIJB = atoi(arg);
605                continue;
606 #endif /* def TOGGLE */
607
608 #if defined(_WIN32) && ! defined(_WIN_CONSOLE)
609             case hash_activity_animation :
610                g_bShowActivityAnimation = atoi(arg);
611                continue;
612
613             case hash_log_messages :
614                g_bLogMessages = atoi(arg);
615                continue;
616
617             case hash_log_highlight_messages :
618                g_bHighlightMessages = atoi(arg);
619                continue;
620
621             case hash_log_buffer_size :
622                g_bLimitBufferSize = atoi(arg);
623                continue;
624
625             case hash_log_max_lines :
626                g_nMaxBufferLines = atoi(arg);
627                continue;
628
629             case hash_log_font_name :
630                strcpy( g_szFontFaceName, arg );
631                continue;
632
633             case hash_log_font_size :
634                g_nFontSize = atoi(arg);
635                continue;
636
637             case hash_show_on_task_bar :
638                g_bShowOnTaskBar = atoi(arg);
639                continue;
640
641             case hash_close_button_minimizes :
642                g_bCloseHidesWindow = atoi(arg);
643                continue;
644 #endif /* defined(_WIN32) && ! defined(_WIN_CONSOLE) */
645
646             /* Warnings about unsupported features */
647
648 #ifndef TRUST_FILES
649             case hash_trustfile :
650             case hash_trust_info_url :
651 #endif /* ndef TRUST_FILES */
652 #ifndef USE_IMAGE_LIST
653             case hash_imagefile :
654 #endif /* ndef USE_IMAGE_LIST */
655 #ifndef PCRS
656             case hash_re_filterfile :
657 #endif /* ndef PCRS */
658 #ifndef TOGGLE
659             case hash_toggle :
660 #endif /* ndef TOGGLE */
661 #if defined(_WIN_CONSOLE) || ! defined(_WIN32)
662             case hash_activity_animation :
663             case hash_log_messages :
664             case hash_log_highlight_messages :
665             case hash_log_buffer_size :
666             case hash_log_max_lines :
667             case hash_log_font_name :
668             case hash_log_font_size :
669             case hash_show_on_task_bar :
670             case hash_close_button_minimizes :
671 #endif /* defined(_WIN_CONSOLE) || ! defined(_WIN32) */
672 #ifndef _WIN_CONSOLE
673             case hash_hide_console :
674 #endif /* ndef _WIN_CONSOLE */
675 #if !defined(DETECT_MSIE_IMAGES) && !defined(USE_IMAGE_LIST)
676             case hash_tinygif :
677 #endif /* !defined(DETECT_MSIE_IMAGES) && !defined(USE_IMAGE_LIST) */
678 #ifndef JAR_FILES
679             case hash_jarfile :
680 #endif /* ndef JAR_FILES */
681 #ifndef ACL_FILES
682             case hash_aclfile :
683 #endif /* ndef ACL_FILES */
684
685 #ifdef SPLIT_PROXY_ARGS
686             case hash_suppress_blocklists :
687 #endif /* def SPLIT_PROXY_ARGS */
688                log_error(LOG_LEVEL_INFO, "Unsupported directive \"%s\" ignored.", cmd);
689                continue;
690
691             default :
692                /*\r
693                 * I decided that I liked this better as a warning than an\r
694                 * error.  To change back to an error, just change log level\r
695                 * to LOG_LEVEL_FATAL.\r
696                 */\r
697                log_error(LOG_LEVEL_ERROR, "Unrecognized directive (%lulu) in "
698                      "configuration file: \"%s\"", hash_string( cmd ), buf);
699                p = malloc( BUFSIZ );
700                if (p != NULL)
701                {
702                   sprintf( p, "<br>\nWARNING: unrecognized directive : %s<br><br>\n", buf );
703                   proxy_args->invocation = strsav( proxy_args->invocation, p );
704                   freez( p );
705                }
706                continue;
707          }
708       }
709       fclose(configfp);
710    }
711
712    init_error_log(Argv[0], logfile, debug);
713
714    if (permissions_file)
715    {
716       add_loader(load_permissions_file);
717    }
718
719    if (blockfile)
720    {
721       add_loader(load_blockfile);
722    }
723
724 #ifdef USE_IMAGE_LIST
725    if (imagefile)
726    {
727       add_loader(load_imagefile);
728    }
729 #endif /* def USE_IMAGE_LIST */
730
731 #ifdef TRUST_FILES
732    if (trustfile)
733    {
734       add_loader(load_trustfile);
735    }
736 #endif /* def TRUST_FILES */
737
738    if (forwardfile)
739    {
740       add_loader(load_forwardfile);
741    }
742
743 #ifdef ACL_FILES
744    if (aclfile)
745    {
746       add_loader(load_aclfile);
747    }
748 #endif /* def ACL_FILES */
749
750 #ifdef PCRS
751    if (re_filterfile)
752    {
753       add_loader(load_re_filterfile);
754    }
755 #endif /* def PCRS */
756
757 #ifdef JAR_FILES
758    if ( NULL != jarfile )
759    {
760       if ( NULL == (jar = fopen(jarfile, "a")) )
761       {
762          log_error(LOG_LEVEL_FATAL, "can't open jarfile '%s': %E", jarfile);
763          /* Never get here - LOG_LEVEL_FATAL causes program exit */
764       }
765       setbuf(jar, NULL);
766    }
767 #endif /* def JAR_FILES */
768
769    if ( NULL == haddr )
770    {
771       haddr = strdup( HADDR_DEFAULT );
772    }
773
774    if ( NULL != haddr )
775    {
776       if ((p = strchr(haddr, ':')))
777       {
778          *p++ = '\0';
779          if (*p)
780          {
781             hport = atoi(p);
782          }
783       }
784
785       if (hport <= 0)
786       {
787          *--p = ':';
788          log_error(LOG_LEVEL_FATAL, "invalid bind port spec %s", haddr);
789          /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
790       }
791       if (*haddr == '\0')
792       {
793          haddr = NULL;
794       }
795    }
796
797    if (run_loader(NULL))
798    {
799       log_error(LOG_LEVEL_FATAL, "A loader failed while loading config file. Exiting.");\r
800       /* Never get here - LOG_LEVEL_FATAL causes program exit */\r
801    }
802
803 #ifdef JAR_FILES
804    /*
805     * If we're logging cookies in a cookie jar, and the user has not
806     * supplied any wafers, and the user has not told us to suppress the
807     * vanilla wafer, then send the vanilla wafer.
808     */
809    if ((jarfile != NULL)
810        && (wafer_list->next == NULL)
811        && (suppress_vanilla_wafer == 0))
812    {
813       enlist(wafer_list, VANILLA_WAFER);
814    }
815 #endif /* def JAR_FILES */
816
817    end_proxy_args();
818
819 }
820
821
822 /*
823   Local Variables:
824   tab-width: 3
825   end:
826 */