Added +image-blocker{} option - comment and default setting.
[privoxy.git] / loadcfg.c
1 const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.8 2001/05/31 21:27:13 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.8  2001/05/31 21:27:13  jongfoster
39  *    Removed many options from the config file and into the
40  *    "actions" file: add_forwarded, suppress_vanilla_wafer,
41  *    wafer, add_header, user_agent, referer, from
42  *    Also globally replaced "permission" with "action".
43  *
44  *    Revision 1.7  2001/05/29 09:50:24  jongfoster
45  *    Unified blocklist/imagelist/permissionslist.
46  *    File format is still under discussion, but the internal changes
47  *    are (mostly) done.
48  *
49  *    Also modified interceptor behaviour:
50  *    - We now intercept all URLs beginning with one of the following
51  *      prefixes (and *only* these prefixes):
52  *        * http://i.j.b/
53  *        * http://ijbswa.sf.net/config/
54  *        * http://ijbswa.sourceforge.net/config/
55  *    - New interceptors "home page" - go to http://i.j.b/ to see it.
56  *    - Internal changes so that intercepted and fast redirect pages
57  *      are not replaced with an image.
58  *    - Interceptors now have the option to send a binary page direct
59  *      to the client. (i.e. ijb-send-banner uses this)
60  *    - Implemented show-url-info interceptor.  (Which is why I needed
61  *      the above interceptors changes - a typical URL is
62  *      "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
63  *      The previous mechanism would not have intercepted that, and
64  *      if it had been intercepted then it then it would have replaced
65  *      it with an image.)
66  *
67  *    Revision 1.6  2001/05/26 00:28:36  jongfoster
68  *    Automatic reloading of config file.
69  *    Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32).
70  *    Most of the global variables have been moved to a new
71  *    struct configuration_spec, accessed through csp->config->globalname
72  *    Most of the globals remaining are used by the Win32 GUI.
73  *
74  *    Revision 1.5  2001/05/25 22:34:30  jongfoster
75  *    Hard tabs->Spaces
76  *
77  *    Revision 1.4  2001/05/22 18:46:04  oes
78  *
79  *    - Enabled filtering banners by size rather than URL
80  *      by adding patterns that replace all standard banner
81  *      sizes with the "Junkbuster" gif to the re_filterfile
82  *
83  *    - Enabled filtering WebBugs by providing a pattern
84  *      which kills all 1x1 images
85  *
86  *    - Added support for PCRE_UNGREEDY behaviour to pcrs,
87  *      which is selected by the (nonstandard and therefore
88  *      capital) letter 'U' in the option string.
89  *      It causes the quantifiers to be ungreedy by default.
90  *      Appending a ? turns back to greedy (!).
91  *
92  *    - Added a new interceptor ijb-send-banner, which
93  *      sends back the "Junkbuster" gif. Without imagelist or
94  *      MSIE detection support, or if tinygif = 1, or the
95  *      URL isn't recognized as an imageurl, a lame HTML
96  *      explanation is sent instead.
97  *
98  *    - Added new feature, which permits blocking remote
99  *      script redirects and firing back a local redirect
100  *      to the browser.
101  *      The feature is conditionally compiled, i.e. it
102  *      can be disabled with --disable-fast-redirects,
103  *      plus it must be activated by a "fast-redirects"
104  *      line in the config file, has its own log level
105  *      and of course wants to be displayed by show-proxy-args
106  *      Note: Boy, all the #ifdefs in 1001 locations and
107  *      all the fumbling with configure.in and acconfig.h
108  *      were *way* more work than the feature itself :-(
109  *
110  *    - Because a generic redirect template was needed for
111  *      this, tinygif = 3 now uses the same.
112  *
113  *    - Moved GIFs, and other static HTTP response templates
114  *      to project.h
115  *
116  *    - Some minor fixes
117  *
118  *    - Removed some >400 CRs again (Jon, you really worked
119  *      a lot! ;-)
120  *
121  *    Revision 1.3  2001/05/20 01:21:20  jongfoster
122  *    Version 2.9.4 checkin.
123  *    - Merged popupfile and cookiefile, and added control over PCRS
124  *      filtering, in new "permissionsfile".
125  *    - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
126  *      file error you now get a message box (in the Win32 GUI) rather
127  *      than the program exiting with no explanation.
128  *    - Made killpopup use the PCRS MIME-type checking and HTTP-header
129  *      skipping.
130  *    - Removed tabs from "config"
131  *    - Moved duplicated url parsing code in "loaders.c" to a new funcition.
132  *    - Bumped up version number.
133  *
134  *    Revision 1.2  2001/05/17 23:01:01  oes
135  *     - Cleaned CRLF's from the sources and related files
136  *
137  *    Revision 1.1.1.1  2001/05/15 13:58:58  oes
138  *    Initial import of version 2.9.3 source tree
139  *
140  *
141  *********************************************************************/
142 \f
143
144 #include "config.h"
145
146 #include <stdio.h>
147 #include <sys/types.h>
148 #include <stdlib.h>
149 #include <string.h>
150 #include <signal.h>
151 #include <fcntl.h>
152 #include <errno.h>
153 #include <ctype.h>
154
155 #ifdef _WIN32
156
157 # include <sys/timeb.h>
158 # include <windows.h>
159 # include <io.h>
160 # include <process.h>
161 # ifdef TOGGLE
162 #  include <time.h>
163 # endif /* def TOGGLE */
164
165 # include "win32.h"
166 # ifndef _WIN_CONSOLE
167 #  include "w32log.h"
168 # endif /* ndef _WIN_CONSOLE */
169
170 #else /* ifndef _WIN32 */
171
172 # include <unistd.h>
173 # include <sys/time.h>
174 # include <sys/wait.h>
175 # include <sys/stat.h>
176 # include <signal.h>
177
178 #endif
179
180 #include "loadcfg.h"
181 #include "list.h"
182 #include "jcc.h"
183 #include "filters.h"
184 #include "loaders.h"
185 #include "showargs.h"
186 #include "parsers.h"
187 #include "killpopup.h"
188 #include "miscutil.h"
189 #include "errlog.h"
190 #include "jbsockets.h"
191 #include "gateway.h"
192
193 const char loadcfg_h_rcs[] = LOADCFG_H_VERSION;
194
195 /*
196  * Fix a problem with Solaris.  There should be no effect on other
197  * platforms.
198  * Solaris's isspace() is a macro which uses it's argument directly
199  * as an array index.  Therefore we need to make sure that high-bit
200  * characters generate +ve values, and ideally we also want to make
201  * the argument match the declared parameter type of "int".
202  */
203 #define ijb_isupper(__X) isupper((int)(unsigned char)(__X))
204 #define ijb_tolower(__X) tolower((int)(unsigned char)(__X))
205
206 #ifdef TOGGLE
207 /* by haroon - indicates if ijb is enabled */
208 int g_bToggleIJB        = 1;   /* JunkBusters is enabled by default. */
209 #endif
210
211 /* The filename of the configfile */
212 const char *configfile  = NULL;
213
214 /*
215  * The load_config function is now going to call `init_proxy_args',
216  * so it will need argc and argv.  So we need to have these
217  * globally available.
218  */
219 int Argc = 0;
220 const char **Argv = NULL;
221
222 static struct file_list *current_configfile = NULL;
223
224
225 /*
226  * This takes the "cryptic" hash of each keyword and aliases them to
227  * something a little more readable.  This also makes changing the
228  * hash values easier if they should change or the hash algorthm changes.
229  * Use the included "hash" program to find out what the hash will be
230  * for any string supplied on the command line.  (Or just put it in the
231  * config file and read the number from the error message in the log).
232  */
233
234
235 #define hash_aclfile                      1908516ul
236 #define hash_actions_file              3825730796ul /* FIXME "permissionsfile" */
237 #define hash_debug                          78263ul
238 #define hash_forwardfile               1268669141ul
239 #define hash_jarfile                      2046641ul
240 #define hash_listen_address            1255650842ul
241 #define hash_logfile                      2114766ul
242 #define hash_re_filterfile             3877522444ul
243 #define hash_single_threaded           4250084780ul
244 #define hash_suppress_blocklists       1948693308ul
245 #define hash_toggle                        447966ul
246 #define hash_trust_info_url             449869467ul
247 #define hash_trustfile                   56494766ul
248
249 #define hash_hide_console              2048809870ul
250
251 #define hash_activity_animation        1817904738ul
252 #define hash_close_button_minimizes    3651284693ul
253 #define hash_log_buffer_size           2918070425ul
254 #define hash_log_font_name             2866730124ul
255 #define hash_log_font_size             2866731014ul
256 #define hash_log_highlight_messages    4032101240ul
257 #define hash_log_max_lines             2868344173ul
258 #define hash_log_messages              2291744899ul
259 #define hash_show_on_task_bar           215410365ul
260
261
262
263 /*********************************************************************
264  *
265  * Function    :  unload_configfile
266  *
267  * Description :  Free the config structure and all components.
268  *
269  * Parameters  :
270  *          1  :  data: struct configuration_spec to unload
271  *
272  * Returns     :  N/A
273  *
274  *********************************************************************/
275 void unload_configfile (void * data)
276 {
277    struct configuration_spec * config = (struct configuration_spec *)data;
278
279 #ifdef JAR_FILES
280    if ( NULL != config->jar )
281    {
282       fclose( config->jar );
283       config->jar = NULL;
284    }
285 #endif /* def JAR_FILES */
286
287    freez((char *)config->haddr);
288    freez((char *)config->logfile);
289
290    freez((char *)config->actions_file);
291    freez((char *)config->forwardfile);
292
293 #ifdef ACL_FILES
294    freez((char *)config->aclfile);
295 #endif /* def ACL_FILES */
296
297 #ifdef JAR_FILES
298    freez((char *)config->jarfile);
299 #endif /* def JAR_FILES */
300
301 #ifndef SPLIT_PROXY_ARGS
302    freez((char *)config->suppress_message);
303 #endif /* ndef SPLIT_PROXY_ARGS */
304
305 #ifdef PCRS
306    freez((char *)config->re_filterfile);
307 #endif /* def PCRS */
308
309 }
310
311
312 /*********************************************************************
313  *
314  * Function    :  load_config
315  *
316  * Description :  Load the config file and all parameters.
317  *
318  * Parameters  :
319  *          1  :  csp = Client state (the config member will be 
320  *                filled in by this function).
321  *
322  * Returns     :  0 => Ok, everything else is an error.
323  *
324  *********************************************************************/
325 struct configuration_spec * load_config(void)
326 {
327    char buf[BUFSIZ];
328    char *p, *q;
329    FILE *configfp = NULL;
330    struct configuration_spec * config = NULL;
331    struct client_state * fake_csp;
332
333    struct file_list *fs;
334
335    if (!check_file_changed(current_configfile, configfile, &fs))
336    {
337       /* No need to load */
338       return ((struct configuration_spec *)current_configfile->f);
339    }
340    if (!fs)
341    {
342       log_error(LOG_LEVEL_FATAL, "can't check configuration file '%s':  %E",
343                 configfile);
344    }
345
346    log_error(LOG_LEVEL_INFO, "loading configuration file '%s':", configfile);
347
348 #ifdef TOGGLE
349    g_bToggleIJB      = 1;
350 #endif
351
352    fs->f = config = (struct configuration_spec *)zalloc(sizeof(*config));
353
354    if (config==NULL)
355    {
356       freez(fs->filename);
357       freez(fs);
358       log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
359       /* Never get here - LOG_LEVEL_FATAL causes program exit */
360    }
361
362    /*
363     * This is backwards from how it's usually done.
364     * Following the usual pattern, "fs" would be stored in a member 
365     * variable in "csp", and then we'd access "config" from "fs->f",
366     * using a cast.  However, "config" is used so often that a 
367     * cast each time would be very ugly, and the extra indirection
368     * would waste CPU cycles.  Therefore we store "config" in
369     * "csp->config", and "fs" in "csp->config->config_file_list".
370     */
371    config->config_file_list = fs;
372
373    init_proxy_args(Argc, Argv, config);
374
375    /*
376     * Set to defaults
377     */
378
379    config->multi_threaded    = 1;
380    config->hport             = HADDR_PORT;
381
382    if ((configfp = fopen(configfile, "r")) == NULL)
383    {
384       log_error(LOG_LEVEL_FATAL, "can't open configuration file '%s':  %E",
385               configfile);
386       /* Never get here - LOG_LEVEL_FATAL causes program exit */
387    }
388
389    while (read_config_line(buf, sizeof(buf), configfp, fs) != NULL)
390    {
391       char cmd[BUFSIZ];
392       char arg[BUFSIZ];
393       char tmp[BUFSIZ];
394
395       strcpy(tmp, buf);
396
397       /* Copy command (i.e. up to space or tab) into cmd */
398       p = buf;
399       q = cmd;
400       while (*p && (*p != ' ') && (*p != '\t'))
401       {
402          *q++ = *p++;
403       }
404       *q = '\0';
405
406       /* Skip over the whitespace in buf */
407       while (*p && ((*p == ' ') || (*p == '\t')))
408       {
409          p++;
410       }
411
412       /* Copy the argument into arg */
413       strcpy(arg, p);
414
415       /* Should never happen, but check this anyway */
416       if (*cmd == '\0')
417       {
418          continue;
419       }
420
421       /* Make sure the command field is lower case */
422       for (p=cmd; *p; p++)
423       {
424          if (ijb_isupper(*p))
425          {
426             *p = ijb_tolower(*p);
427          }
428       }
429
430       /* Save the argument for show-proxy-args */
431       savearg(cmd, arg, config);
432
433
434       switch( hash_string( cmd ) )
435       {
436 #ifdef TRUST_FILES
437          case hash_trustfile :
438             freez((char *)config->trustfile);
439             config->trustfile = strdup(arg);
440             continue;
441
442          case hash_trust_info_url :
443             enlist(config->trust_info, arg);
444             continue;
445 #endif /* def TRUST_FILES */
446
447          case hash_debug :
448             config->debug |= atoi(arg);
449             continue;
450
451          case hash_single_threaded :
452             config->multi_threaded = 0;
453             continue;
454
455          case hash_actions_file :
456             freez((char *)config->actions_file);
457             config->actions_file = strdup(arg);
458             continue;
459
460          case hash_logfile :
461             freez((char *)config->logfile);
462             config->logfile = strdup(arg);
463             continue;
464
465 #ifdef JAR_FILES
466          case hash_jarfile :
467             freez((char *)config->jarfile);
468             config->jarfile = strdup(arg);
469             continue;
470 #endif /* def JAR_FILES */
471
472          case hash_listen_address :
473             freez((char *)config->haddr);
474             config->haddr = strdup(arg);
475             continue;
476
477          case hash_forwardfile :
478             freez((char *)config->forwardfile);
479             config->forwardfile = strdup(arg);
480             continue;
481
482 #ifdef ACL_FILES
483          case hash_aclfile :
484             freez((char *)config->aclfile);
485             config->aclfile = strdup(arg);
486             continue;
487 #endif /* def ACL_FILES */
488
489 #ifdef PCRS
490          case hash_re_filterfile :
491             freez((char *)config->re_filterfile);
492             config->re_filterfile = strdup(arg);
493             continue;
494 #endif /* def PCRS */
495
496 #ifdef _WIN_CONSOLE
497          case hash_hide_console :
498             hideConsole = 1;
499             continue;
500 #endif /*def _WIN_CONSOLE*/
501
502 #ifndef SPLIT_PROXY_ARGS
503          case hash_suppress_blocklists :
504             if (arg[0] != '\0')
505             {
506                config->suppress_message = strdup(arg);
507             }
508             else
509             {
510                /* There will be NO reference in proxy-args. */
511                config->suppress_message = NULL;
512             }
513
514             config->suppress_blocklists = 1;
515             continue;
516 #endif /* ndef SPLIT_PROXY_ARGS */
517
518 #ifdef TOGGLE
519          case hash_toggle :
520             g_bToggleIJB = atoi(arg);
521             continue;
522 #endif /* def TOGGLE */
523
524 #if defined(_WIN32) && ! defined(_WIN_CONSOLE)
525          case hash_activity_animation :
526             g_bShowActivityAnimation = atoi(arg);
527             continue;
528
529          case hash_log_messages :
530             g_bLogMessages = atoi(arg);
531             continue;
532
533          case hash_log_highlight_messages :
534             g_bHighlightMessages = atoi(arg);
535             continue;
536
537          case hash_log_buffer_size :
538             g_bLimitBufferSize = atoi(arg);
539             continue;
540
541          case hash_log_max_lines :
542             g_nMaxBufferLines = atoi(arg);
543             continue;
544
545          case hash_log_font_name :
546             strcpy( g_szFontFaceName, arg );
547             continue;
548
549          case hash_log_font_size :
550             g_nFontSize = atoi(arg);
551             continue;
552
553          case hash_show_on_task_bar :
554             g_bShowOnTaskBar = atoi(arg);
555             continue;
556
557          case hash_close_button_minimizes :
558             g_bCloseHidesWindow = atoi(arg);
559             continue;
560 #endif /* defined(_WIN32) && ! defined(_WIN_CONSOLE) */
561
562          /* Warnings about unsupported features */
563
564 #ifndef PCRS
565          case hash_re_filterfile :
566 #endif /* ndef PCRS */
567 #ifndef TOGGLE
568          case hash_toggle :
569 #endif /* ndef TOGGLE */
570 #if defined(_WIN_CONSOLE) || ! defined(_WIN32)
571          case hash_activity_animation :
572          case hash_log_messages :
573          case hash_log_highlight_messages :
574          case hash_log_buffer_size :
575          case hash_log_max_lines :
576          case hash_log_font_name :
577          case hash_log_font_size :
578          case hash_show_on_task_bar :
579          case hash_close_button_minimizes :
580 #endif /* defined(_WIN_CONSOLE) || ! defined(_WIN32) */
581 #ifndef _WIN_CONSOLE
582          case hash_hide_console :
583 #endif /* ndef _WIN_CONSOLE */
584 #ifndef JAR_FILES
585          case hash_jarfile :
586 #endif /* ndef JAR_FILES */
587 #ifndef ACL_FILES
588          case hash_aclfile :
589 #endif /* ndef ACL_FILES */
590 #ifdef SPLIT_PROXY_ARGS
591          case hash_suppress_blocklists :
592 #endif /* def SPLIT_PROXY_ARGS */
593             log_error(LOG_LEVEL_INFO, "Unsupported directive \"%s\" ignored.", cmd);
594             continue;
595
596          default :
597             /*
598              * I decided that I liked this better as a warning than an
599              * error.  To change back to an error, just change log level
600              * to LOG_LEVEL_FATAL.
601              */
602             log_error(LOG_LEVEL_ERROR, "Unrecognized directive (%lulu) in "
603                   "configuration file: \"%s\"", hash_string( cmd ), buf);
604             p = malloc( BUFSIZ );
605             if (p != NULL)
606             {
607                sprintf( p, "<br>\nWARNING: unrecognized directive : %s<br><br>\n", buf );
608                config->proxy_args_invocation = strsav( config->proxy_args_invocation, p );
609                freez( p );
610             }
611             continue;
612       } /* end switch( hash_string(cmd) ) */
613    } /* end while ( read_config_line(...) ) */
614
615    fclose(configfp);
616
617    init_error_log(Argv[0], config->logfile, config->debug);
618
619    if (config->actions_file)
620    {
621       add_loader(load_actions_file, config);
622    }
623
624    if (config->forwardfile)
625    {
626       add_loader(load_forwardfile, config);
627    }
628
629 #ifdef ACL_FILES
630    if (config->aclfile)
631    {
632       add_loader(load_aclfile, config);
633    }
634 #endif /* def ACL_FILES */
635
636 #ifdef PCRS
637    if (config->re_filterfile)
638    {
639       add_loader(load_re_filterfile, config);
640    }
641 #endif /* def PCRS */
642
643 #ifdef TRUST_FILES
644    if (config->trustfile)
645    {
646       add_loader(load_trustfile, config);
647    }
648 #endif
649
650 #ifdef JAR_FILES
651    if ( NULL != config->jarfile )
652    {
653       if ( NULL == (config->jar = fopen(config->jarfile, "a")) )
654       {
655          log_error(LOG_LEVEL_FATAL, "can't open jarfile '%s': %E", config->jarfile);
656          /* Never get here - LOG_LEVEL_FATAL causes program exit */
657       }
658       setbuf(config->jar, NULL);
659    }
660 #endif /* def JAR_FILES */
661
662    if ( NULL == config->haddr )
663    {
664       config->haddr = strdup( HADDR_DEFAULT );
665    }
666
667    if ( NULL != config->haddr )
668    {
669       if ((p = strchr(config->haddr, ':')))
670       {
671          *p++ = '\0';
672          if (*p)
673          {
674             config->hport = atoi(p);
675          }
676       }
677
678       if (config->hport <= 0)
679       {
680          *--p = ':';
681          log_error(LOG_LEVEL_FATAL, "invalid bind port spec %s", config->haddr);
682          /* Never get here - LOG_LEVEL_FATAL causes program exit */
683       }
684       if (*config->haddr == '\0')
685       {
686          config->haddr = NULL;
687       }
688    }
689
690    /*
691     * Want to run all the loaders once now.
692     *
693     * Need to set up a fake csp, so they can get to the config.
694     */
695    fake_csp = (struct client_state *) zalloc (sizeof(*fake_csp));
696    fake_csp->config = config;
697
698    if (run_loader(fake_csp))
699    {
700       freez(fake_csp);
701       log_error(LOG_LEVEL_FATAL, "A loader failed while loading config file. Exiting.");
702       /* Never get here - LOG_LEVEL_FATAL causes program exit */
703    }
704    freez(fake_csp);
705
706    end_proxy_args(config);
707
708 #ifndef SPLIT_PROXY_ARGS
709    if (!suppress_blocklists)
710    {
711       fs->proxy_args = strsav(fs->proxy_args, "</pre>");
712    }
713 #endif /* ndef SPLIT_PROXY_ARGS */
714
715 /* FIXME: this is a kludge for win32 */
716 #if defined(_WIN32) && !defined (_WIN_CONSOLE)
717
718    g_actions_file     = config->actions_file;
719    g_forwardfile      = config->forwardfile;
720 #ifdef ACL_FILES
721    g_aclfile          = config->aclfile;
722 #endif /* def ACL_FILES */
723 #ifdef PCRS
724    g_re_filterfile    = config->re_filterfile;
725 #endif
726 #ifdef TRUST_FILES
727    g_trustfile        = config->trustfile;
728 #endif
729    
730
731 #endif /* defined(_WIN32) && !defined (_WIN_CONSOLE) */
732 /* FIXME: end kludge */
733
734
735    config->need_bind = 1;
736
737    if (current_configfile)
738    {
739       struct configuration_spec * oldcfg = (struct configuration_spec *)
740                                            current_configfile->f;
741       /*
742        * Check if config->haddr,hport == oldcfg->haddr,hport
743        *
744        * The following could be written more compactly as a single,
745        * (unreadably long) if statement.
746        */
747       config->need_bind = 0;
748       if (config->hport != oldcfg->hport)
749       {
750          config->need_bind = 1;
751       }
752       else if (config->haddr == NULL)
753       {
754          if (oldcfg->haddr != NULL)
755          {
756             config->need_bind = 1;
757          }
758       }
759       else if (oldcfg->haddr == NULL)
760       {
761          config->need_bind = 1;
762       }
763       else if (0 != strcmp(config->haddr, oldcfg->haddr))
764       {
765          config->need_bind = 1;
766       }
767
768       current_configfile->unloader = unload_configfile;
769    }
770
771    fs->next = files->next;
772    files->next = fs;
773
774    current_configfile = fs;
775
776    return (config);
777 }
778
779
780 /*
781   Local Variables:
782   tab-width: 3
783   end:
784 */