From: wessels <> Date: Tue, 15 Oct 1996 22:40:04 +0000 (+0000) Subject: Make dnsserver, ftpget, redirector totally optional. X-Git-Tag: SQUID_3_0_PRE1~5644 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c021888f94a0013f19e22e10426e5048327beae0;p=thirdparty%2Fsquid.git Make dnsserver, ftpget, redirector totally optional. ftpget will be disabled for http_accel-only mode. --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index ecdbb4d1bf..25a7af5300 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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"); + } } diff --git a/src/errorpage.cc b/src/errorpage.cc index 3977620ced..821c6a0f1a 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -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."} diff --git a/src/ftp.cc b/src/ftp.cc index 424b0f3b4e..c0dc4d5d9f 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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 \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()); diff --git a/src/ipcache.cc b/src/ipcache.cc index 7da4f4fc38..063171fcc4 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -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 */ diff --git a/src/neighbors.cc b/src/neighbors.cc index 4e2055060c..de3527704d 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -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) {