/*
- * $Id: acl.cc,v 1.16 1996/07/15 23:10:53 wessels Exp $
+ * $Id: acl.cc,v 1.17 1996/07/18 20:26:59 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
struct _acl_ip_data *head = NULL;
struct _acl_ip_data **Tail = &head;
struct _acl_ip_data *q = NULL;
- static char addr1[256], addr2[256], mask[256];
+ LOCAL_ARRAY(char, addr1, 256);
+ LOCAL_ARRAY(char, addr2, 256);
+ LOCAL_ARRAY(char, mask, 256);
while ((t = strtok(NULL, w_space))) {
q = xcalloc(1, sizeof(struct _acl_ip_data));
debug(28, 3, "aclMatchEndOfWord: looking for '%s'\n", data->key);
if ((offset = strlen(word) - strlen(data->key)) < 0)
continue;
- if (strcmp(word + offset, data->key) == 0)
+ if (strcasecmp(word + offset, data->key) == 0)
return 1;
}
return 0;
/*
- * $Id: debug.cc,v 1.18 1996/07/09 03:41:21 wessels Exp $
+ * $Id: debug.cc,v 1.19 1996/07/18 20:27:00 wessels Exp $
*
* DEBUG: section 0 Debug Routines
* AUTHOR: Harvest Derived
int level;
char *format = NULL;
#endif
- static char f[BUFSIZ];
- static char tmpbuf[BUFSIZ];
+ LOCAL_ARRAY(char, f, BUFSIZ);
+ LOCAL_ARRAY(char, tmpbuf, BUFSIZ);
char *s = NULL;
if (debug_log == NULL)
void _db_rotate_log()
{
int i;
- static char from[MAXPATHLEN];
- static char to[MAXPATHLEN];
+ LOCAL_ARRAY(char, from, MAXPATHLEN);
+ LOCAL_ARRAY(char, to, MAXPATHLEN);
if (debug_log_file == NULL)
return;
/*
- * $Id: disk.cc,v 1.19 1996/07/17 16:59:59 wessels Exp $
+ * $Id: disk.cc,v 1.20 1996/07/18 20:27:00 wessels Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
int end_pos;
int st_pos;
int used_bytes;
- static char temp_line[DISK_LINE_LEN];
+ LOCAL_ARRAY(char, temp_line, DISK_LINE_LEN);
lseek(fd, walk_dat->offset, SEEK_SET);
file_table[fd].at_eof = NO;
+
/*
- * $Id: ftp.cc,v 1.42 1996/07/15 23:57:51 wessels Exp $
+ * $Id: ftp.cc,v 1.43 1996/07/18 20:27:01 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
int fd;
FtpData *data;
{
- static char buf[SQUID_TCP_SO_RCVBUF];
+ LOCAL_ARRAY(char, buf, SQUID_TCP_SO_RCVBUF);
int len;
int clen;
int off;
char *path = NULL;
char *mode = NULL;
char *buf = NULL;
- static char tbuf[BUFSIZ];
- static char opts[BUFSIZ];
+ LOCAL_ARRAY(char, tbuf, BUFSIZ);
+ LOCAL_ARRAY(char, opts, BUFSIZ);
static char *space = " ";
char *s = NULL;
int got_timeout = 0;
request_t *request;
StoreEntry *entry;
{
- static char realm[8192];
+ LOCAL_ARRAY(char, realm, 8192);
FtpData *data = NULL;
char *req_hdr = entry->mem_obj->mime_hdr;
char *auth_hdr;
int cfd;
int squid_to_ftpget[2];
int ftpget_to_squid[2];
- static char pbuf[128];
+ LOCAL_ARRAY(char, pbuf, 128);
char *ftpget = getFtpProgram();
struct sockaddr_in S;
int len;
/*
- * $Id: gopher.cc,v 1.32 1996/07/15 23:14:27 wessels Exp $
+ * $Id: gopher.cc,v 1.33 1996/07/18 20:27:01 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
char *name;
char *def;
{
- static char temp[MAX_URL + 1];
+ LOCAL_ARRAY(char, temp, MAX_URL + 1);
char *ext1 = NULL;
char *ext2 = NULL;
char *str = NULL;
void gopherMimeCreate(data)
GopherData *data;
{
- static char tempMIME[MAX_MIME];
+ LOCAL_ARRAY(char, tempMIME, MAX_MIME);
sprintf(tempMIME, "\
HTTP/1.0 200 OK Gatewaying\r\n\
char *type_id;
char *request;
{
- static char proto[MAX_URL];
- static char hostbuf[MAX_URL];
+ LOCAL_ARRAY(char, proto, MAX_URL);
+ LOCAL_ARRAY(char, hostbuf, MAX_URL);
int t;
proto[0] = hostbuf[0] = '\0';
void gopherEndHTML(data)
GopherData *data;
{
- static char tmpbuf[TEMP_BUF_SIZE];
+ LOCAL_ARRAY(char, tmpbuf, TEMP_BUF_SIZE);
if (!data->data_in) {
sprintf(tmpbuf, "<HR><H2><i>Server Return Nothing.</i></H2>\n");
char *pos = inbuf;
char *lpos = NULL;
char *tline = NULL;
- static char line[TEMP_BUF_SIZE];
- static char tmpbuf[TEMP_BUF_SIZE];
- static char outbuf[TEMP_BUF_SIZE << 4];
+ LOCAL_ARRAY(char, line, TEMP_BUF_SIZE);
+ LOCAL_ARRAY(char, tmpbuf, TEMP_BUF_SIZE);
+ LOCAL_ARRAY(char, outbuf, TEMP_BUF_SIZE << 4);
char *name = NULL;
char *selector = NULL;
char *host = NULL;
int t;
int code;
int recno;
- static char result[MAX_CSO_RESULT];
+ LOCAL_ARRAY(char, result, MAX_CSO_RESULT);
tline = line;
GopherData *data;
{
int len;
- static char query[MAX_URL];
+ LOCAL_ARRAY(char, query, MAX_URL);
char *buf = get_free_4k_page();
data->icp_page_ptr = buf;
/*
- * $Id: http.cc,v 1.61 1996/07/15 23:15:16 wessels Exp $
+ * $Id: http.cc,v 1.62 1996/07/18 20:27:02 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
int fd;
HttpStateData *httpState;
{
- static char buf[SQUID_TCP_SO_RCVBUF];
+ LOCAL_ARRAY(char, buf, SQUID_TCP_SO_RCVBUF);
int len;
int bin;
int clen;
/*
- * $Id: ident.cc,v 1.4 1996/07/11 17:25:24 wessels Exp $
+ * $Id: ident.cc,v 1.5 1996/07/18 20:27:04 wessels Exp $
*
* DEBUG: section 31 Ident (RFC 931)
* AUTHOR: Duane Wessels
{
char *host;
u_short port;
- static char reqbuf[BUFSIZ];
+ LOCAL_ARRAY(char, reqbuf, BUFSIZ);
int status;
host = inet_ntoa(icpState->peer.sin_addr);
int fd;
icpStateData *icpState;
{
- static char buf[BUFSIZ];
+ LOCAL_ARRAY(char, buf, BUFSIZ);
char *t = NULL;
int len = -1;
/*
- * $Id: ipcache.cc,v 1.32 1996/07/15 23:10:54 wessels Exp $
+ * $Id: ipcache.cc,v 1.33 1996/07/18 20:27:04 wessels Exp $
*
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
char *prg = getDnsProgram();
int k;
int dnssocket;
- static char fd_note_buf[FD_ASCII_NOTE_SZ];
+ LOCAL_ARRAY(char, fd_note_buf, FD_ASCII_NOTE_SZ);
/* free old structures if present */
if (dns_child_table) {
/*
- * $Id: mime.cc,v 1.13 1996/07/09 03:41:33 wessels Exp $
+ * $Id: mime.cc,v 1.14 1996/07/18 20:27:05 wessels Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
char *mime_get_header(char *mime, char *name)
{
- static char header[GET_HDR_SZ];
+ LOCAL_ARRAY(char, header, GET_HDR_SZ);
char *p = NULL;
char *q = NULL;
char got = 0;
int low;
int high;
int comp;
- static char ext[16];
+ LOCAL_ARRAY(char, ext, 16);
char *cp = NULL;
if (!extension || strlen(extension) >= (sizeof(ext) - 1))
{
time_t expiretime;
time_t t;
- static char date[100];
- static char expires[100];
- static char last_modified[100];
- static char content_length[100];
+ LOCAL_ARRAY(char, date, 100);
+ LOCAL_ARRAY(char, expires, 100);
+ LOCAL_ARRAY(char, last_modified, 100);
+ LOCAL_ARRAY(char, content_length, 100);
if (result == NULL)
return 1;
/*
- * $Id: neighbors.cc,v 1.30 1996/07/17 17:50:07 wessels Exp $
+ * $Id: neighbors.cc,v 1.31 1996/07/18 20:27:06 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
char *url = entry->url;
MemObject *mem = entry->mem_obj;
static time_t last_time = 0;
- static char time_str[128];
+ LOCAL_ARRAY(char, time_str, 128);
char *s = NULL;
if (!cache_hierarchy_log)
mem->w_rtt = 0;
mem->start_ping = current_time;
- if (friends->edges_head == (edge *) NULL)
+ if (friends->edges_head == NULL)
return 0;
for (i = 0, e = friends->first_ping; i++ < friends->n; e = e->next) {
/* Don't resolve refreshes through neighbors because we don't resolve
* misses through neighbors */
- if (e->type == EDGE_SIBLING && entry->flag & REFRESH_REQUEST)
+ if (entry->flag & REFRESH_REQUEST && e->type == EDGE_SIBLING)
continue;
/* skip any cache where we failed to connect() w/in the last 60s */
if (e->icp_port == echo_port) {
debug(15, 4, "neighborsUdpPing: Looks like a dumb cache, send DECHO ping\n");
- icpUdpSend(friends->fd, url, &echo_hdr, &e->in_addr, ICP_OP_DECHO, LOG_TAG_NONE);
+ icpUdpSend(friends->fd,
+ url,
+ &echo_hdr,
+ &e->in_addr,
+ ICP_OP_DECHO,
+ LOG_TAG_NONE);
} else {
- icpUdpSend(friends->fd, url, &e->header, &e->in_addr, ICP_OP_QUERY, LOG_TAG_NONE);
+ icpUdpSend(friends->fd,
+ url,
+ &e->header,
+ &e->in_addr,
+ ICP_OP_QUERY,
+ LOG_TAG_NONE);
}
e->stats.ack_deficit++;
{
char *fname = NULL;
int i;
- static char from[MAXPATHLEN];
- static char to[MAXPATHLEN];
+ LOCAL_ARRAY(char, from, MAXPATHLEN);
+ LOCAL_ARRAY(char, to, MAXPATHLEN);
if ((fname = getHierarchyLogFile()) == NULL)
return;
/*
- * $Id: redirect.cc,v 1.4 1996/07/16 01:51:14 wessels Exp $
+ * $Id: redirect.cc,v 1.5 1996/07/18 20:27:07 wessels Exp $
*
* DEBUG: section 29 Redirector
* AUTHOR: Duane Wessels
char *prg = getRedirectProgram();
int k;
int redirectsocket;
- static char fd_note_buf[FD_ASCII_NOTE_SZ];
+ LOCAL_ARRAY(char, fd_note_buf, FD_ASCII_NOTE_SZ);
static int first_time = 0;
if (!do_redirect)
/*
- * $Id: send-announce.cc,v 1.14 1996/07/15 23:10:57 wessels Exp $
+ * $Id: send-announce.cc,v 1.15 1996/07/18 20:27:08 wessels Exp $
*
* DEBUG: section 27 Cache Announcer
* AUTHOR: Duane Wessels
void send_announce()
{
- static char tbuf[256];
- static char sndbuf[BUFSIZ];
+ LOCAL_ARRAY(char, tbuf, 256);
+ LOCAL_ARRAY(char, sndbuf, BUFSIZ);
icpUdpData *qdata = NULL;
struct hostent *hp = NULL;
char *host = NULL;
/*
- * $Id: squid.h,v 1.27 1996/07/15 23:48:36 wessels Exp $
+ * $Id: squid.h,v 1.28 1996/07/18 20:27:08 wessels Exp $
*
* AUTHOR: Duane Wessels
*
#endif
#define NUM32LEN sizeof(num32) /* this should always be 4 */
+#if MALLOC_GUARD
+#define LOCAL_ARRAY(type,name,size) \
+ static type *local_##name=NULL; \
+ type *name = local_##name ? local_##name : \
+ ( local_##name = (type *)xcalloc(size, sizeof(type)) )
+#else
+#define LOCAL_ARRAY(type,name,size) static type name[size]
+#endif
+
#include "GNUregex.h"
#include "ansihelp.h"
+
/*
- * $Id: ssl.cc,v 1.5 1996/07/11 17:42:53 wessels Exp $
+ * $Id: ssl.cc,v 1.6 1996/07/18 20:27:09 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
/*
- * $Id: stat.cc,v 1.41 1996/07/17 17:03:20 wessels Exp $
+ * $Id: stat.cc,v 1.42 1996/07/18 20:27:10 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
StoreEntry *sentry;
int vm_or_not;
{
- static char space[40];
- static char space2[40];
+ LOCAL_ARRAY(char, space, 40);
+ LOCAL_ARRAY(char, space2, 40);
int npend = 0;
StoreEntry *entry = NULL;
int N = 0;
char *host;
u_short port;
{
- static char buf[32];
+ LOCAL_ARRAY(char, buf, 32);
sprintf(buf, "%s.%d", host, (int) port);
return buf;
}
char *ident;
hier_code hier;
{
- static char tmp[6000]; /* MAX_URL is 4096 */
+ LOCAL_ARRAY(char, tmp, 6000); /* MAX_URL is 4096 */
char *buf = NULL;
int x;
char *stat_describe(entry)
StoreEntry *entry;
{
- static char state[256];
+ LOCAL_ARRAY(char, state, 256);
state[0] = '\0';
switch (entry->store_status) {
char *mem_describe(entry)
StoreEntry *entry;
{
- static char where[100];
+ LOCAL_ARRAY(char, where, 100);
where[0] = '\0';
if (entry->swap_file_number >= 0)
StoreEntry *entry;
{
int hh, mm, ss;
- static char TTL[60];
+ LOCAL_ARRAY(char, TTL, 60);
int ttl;
TTL[0] = '\0';
char *flags_describe(entry)
StoreEntry *entry;
{
- static char FLAGS[32];
+ LOCAL_ARRAY(char, FLAGS, 32);
char LOCK_CNT[32];
strcpy(FLAGS, "F:");
void stat_rotate_log()
{
int i;
- static char from[MAXPATHLEN];
- static char to[MAXPATHLEN];
+ LOCAL_ARRAY(char, from, MAXPATHLEN);
+ LOCAL_ARRAY(char, to, MAXPATHLEN);
char *fname = NULL;
if ((fname = CacheInfo->logfilename) == NULL)
/*
- * $Id: store.cc,v 1.69 1996/07/17 17:10:00 wessels Exp $
+ * $Id: store.cc,v 1.70 1996/07/18 20:27:10 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
static char *time_describe(t)
time_t t;
{
- static char buf[128];
+ LOCAL_ARRAY(char, buf, 128);
if (t < 60) {
sprintf(buf, "%ds", (int) t);
void storeAppendPrintf(StoreEntry * e, char *fmt,...)
{
va_list args;
- static char buf[4096];
+ LOCAL_ARRAY(char, buf, 4096);
va_start(args, fmt);
#else
void storeAppendPrintf(va_alist)
va_list args;
StoreEntry *e = NULL;
char *fmt = NULL;
- static char buf[4096];
+ LOCAL_ARRAY(char, buf, 4096);
va_start(args);
e = va_arg(args, StoreEntry *);
fmt = va_arg(args, char *);
int fn;
char *fullpath;
{
- static char fullfilename[MAX_FILE_NAME_LEN];
+ LOCAL_ARRAY(char, fullfilename, MAX_FILE_NAME_LEN);
if (fullpath) {
sprintf(fullpath, "%s/%02d/%d",
int flag;
StoreEntry *e;
{
- static char filename[MAX_FILE_NAME_LEN];
+ LOCAL_ARRAY(char, filename, MAX_FILE_NAME_LEN);
MemObject *mem = e->mem_obj;
debug(20, 3, "storeSwapOutHandle: '%s'\n", e->key);
StoreEntry *e;
{
int fd;
- static char swapfilename[MAX_FILE_NAME_LEN];
+ LOCAL_ARRAY(char, swapfilename, MAX_FILE_NAME_LEN);
int x;
MemObject *mem = e->mem_obj;
/* Suggest a new swap file number */
static int storeDoRebuildFromDisk(data)
struct storeRebuild_data *data;
{
- static char log_swapfile[MAXPATHLEN];
- static char swapfile[MAXPATHLEN];
- static char url[MAX_URL + 1];
+ LOCAL_ARRAY(char, log_swapfile, MAXPATHLEN);
+ LOCAL_ARRAY(char, swapfile, MAXPATHLEN);
+ LOCAL_ARRAY(char, url, MAX_URL + 1);
char *t = NULL;
StoreEntry *e = NULL;
time_t expires;
StoreEntry *e;
char *msg;
{
- static char mime_hdr[300];
- static char abort_msg[2000];
+ LOCAL_ARRAY(char, mime_hdr, 300);
+ LOCAL_ARRAY(char, abort_msg, 2000);
debug(20, 6, "storeAbort: '%s'\n", e->key);
e->expires = squid_curtime + getNegativeTTL();
static void storeCreateSwapSubDirs()
{
int i, j;
- static char name[MAXPATHLEN];
+ LOCAL_ARRAY(char, name, MAXPATHLEN);
for (j = 0; j < ncache_dirs; j++) {
for (i = 0; i < SWAP_DIRECTORIES; i++) {
sprintf(name, "%s/%02d", swappath(j), i);
*/
void storeSanityCheck()
{
- static char name[4096];
+ LOCAL_ARRAY(char, name, 4096);
int i;
if (ncache_dirs < 1)
int storeWriteCleanLog()
{
StoreEntry *e = NULL;
- static char swapfilename[MAX_FILE_NAME_LEN];
+ LOCAL_ARRAY(char, swapfilename, MAX_FILE_NAME_LEN);
FILE *fp = NULL;
int n = 0;
int x = 0;
{
char *fname = NULL;
int i;
- static char from[MAXPATHLEN];
- static char to[MAXPATHLEN];
+ LOCAL_ARRAY(char, from, MAXPATHLEN);
+ LOCAL_ARRAY(char, to, MAXPATHLEN);
if (storelog_fd > -1) {
file_close(storelog_fd);
/*
- * $Id: tools.cc,v 1.44 1996/07/15 23:48:38 wessels Exp $
+ * $Id: tools.cc,v 1.45 1996/07/18 20:27:12 wessels Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
static char *dead_msg()
{
- static char msg[1024];
+ LOCAL_ARRAY(char, msg, 1024);
sprintf(msg, DEAD_MSG, version_string, version_string);
return msg;
}
void mail_warranty()
{
FILE *fp = NULL;
- static char filename[256];
- static char command[256];
+ LOCAL_ARRAY(char, filename, 256);
+ LOCAL_ARRAY(char, command, 256);
sprintf(filename, "/tmp/mailin%d", (int) getpid());
fp = fopen(filename, "w");
char *getMyHostname()
{
- static char host[SQUIDHOSTNAMELEN + 1];
+ LOCAL_ARRAY(char, host, SQUIDHOSTNAMELEN + 1);
static int present = 0;
struct hostent *h = NULL;
char *t = NULL;
+
/*
- * $Id: tunnel.cc,v 1.5 1996/07/11 17:42:53 wessels Exp $
+ * $Id: tunnel.cc,v 1.6 1996/07/18 20:27:09 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
/*
- * $Id: url.cc,v 1.23 1996/07/15 23:13:34 wessels Exp $
+ * $Id: url.cc,v 1.24 1996/07/18 20:27:12 wessels Exp $
*
* DEBUG: section 23 URL Parsing
* AUTHOR: Duane Wessels
method_t method;
char *url;
{
- static char proto[MAX_URL + 1];
- static char login[MAX_URL + 1];
- static char host[MAX_URL + 1];
- static char urlpath[MAX_URL + 1];
+ LOCAL_ARRAY(char, proto, MAX_URL + 1);
+ LOCAL_ARRAY(char, login, MAX_URL + 1);
+ LOCAL_ARRAY(char, host, MAX_URL + 1);
+ LOCAL_ARRAY(char, urlpath, MAX_URL + 1);
request_t *request = NULL;
char *t = NULL;
int port;
request_t *request;
char *buf;
{
- static char urlbuf[MAX_URL + 1];
- static char portbuf[32];
+ LOCAL_ARRAY(char, urlbuf, MAX_URL + 1);
+ LOCAL_ARRAY(char, portbuf, 32);
if (buf == NULL)
buf = urlbuf;
switch (request->method) {
/*
- * $Id: wais.cc,v 1.32 1996/07/15 23:14:28 wessels Exp $
+ * $Id: wais.cc,v 1.33 1996/07/18 20:27:13 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
int fd;
WaisStateData *waisState;
{
- static char buf[4096];
+ LOCAL_ARRAY(char, buf, 4096);
int len;
StoreEntry *entry = NULL;