/*
- * $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
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 *));
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
}
-/* 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); \
*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)
{
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)
{
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"))
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();
}
/*
- * $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
"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)",
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);
}
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);
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 */
return 0;
}
-static int
+static int
client_comm_connect(int sock, char *dest_host, u_short dest_port)
{
const struct hostent *hp;
/*
- * $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
*
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
#include "icmp.h"
#include "net_db.h"
#include "client_db.h"
+#include "objcache.h"
#include "refresh.h"
#if !HAVE_TEMPNAM