From: wessels <> Date: Tue, 5 Nov 1996 05:07:24 +0000 (+0000) Subject: objcache and password cleanups X-Git-Tag: SQUID_3_0_PRE1~5533 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c5557f967f2dcfcbea2429fb2b661aac77b835e;p=thirdparty%2Fsquid.git objcache and password cleanups --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index f75426696a..ad258b64eb 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $Id: cache_cf.cc,v 1.126 1996/11/04 18:12:10 wessels Exp $ + * $Id: cache_cf.cc,v 1.127 1996/11/04 22:07:24 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -211,6 +211,7 @@ static int ip_acl_match _PARAMS((struct in_addr, const ip_acl *)); static void addToIPACL _PARAMS((ip_acl **, const char *, ip_access_type)); static void parseOnOff _PARAMS((int *)); static void parseIntegerValue _PARAMS((int *)); +static void parseString _PARAMS((char **)); static void self_destruct _PARAMS((void)); static void wordlistAdd _PARAMS((wordlist **, const char *)); @@ -246,6 +247,7 @@ static void parseVisibleHostnameLine _PARAMS((void)); static void parseWAISRelayLine _PARAMS((void)); static void parseMinutesLine _PARAMS((int *)); static void ip_acl_destroy _PARAMS((ip_acl **)); +static void parseCachemgrPasswd _PARAMS((void)); static void parsePathname _PARAMS((char **)); static void @@ -440,8 +442,10 @@ intlistDestroy(intlist ** list) } -/* Use this #define in all the parse*() functions. Assumes - * char *token is defined */ +/* + * Use this #define in all the parse*() functions. Assumes char *token is + * defined + */ #define GetInteger(var) \ token = strtok(NULL, w_space); \ @@ -975,6 +979,16 @@ parseIntegerValue(int *iptr) *iptr = i; } +static void +parseString(char **sptr) +{ + char *token; + token = strtok(NULL, w_space); + if (token == NULL) + self_destruct(); + *sptr = xstrdup(token); +} + static void parseErrHtmlLine(void) { @@ -983,6 +997,17 @@ parseErrHtmlLine(void) Config.errHtmlText = xstrdup(token); } +static void +parseCachemgrPasswd(void) +{ + char *passwd = NULL; + wordlist *actions = NULL; + parseString(&passwd); + parseWordlist(&actions); + objcachePasswdAdd(&Config.passwd_list, passwd, actions); + wordlistDestroy(&actions); +} + int parseConfigFile(const char *file_name) { @@ -1291,6 +1316,9 @@ parseConfigFile(const char *file_name) else if (!strcmp(token, "minimum_direct_hops")) parseIntegerValue(&Config.minDirectHops); + else if (!strcmp(token, "cachemgr_passwd")) + parseCachemgrPasswd(); + else if (!strcmp(token, "store_objects_per_bucket")) parseIntegerValue(&Config.Store.objectsPerBucket); else if (!strcmp(token, "store_avg_object_size")) @@ -1410,6 +1438,8 @@ configFreeMemory(void) wordlistDestroy(&Config.dns_testname_list); ip_acl_destroy(&Config.local_ip_list); ip_acl_destroy(&Config.firewall_ip_list); + objcachePasswdDestroy(&Config.passwd_list); + ttlFreeList(); refreshFreeMemory(); } diff --git a/src/cachemgr.cc b/src/cachemgr.cc index 7c94651548..b6ff5b734a 100644 --- a/src/cachemgr.cc +++ b/src/cachemgr.cc @@ -1,6 +1,6 @@ /* - * $Id: cachemgr.cc,v 1.39 1996/11/04 18:12:13 wessels Exp $ + * $Id: cachemgr.cc,v 1.40 1996/11/04 22:07:25 wessels Exp $ * * DEBUG: Section 0 CGI Cache Manager * AUTHOR: Harvest Derived @@ -288,7 +288,7 @@ static char *op_cmds_descr[] = "HTTP Reply Headers", "Filedescriptor Usage", "Network Probe Database", - "Shutdown Cache (password required)", + "Shutdown Cache", "Refresh Object (URL required)", #ifdef REMOVE_OBJECT "Remove Object (URL required)", @@ -709,7 +709,8 @@ main(int argc, char *argv[]) hasTables = TRUE; } } - if (!operation[0] || !strcmp(operation, "empty")) { /* prints HTML form if no args */ + /* prints HTML form if no args */ + if (!operation[0] || !strcmp(operation, "empty")) { noargs_html(hostname, portnum, url); exit(0); } @@ -744,9 +745,6 @@ main(int argc, char *argv[]) case STATS_HDRS: case STATS_FDS: case STATS_NETDB: - sprintf(msg, "GET cache_object://%s/%s HTTP/1.0\r\n\r\n", - hostname, op_cmds[op]); - break; case SHUTDOWN: sprintf(msg, "GET cache_object://%s/%s@%s HTTP/1.0\r\n\r\n", hostname, op_cmds[op], password); @@ -871,7 +869,7 @@ main(int argc, char *argv[]) p_state = 0; cpy_ind = 0; - n_loops = 0; /* Keep track of the number of passes through while */ + n_loops = 0; /* Keep track of passes through loop */ while ((len = read(conn, buf, sizeof(buf))) > 0) { n_loops++; /* Simple state machine for parsing a {{ } { } ...} style list */ @@ -981,7 +979,7 @@ main(int argc, char *argv[]) return 0; } -static int +static int client_comm_connect(int sock, char *dest_host, u_short dest_port) { const struct hostent *hp; diff --git a/src/squid.h b/src/squid.h index 8ec2a0fdcb..9f7c843ae3 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.66 1996/11/04 18:13:02 wessels Exp $ + * $Id: squid.h,v 1.67 1996/11/04 22:07:28 wessels Exp $ * * AUTHOR: Duane Wessels * @@ -201,6 +201,7 @@ typedef struct _cacheinfo cacheinfo; typedef struct _aclCheck_t aclCheck_t; typedef struct _request request_t; typedef struct _MemObject MemObject; +typedef struct _cachemgr_passwd cachemgr_passwd; /* 32 bit integer compatability hack */ #if SIZEOF_INT == 4 @@ -263,6 +264,7 @@ typedef int (*QS) (const void *, const void *); #include "icmp.h" #include "net_db.h" #include "client_db.h" +#include "objcache.h" #include "refresh.h" #if !HAVE_TEMPNAM