]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make dnsserver, ftpget, redirector totally optional.
authorwessels <>
Tue, 15 Oct 1996 22:40:04 +0000 (22:40 +0000)
committerwessels <>
Tue, 15 Oct 1996 22:40:04 +0000 (22:40 +0000)
ftpget will be disabled for http_accel-only mode.

src/cache_cf.cc
src/errorpage.cc
src/ftp.cc
src/ipcache.cc
src/neighbors.cc

index ecdbb4d1bfa95b7a673d1a47f78580a4fd5546e6..25a7af5300f696bb88bd527f932aebf03cc52ae0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cache_cf.cc,v 1.108 1996/10/10 18:48:47 wessels Exp $
+ * $Id: cache_cf.cc,v 1.109 1996/10/15 16:40:04 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -1249,9 +1249,13 @@ parseConfigFile(char *file_name)
 
        else if (!strcmp(token, "cache_ftp_program"))
            parseFtpProgramLine();
+       else if (!strcmp(token, "ftpget_program"))
+           parseFtpProgramLine();
 
        else if (!strcmp(token, "cache_ftp_options"))
            parseFtpOptionsLine();
+       else if (!strcmp(token, "ftpget_options"))
+           parseFtpOptionsLine();
 
        else if (!strcmp(token, "cache_dns_program"))
            parseDnsProgramLine();
@@ -1411,30 +1415,29 @@ parseConfigFile(char *file_name)
        Config.cleanRate = 86400 * 365;         /* one year */
     if (Config.Announce.rate < 1)
        Config.Announce.rate = 86400 * 365;     /* one year */
+    if (Config.dnsChildren < 0)
+       Config.dnsChildren = 0;
     if (Config.dnsChildren < 1) {
-       printf("WARNING: dns_children was set to a bad value: %d\n",
-           Config.dnsChildren);
-       Config.dnsChildren = DefaultDnsChildren;
-       printf("Setting it to the default (%d).\n", DefaultDnsChildren);
+       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",
            Config.dnsChildren);
        printf("Setting it to the maximum (%d).\n", DefaultDnsChildrenMax);
        Config.dnsChildren = DefaultDnsChildrenMax;
     }
-    if (Config.redirectChildren < 1) {
-       printf("WARNING: redirect_children was set to a bad value: %d\n",
-           Config.redirectChildren);
-       Config.redirectChildren = DefaultRedirectChildren;
-       printf("Setting it to the default (%d).\n", DefaultRedirectChildren);
-    } else if (Config.redirectChildren > DefaultRedirectChildrenMax) {
-       printf("WARNING: redirect_children was set to a bad value: %d\n",
-           Config.redirectChildren);
-       printf("Setting it to the maximum (%d).\n", DefaultRedirectChildrenMax);
-       Config.redirectChildren = DefaultRedirectChildrenMax;
+    if (Config.program.redirect) {
+        if (Config.redirectChildren < 1) {
+           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",
+               Config.redirectChildren);
+           printf("Setting it to the maximum (%d).\n", DefaultRedirectChildrenMax);
+           Config.redirectChildren = DefaultRedirectChildrenMax;
+        }
     }
     fclose(fp);
-
     configDoConfigure();
     return 0;
 }
@@ -1599,4 +1602,8 @@ configDoConfigure(void)
     if (Config.errHtmlText == NULL)
        Config.errHtmlText = xstrdup(null_string);
     storeConfigure();
+    if (httpd_accel_mode && !Config.Accel.withProxy) {
+       safe_free(Config.program.ftpget);
+       Config.program.ftpget = xstrdup("none");
+    }
 }
index 3977620ced4e8aa8697283761b3c3ce8f1aa327c..821c6a0f1ab532eaffef8d62716d62152236fa01 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.44 1996/10/09 15:34:25 wessels Exp $
+ * $Id: errorpage.cc,v 1.45 1996/10/15 16:40:05 wessels Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -122,6 +122,9 @@ static error_data ErrorData[] =
     {"ERR_ZERO_SIZE_OBJECT",
        "No Object Data",
        "The remote server closed the connection before sending any data."},
+    {"ERR_FTP_DISABLED",
+       "FTP is disabled",
+       "This cache is configured to NOT retrieve FTP objects."},
     {"ERR_PROXY_DENIED",
        "Access Denied",
        "You must authenticate yourself before accessing this cache."}
index 424b0f3b4e3d7a6ce474bb0af492612e9362cb9f..c0dc4d5d9ff077cfb6553b1241a102bc7b45f213 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.65 1996/10/13 06:19:44 wessels Exp $
+ * $Id: ftp.cc,v 1.66 1996/10/15 16:40:06 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -563,6 +563,11 @@ ftpStart(int unusedfd, char *url, request_t * request, StoreEntry * entry)
 
     debug(9, 3, "FtpStart: FD %d <URL:%s>\n", unusedfd, url);
 
+    if (ftpget_server_write < 0) {
+       squid_error_entry(entry, ERR_FTP_DISABLED, NULL);
+       return COMM_ERROR;
+    }
+
     ftpData = xcalloc(1, sizeof(FtpStateData));
     storeLockObject(ftpData->entry = entry, NULL, NULL);
     ftpData->request = requestLink(request);
@@ -658,6 +663,8 @@ ftpServerClosed(int fd, void *nodata)
     if (squid_curtime - last_restart < 2) {
        debug(9, 0, "ftpget server failing too rapidly\n");
        debug(9, 0, "WARNING: FTP access is disabled!\n");
+       ftpget_server_write = -1;
+       ftpget_server_read = -1;
        return;
     }
     last_restart = squid_curtime;
@@ -698,6 +705,10 @@ ftpInitialize(void)
     int len;
     struct timeval slp;
 
+    if (!strcmp(ftpget, "none")) {
+        debug(9, 1, "ftpInitialize: ftpget is disabled.\n");
+       return -1;
+    }
     debug(9, 5, "ftpInitialize: Initializing...\n");
     if (pipe(squid_to_ftpget) < 0) {
        debug(9, 0, "ftpInitialize: pipe: %s\n", xstrerror());
index 7da4f4fc38f5d72ebfd247b3d5e2d337c5be96b2..063171fcc4e904c8890b9ca13e1a338e7e7c4d45 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ipcache.cc,v 1.71 1996/10/11 23:11:15 wessels Exp $
+ * $Id: ipcache.cc,v 1.72 1996/10/15 16:40:09 wessels Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -175,6 +175,10 @@ static char ipcache_status_char[] =
 static long ipcache_low = 180;
 static long ipcache_high = 200;
 
+#if LIBRESOLV_DNS_TTL_HACK
+extern int _dns_ttl_;
+#endif
+
 static void
 ipcacheEnqueue(ipcache_entry * i)
 {
@@ -811,6 +815,10 @@ ipcache_gethostbyname(char *name, int flags)
            i = ipcache_get(name);
            i->lastref = squid_curtime;
            i->expires = squid_curtime + Config.positiveDnsTtl;
+#if LIBRESOLV_DNS_TTL_HACK
+           if (_dns_ttl_ > -1)
+               i->expires = squid_curtime + _dns_ttl_;
+#endif /* LIBRESOLV_DNS_TTL_HACK */
            return &i->addrs;
        }
        /* bad address, negative cached */
index 4e2055060cc0a3a69f1af1d7407760f40a7028f2..de3527704de38b6cfe82b2b12e877cca1de7af39 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: neighbors.cc,v 1.65 1996/10/15 04:57:54 wessels Exp $
+ * $Id: neighbors.cc,v 1.66 1996/10/15 16:40:09 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -335,6 +335,7 @@ neighbors_open(int fd)
     E = &friends->edges_head;
     next = friends->edges_head;
     while ((e = next)) {
+       getCurrentTime();
        next = e->next;
        debug(15, 2, "Finding IP addresses for '%s'\n", e->host);
        if ((ia = ipcache_gethostbyname(e->host, IP_BLOCKING_LOOKUP)) == NULL) {