-const char loaders_rcs[] = "$Id: loaders.c,v 1.6 2001/05/23 12:27:33 oes Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.7 2001/05/26 00:28:36 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.c,v $
*
* Revisions :
* $Log: loaders.c,v $
+ * Revision 1.7 2001/05/26 00:28:36 jongfoster
+ * Automatic reloading of config file.
+ * Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32).
+ * Most of the global variables have been moved to a new
+ * struct configuration_spec, accessed through csp->config->globalname
+ * Most of the globals remaining are used by the Win32 GUI.
+ *
* Revision 1.6 2001/05/23 12:27:33 oes
*
* Fixed ugly indentation of my last changes
struct forward_spec *b, *bl;
char buf[BUFSIZ], *p, *q, *tmp;
char *vec[4];
- int port, n, reject;
+ int n, reject;
struct file_list *fs;
const struct gateway *gw;
- struct url_spec url[1];
if (!check_file_changed(current_forwardfile, csp->config->forwardfile, &fs))
{
/* allocate a new node */
if (((b = zalloc(sizeof(*b))) == NULL)
-#ifdef REGEX
- || ((b->url->preg = zalloc(sizeof(*b->url->preg))) == NULL)
-#endif
)
{
fclose(fp);
b->next = bl->next;
bl->next = b;
- /* save a copy of the orignal specification */
- if ((b->url->spec = strdup(buf)) == NULL)
- {
- fclose(fp);
- goto load_forwardfile_error;
- }
-
- b->reject = reject;
-
- if ((p = strchr(buf, '/')))
- {
- b->url->path = strdup(p);
- b->url->pathlen = strlen(b->url->path);
- *p = '\0';
- }
- else
- {
- b->url->path = NULL;
- b->url->pathlen = 0;
- }
-#ifdef REGEX
- if (b->url->path)
- {
- int errcode;
- char rebuf[BUFSIZ];
-
- sprintf(rebuf, "^(%s)", b->url->path);
-
- errcode = regcomp(b->url->preg, rebuf,
- (REG_EXTENDED|REG_NOSUB|REG_ICASE));
-
- if (errcode)
- {
- size_t errlen = regerror(errcode, b->url->preg, buf, sizeof(buf));
-
- buf[errlen] = '\0';
-
- log_error(LOG_LEVEL_ERROR, "error compiling %s: %s",
- b->url->spec, buf);
- fclose(fp);
- goto load_forwardfile_error;
- }
- }
- else
- {
- freez(b->url->preg);
- }
-#endif
- if ((p = strchr(buf, ':')) == NULL)
- {
- port = 0;
- }
- else
- {
- *p++ = '\0';
- port = atoi(p);
- }
-
- b->url->port = port;
-
- if ((b->url->domain = strdup(buf)) == NULL)
- {
- fclose(fp);
- goto load_forwardfile_error;
- }
-
- /* split domain into components */
- *url = dsplit(b->url->domain);
- b->url->dbuf = url->dbuf;
- b->url->dcnt = url->dcnt;
- b->url->dvec = url->dvec;
+ b->reject = reject;\r
+\r
+ /* Save the URL pattern */\r
+ if (create_url_spec(b->url, buf))\r
+ {\r
+ fclose(fp);\r
+ goto load_forwardfile_error;\r
+ }\r
/* now parse the gateway specs */