]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Ron Gomes fixes.
authorwessels <>
Thu, 13 Nov 1997 06:36:19 +0000 (06:36 +0000)
committerwessels <>
Thu, 13 Nov 1997 06:36:19 +0000 (06:36 +0000)
- Remove USE_PROXY_AUTH and LOG_FULL_HEADERS from Makefile.in
- Fixed log_full_hdrs bug
We can't use pathname_stat() for both default_all() and parsing the
config file.  We must check the pathnames only after both the
defaults and the config file have been parsed.  DW also made misc
other fixes to cache_cf.c and friends.

src/Makefile.in
src/access_log.cc
src/acl.cc
src/cache_cf.cc
src/cachemgr.cc
src/cf.data.pre
src/protos.h

index 5bc6bf4c9bfb7816a98e723938bc30affbf77973..e845f49c16b2efe20e309bbb55c944567a5c7c5f 100644 (file)
@@ -1,13 +1,11 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.93 1997/11/05 00:39:48 wessels Exp $
+#  $Id: Makefile.in,v 1.94 1997/11/12 23:36:19 wessels Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
 HOST_OPT       = # -DCACHEMGR_HOSTNAME="getfullhostname()"
-AUTH_OPT       = # -DUSE_PROXY_AUTH=1
-LOG_HDRS_OPT   = # -DLOG_FULL_HEADERS=1
 ICMP_OPT       = # -DUSE_ICMP=1
 DELAY_HACK      = # -DDELAY_HACK=1
 USERAGENT_OPT  = # -DUSE_USERAGENT_LOG=1
@@ -19,7 +17,7 @@ ALARM_UPDATES_TIME = # -DALARM_UPDATES_TIME=1
 STORE_KEY_SHA  = # -DSTORE_KEY_SHA=1
 USE_ASYNC_IO   = # -DUSE_ASYNC_IO=1
 
-DEFINES         = $(HOST_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) \
+DEFINES         = $(HOST_OPT) \
                   $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
                   $(KILL_PARENT_OPT) $(USE_POLL_OPT) \
                   $(USE_SPLAY_TREE) $(USE_BIN_TREE) \
index fbbf8c7d7609d4e70d876ce44bf109e2012f48af..439b76936effda46b0b4fb700b0f60f7f2b09231 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: access_log.cc,v 1.9 1997/11/12 00:08:44 wessels Exp $
+ * $Id: access_log.cc,v 1.10 1997/11/12 23:36:20 wessels Exp $
  *
  * DEBUG: section 46    Access Log
  * AUTHOR: Duane Wessels
@@ -207,9 +207,11 @@ accessLogLog(AccessLogEntry * al)
     if (Config.onoff.log_mime_hdrs) {
        char *ereq = log_quote(al->headers.request);
        char *erep = log_quote(al->headers.reply);
-       if (LOG_BUF_SZ - l > 0)
+       if (LOG_BUF_SZ - l > 0) {
+           l--;
            l += snprintf(log_buf + l, LOG_BUF_SZ - l, " [%s] [%s]\n",
                ereq, erep);
+       }
        safe_free(ereq);
        safe_free(erep);
     }
index d48d1a62f480c4c09fcdb2f2254a545f6afb3ad2..a26720818d2d8106e35e1795d342b59e3070df7b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: acl.cc,v 1.116 1997/11/12 22:49:36 wessels Exp $
+ * $Id: acl.cc,v 1.117 1997/11/12 23:36:21 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -1089,7 +1089,7 @@ aclMatchProxyAuth(struct _acl_proxy_auth *p, aclCheck_t * checklist)
        return 0;
     }
     passwd[0] |= 0x80;
-    debug(28, 5) ("proxyAuthenticate: user %s validated OK\n", sent_user);
+    debug(28, 5) ("aclMatchProxyAuth: user %s validated OK\n", sent_user);
     hash_delete(p->hash, sent_user);
     hash_insert(p->hash, xstrdup(sent_user), (void *) xstrdup(passwd));
     return 1;
index 4389ab0ddcdf3abd566b9d28f824c5b0c155e3eb..28782186ebb97366fe8bcc634dd9fce28e8c60f3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cache_cf.cc,v 1.230 1997/11/05 05:29:18 wessels Exp $
+ * $Id: cache_cf.cc,v 1.231 1997/11/12 23:36:22 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -62,10 +62,8 @@ static void defaults_if_none(void);
 static int parse_line(char *);
 static void parseBytesLine(size_t * bptr, const char *units);
 static size_t parseBytesUnits(const char *unit);
-
-/* These come from cf_gen.c */
-static void default_all(void);
 static void free_all(void);
+static void requirePathnameExists(const char *name, const char *path);
 
 static void
 self_destruct(void)
@@ -170,29 +168,33 @@ parseConfigFile(const char *file_name)
        }
        safe_free(tmp_line);
     }
+    fclose(fp);
+    defaults_if_none();
+    configDoConfigure();
+    return 0;
+}
 
+static void
+configDoConfigure(void)
+{
+    LOCAL_ARRAY(char, buf, BUFSIZ);
+    memset(&Config2, '\0', sizeof(SquidConfig2));
     /* Sanity checks */
     if (Config.cacheSwap.swapDirs == NULL)
        fatal("No cache_dir's specified in config file");
-    if (Config.Swap.maxSize < (Config.Mem.maxSize >> 10)) {
-       printf("WARNING: cache_swap (%d kbytes) is less than cache_mem (%d bytes).\n", Config.Swap.maxSize, Config.Mem.maxSize);
-       printf("         This will cause serious problems with your cache!!!\n");
-       printf("         Change your configuration file.\n");
-       fflush(stdout);         /* print message */
-    }
+    if (Config.Swap.maxSize < (Config.Mem.maxSize >> 10))
+       fatal("cache_swap is lower than cache_mem");
     if (Config.Announce.period < 1) {
        Config.Announce.period = 86400 * 365;   /* one year */
        Config.onoff.announce = 0;
     }
-    if (Config.dnsChildren < 0)
-       Config.dnsChildren = 0;
-    if (Config.dnsChildren < 1) {
-       printf("WARNING: dnsservers are disabled!\n");
-       printf("WARNING: Cache performance may be very poor\n");
-    } else if (Config.dnsChildren > DefaultDnsChildrenMax) {
-       printf("WARNING: dns_children was set to a bad value: %d\n",
+    if (Config.dnsChildren < 1)
+       fatal("No dnsservers allocated");
+    if (Config.dnsChildren > DefaultDnsChildrenMax) {
+       debug(3, 0) ("WARNING: dns_children was set to a bad value: %d\n",
            Config.dnsChildren);
-       printf("Setting it to the maximum (%d).\n", DefaultDnsChildrenMax);
+       debug(3, 0) ("Setting it to the maximum (%d).\n",
+           DefaultDnsChildrenMax);
        Config.dnsChildren = DefaultDnsChildrenMax;
     }
     if (Config.Program.redirect) {
@@ -200,23 +202,12 @@ parseConfigFile(const char *file_name)
            Config.redirectChildren = 0;
            safe_free(Config.Program.redirect);
        } else if (Config.redirectChildren > DefaultRedirectChildrenMax) {
-           printf("WARNING: redirect_children was set to a bad value: %d\n",
+           debug(3, 0) ("WARNING: redirect_children was set to a bad value: %d\n",
                Config.redirectChildren);
-           printf("Setting it to the maximum (%d).\n", DefaultRedirectChildrenMax);
+           debug(3, 0) ("Setting it to the maximum (%d).\n", DefaultRedirectChildrenMax);
            Config.redirectChildren = DefaultRedirectChildrenMax;
        }
     }
-    fclose(fp);
-    defaults_if_none();
-    configDoConfigure();
-    return 0;
-}
-
-static void
-configDoConfigure(void)
-{
-    LOCAL_ARRAY(char, buf, BUFSIZ);
-    memset(&Config2, '\0', sizeof(SquidConfig2));
     if (Config.Accel.host) {
        snprintf(buf, BUFSIZ, "http://%s:%d", Config.Accel.host, Config.Accel.port);
        Config2.Accel.prefix = xstrdup(buf);
@@ -256,6 +247,14 @@ configDoConfigure(void)
        debug(3, 0) ("WARNING: resetting 'reference_age' to 1 week\n");
        Config.referenceAge = 86400 * 7;
     }
+    requirePathnameExists("MIME Config Table", Config.mimeTablePathname);
+    requirePathnameExists("cache_dns_program", Config.Program.dnsserver);
+    requirePathnameExists("unlinkd_program", Config.Program.unlinkd);
+    if (Config.Program.redirect)
+       requirePathnameExists("redirect_program", Config.Program.redirect);
+    requirePathnameExists("announce_file", Config.Announce.file);
+    requirePathnameExists("Icon Directory", Config.icons.directory);
+    requirePathnameExists("Error Directory", Config.errorDirectory);
 }
 
 /* Parse a time specification from the config file.  Store the
@@ -749,13 +748,13 @@ dump_httpanonymizer(StoreEntry * entry, const char *name, int var)
 {
     switch (var) {
     case ANONYMIZER_NONE:
-       printf("off");
+       storeAppendPrintf(entry, "%s off\n", name);
        break;
     case ANONYMIZER_STANDARD:
-       printf("paranoid");
+       storeAppendPrintf(entry, "%s paranoid\n", name);
        break;
     case ANONYMIZER_PARANOID:
-       printf("standard");
+       storeAppendPrintf(entry, "%s standard\n", name);
        break;
     }
 }
@@ -862,22 +861,9 @@ parse_onoff(int *var)
 
 #define free_onoff free_int
 #define free_httpanonymizer free_int
-#define dump_pathname_stat dump_string
-#define free_pathname_stat free_string
 #define dump_eol dump_string
 #define free_eol free_string
 
-static void
-parse_pathname_stat(char **path)
-{
-    struct stat sb;
-    parse_string(path);
-    if (stat(*path, &sb) < 0) {
-       debug(50, 1) ("parse_pathname_stat: %s: %s\n", *path, xstrerror());
-       self_destruct();
-    }
-}
-
 static void
 dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
 {
@@ -1140,3 +1126,15 @@ configFreeMemory(void)
 {
     free_all();
 }
+
+static void
+requirePathnameExists(const char *name, const char *path)
+{
+    struct stat sb;
+    char buf[MAXPATHLEN];
+    assert(path != NULL);
+    if (stat(path, &sb) < 0) {
+       snprintf(buf, MAXPATHLEN, "%s: %s", path, xstrerror());
+       fatal(buf);
+    }
+}
index ced255e4cd19496119a9de11d9139eaebb9720ce..b33acd1b742f718482b1f3964079291f7fc063f7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cachemgr.cc,v 1.64 1997/11/05 05:29:19 wessels Exp $
+ * $Id: cachemgr.cc,v 1.65 1997/11/12 23:36:23 wessels Exp $
  *
  * DEBUG: section 0     CGI Cache Manager
  * AUTHOR: Harvest Derived
@@ -290,7 +290,7 @@ static const char *const op_cmds_descr[] =
     "Network Probe Database",
     "Shutdown Cache",
     "Refresh Object (URL required)",
-    "Persistant Connection Statistics",
+    "Persistent Connection Statistics",
 #ifdef REMOVE_OBJECT
     "Remove Object (URL required)",
 #endif
index fd1e2d59d04f08657442193f27d0ebff020c00bf..ffc4bc242bcb7afdb84a71e159dd70f092109fae 100644 (file)
@@ -590,7 +590,7 @@ DOC_END
 
 
 NAME: mime_table
-TYPE: pathname_stat
+TYPE: string
 DEFAULT: @DEFAULT_MIME_TABLE@
 LOC: Config.mimeTablePathname
 DOC_START
@@ -752,7 +752,7 @@ DOC_END
 
 
 NAME: cache_dns_program
-TYPE: pathname_stat
+TYPE: string
 DEFAULT: @DEFAULT_DNSSERVER@
 LOC: Config.Program.dnsserver
 DOC_START
@@ -797,7 +797,7 @@ DOC_END
 
 
 NAME: unlinkd_program
-TYPE: pathname_stat
+TYPE: string
 DEFAULT: @DEFAULT_UNLINKD@
 LOC: Config.Program.unlinkd
 DOC_START
@@ -819,7 +819,7 @@ DOC_END
 
 
 NAME: redirect_program
-TYPE: pathname_stat
+TYPE: string
 LOC: Config.Program.redirect
 DEFAULT: none
 DOC_START
@@ -828,7 +828,7 @@ DOC_START
        See the Release-Notes for how to write one.
        By default, the redirector is not used.
 
-redirect_program /bin/false
+redirect_program none
 DOC_END
 
 
@@ -1386,7 +1386,7 @@ announce_port 3131
 DOC_END
 
 NAME: announce_file
-TYPE: pathname_stat
+TYPE: string
 DEFAULT: /dev/null
 LOC: Config.Announce.file
 DOC_NONE
@@ -1862,7 +1862,7 @@ fake_user_agent none
 DOC_END
 
 NAME: icon_directory
-TYPE: pathname_stat
+TYPE: string
 LOC: Config.icons.directory
 DEFAULT: @DEFAULT_ICON_DIR@
 DOC_START
@@ -1870,7 +1870,7 @@ DOC_START
 DOC_END
 
 NAME: error_directory
-TYPE: pathname_stat
+TYPE: string
 LOC: Config.errorDirectory
 DEFAULT: @DEFAULT_ERROR_DIR@
 DOC_START
index 294d24cae02940652ff9dab01bbaf35b4e62e11b..e0a0032c4988fc78b18e79b6f1b1bbfc170abf99 100644 (file)
@@ -75,11 +75,6 @@ extern char *clientConstructTraceEcho(clientHttpRequest *);
 extern void clientPurgeRequest(clientHttpRequest *);
 extern int checkNegativeHit(StoreEntry *);
 
-#if USE_PROXY_AUTH
-extern const char *proxyAuthenticate(const char *headers);
-#endif /* USE_PROXY_AUTH */
-
-
 extern int commSetNonBlocking(int fd);
 extern void commSetCloseOnExec(int fd);
 extern int comm_accept(int fd, struct sockaddr_in *, struct sockaddr_in *);