+Changes to squid-1.1.beta3 ():
+
+ - s/()/(void)/
+ - Fixed 8k page leak in icmpRecv().
+
Changes to squid-1.1.beta2 (September 16, 1996):
- Switched to ANSI style coding.
-/* $Id: version.h,v 1.41 1996/09/14 16:55:26 wessels Exp $
+/* $Id: version.h,v 1.42 1996/09/17 16:32:25 wessels Exp $
*
* SQUID_VERSION - String for version id of this distribution
*/
#ifndef SQUID_VERSION
-#define SQUID_VERSION "1.1.beta2"
+#define SQUID_VERSION "1.1.beta3"
#endif
#ifndef SQUID_RELEASE_TIME
/*
- * $Id: rfc1738.c,v 1.4 1996/09/14 08:50:50 wessels Exp $
+ * $Id: rfc1738.c,v 1.5 1996/09/17 16:32:26 wessels Exp $
*
* DEBUG:
* AUTHOR: Harvest Derived
}
}
/* RFC 1738 says any control chars (0x00-0x1F) are encoded */
- if (*p <= (char) 0x1F) {
+ if ((unsigned char) *p <= (unsigned char) 0x1F) {
do_escape = 1;
}
/* RFC 1738 says 0x7f is encoded */
do_escape = 1;
}
/* RFC 1738 says any non-US-ASCII are encoded */
- if ((*p >= (char) 0x80) && (*p <= (char) 0xFF)) {
+ if (((unsigned char) *p >= (unsigned char) 0x80) &&
+ ((unsigned char) *p <= (unsigned char) 0xFF)) {
do_escape = 1;
}
/* Do the triplet encoding, or just copy the char */
# BUGS:
# Should probably cache the gethostbyname() calls.
-@getfrom = ('SOURCE', 'localhost:3128');
+@getfrom = ('SOURCE', 'localhost:3128', 'bo:3128');
require 'sys/socket.ph';
-$gettimeofday = 116; # cheating, should use require syscall.ph
+$gettimeofday = 1128; # cheating, should use require syscall.ph
while (<>) {
chop ($url = $_);
/*
- * $Id: acl.cc,v 1.40 1996/09/17 02:29:48 wessels Exp $
+ * $Id: acl.cc,v 1.41 1996/09/17 16:32:31 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
break;
case 1: /* a significant bits value for a mask */
if (a1 >= 0 && a1 < 33) {
- addr->s_addr = htonl(0xffffffff << (32 - a1));
+ addr->s_addr = htonl(0xfffffffful << (32 - a1));
break;
}
default:
/* Guess netmask */
a = ntohl(addr->s_addr);
- if (!(a & 0xFFFFFFFF))
- mask->s_addr = htonl(0x00000000);
+ if (!(a & 0xFFFFFFFFul))
+ mask->s_addr = htonl(0x00000000ul);
else if (!(a & 0x00FFFFFF))
- mask->s_addr = htonl(0xFF000000);
+ mask->s_addr = htonl(0xFF000000ul);
else if (!(a & 0x0000FFFF))
- mask->s_addr = htonl(0xFFFF0000);
+ mask->s_addr = htonl(0xFFFF0000ul);
else if (!(a & 0x000000FF))
- mask->s_addr = htonl(0xFFFFFF00);
+ mask->s_addr = htonl(0xFFFFFF00ul);
else
- mask->s_addr = htonl(0xFFFFFFFF);
+ mask->s_addr = htonl(0xFFFFFFFFul);
addr->s_addr &= mask->s_addr;
/* 1.2.3.4/255.255.255.0 --> 1.2.3.0 */
}
/*
- * $Id: cache_cf.cc,v 1.90 1996/09/17 02:29:50 wessels Exp $
+ * $Id: cache_cf.cc,v 1.91 1996/09/17 16:32:32 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
#define DefaultTcpOutgoingAddr INADDR_NONE
#define DefaultUdpIncomingAddr INADDR_ANY
#define DefaultUdpOutgoingAddr INADDR_NONE
-#define DefaultClientNetmask 0xFFFFFFFF
+#define DefaultClientNetmask 0xFFFFFFFFul
#define DefaultSslProxyPort 0
#define DefaultSslProxyHost (char *)NULL
#define DefaultIpcacheSize 1024
switch (c) {
case 4:
if (a1 == 0 && a2 == 0 && a3 == 0 && a4 == 0) /* world */
- lmask.s_addr = 0x00000000;
+ lmask.s_addr = 0x00000000ul;
else if (a2 == 0 && a3 == 0 && a4 == 0) /* class A */
- lmask.s_addr = htonl(0xff000000);
+ lmask.s_addr = htonl(0xff000000ul);
else if (a3 == 0 && a4 == 0) /* class B */
- lmask.s_addr = htonl(0xffff0000);
+ lmask.s_addr = htonl(0xffff0000ul);
else if (a4 == 0) /* class C */
- lmask.s_addr = htonl(0xffffff00);
+ lmask.s_addr = htonl(0xffffff00ul);
else
- lmask.s_addr = 0xffffffff;
+ lmask.s_addr = 0xfffffffful;
break;
case 5:
ip_str);
return;
}
- lmask.s_addr = htonl(0xffffffff << (32 - m1));
+ lmask.s_addr = htonl(0xfffffffful << (32 - m1));
break;
case 8:
/*
- * $Id: client_side.cc,v 1.29 1996/09/17 02:29:51 wessels Exp $
+ * $Id: client_side.cc,v 1.30 1996/09/17 16:32:34 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
#define CHECK_PROXY_FILE_TIME 300
char *
-proxyAuthenticate(void)
+proxyAuthenticate(char *headers)
{
/* Keep the time measurements and the hash
* table of users and passwords handy */
/*
- * $Id: comm.cc,v 1.73 1996/09/17 02:29:52 wessels Exp $
+ * $Id: comm.cc,v 1.74 1996/09/17 16:32:35 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
/* Select for Writing on FD, until SIZE bytes are sent. Call
* * HANDLER when complete. */
void
-comm_write(int fd, char *buf, int size, int timeout, rw_complete_handler * handler, void *handler_data, void (*free) (void *))
+comm_write(int fd, char *buf, int size, int timeout, rw_complete_handler * handler, void *handler_data, void (*free_func) (void *))
{
RWStateData *state = NULL;
state->timeout = timeout;
state->time = squid_curtime;
state->handler_data = handler_data;
- state->free = free;
+ state->free = free_func;
fd_table[fd].rwstate = state;
comm_set_select_handler(fd,
COMM_SELECT_WRITE,
/*
- * $Id: debug.cc,v 1.24 1996/09/17 02:29:52 wessels Exp $
+ * $Id: debug.cc,v 1.25 1996/09/17 16:32:36 wessels Exp $
*
* DEBUG: section 0 Debug Routines
* AUTHOR: Harvest Derived
#include "squid.h"
-char *_db_file = __FILE__;
-int _db_line = 0;
+char *volatile _db_file = __FILE__;
+volatile int _db_line = 0;
FILE *debug_log = NULL;
static char *debug_log_file = NULL;
/*
- * $Id: disk.cc,v 1.26 1996/09/17 02:29:53 wessels Exp $
+ * $Id: disk.cc,v 1.27 1996/09/17 16:32:37 wessels Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
int access_code,
void (*handle) (),
void *handle_data,
- void (*free) (void *))
+ void (*free_func) (void *))
{
dwrite_q *wq = NULL;
wq->len = len;
wq->cur_offset = 0;
wq->next = NULL;
- wq->free = free;
+ wq->free = free_func;
file_table[fd].wrt_handle = handle;
file_table[fd].wrt_handle_data = handle_data;
/*
- * $Id: dns.cc,v 1.11 1996/09/17 02:29:54 wessels Exp $
+ * $Id: dns.cc,v 1.12 1996/09/17 16:32:38 wessels Exp $
*
* DEBUG: section 34 Dnsserver interface
* AUTHOR: Harvest Derived
{
dnsserver_t *dnsData = NULL;
int k;
- static char *shutdown = "$shutdown\n";
+ static char *shutdown_cmd = "$shutdown\n";
debug(34, 3, "dnsShutdownServers:\n");
debug(34, 3, "dnsShutdownServers: sending '$shutdown' to dnsserver #%d\n", dnsData->id);
debug(34, 3, "dnsShutdownServers: --> FD %d\n", dnsData->outpipe);
comm_write(dnsData->outpipe,
- xstrdup(shutdown),
- strlen(shutdown),
+ xstrdup(shutdown_cmd),
+ strlen(shutdown_cmd),
0, /* timeout */
NULL, /* Handler */
NULL, /* Handler-data */
/*
- * $Id: errorpage.cc,v 1.39 1996/09/17 02:29:54 wessels Exp $
+ * $Id: errorpage.cc,v 1.40 1996/09/17 16:32:39 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
void
squid_error_entry(StoreEntry * entry, log_type type, char *msg)
{
- int index;
+ int error_index;
if (type < ERR_MIN || type > ERR_MAX)
fatal_dump("squid_error_entry: type out of range.");
- index = (int) (type - ERR_MIN);
- debug(4, 1, "%s: %s\n", ErrorData[index].tag, entry->url);
+ error_index = (int) (type - ERR_MIN);
+ debug(4, 1, "%s: %s\n", ErrorData[error_index].tag, entry->url);
sprintf(tmp_error_buf, SQUID_ERROR_MSG_P1,
entry->url,
entry->url,
- ErrorData[index].shrt);
+ ErrorData[error_index].shrt);
if (msg) {
sprintf(tbuf, SQUID_ERROR_MSG_P2, msg);
strcat(tmp_error_buf, tbuf);
}
sprintf(tbuf, SQUID_ERROR_MSG_P3,
- ErrorData[index].lng,
+ ErrorData[error_index].lng,
Config.errHtmlText,
appname,
version_string,
char *
squid_error_url(char *url, int method, int type, char *address, int code, char *msg)
{
- int index;
+ int error_index;
*tmp_error_buf = '\0';
if (type < ERR_MIN || type > ERR_MAX)
fatal_dump("squid_error_url: type out of range.");
- index = (int) (type - ERR_MIN);
- debug(4, 1, "%s: %s\n", ErrorData[index].tag, url);
+ error_index = (int) (type - ERR_MIN);
+ debug(4, 1, "%s: %s\n", ErrorData[error_index].tag, url);
sprintf(tmp_error_buf, "HTTP/1.0 %d Cache Detected Error\r\nContent-type: text/html\r\n\r\n", code);
sprintf(tbuf, SQUID_ERROR_MSG_P1,
url,
url,
- ErrorData[index].shrt);
+ ErrorData[error_index].shrt);
strcat(tmp_error_buf, tbuf);
if (msg) {
sprintf(tbuf, SQUID_ERROR_MSG_P2, msg);
strcat(tmp_error_buf, tbuf);
}
sprintf(tbuf, SQUID_ERROR_MSG_P3,
- ErrorData[index].lng,
+ ErrorData[error_index].lng,
Config.errHtmlText,
appname,
version_string,
char *
squid_error_request(char *request, int type, char *address, int code)
{
- int index;
+ int error_index;
*tmp_error_buf = '\0';
if (type < ERR_MIN || type > ERR_MAX)
fatal_dump("squid_error_request: type out of range.");
- index = (int) (type - ERR_MIN);
- debug(4, 1, "%s: %s\n", ErrorData[index].tag, request);
+ error_index = (int) (type - ERR_MIN);
+ debug(4, 1, "%s: %s\n", ErrorData[error_index].tag, request);
sprintf(tmp_error_buf, "HTTP/1.0 %d Cache Detected Error\r\nContent-type: text/html\r\n\r\n", code);
sprintf(tbuf, SQUID_REQUEST_ERROR_MSG,
request,
/*
- * $Id: icmp.cc,v 1.5 1996/09/17 05:16:57 wessels Exp $
+ * $Id: icmp.cc,v 1.6 1996/09/17 16:32:40 wessels Exp $
*
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels
int icmp_pktsize = sizeof(struct icmphdr);
pkt = get_free_8k_page();
memset(pkt, '\0', 8192);
- icmp = (struct icmphdr *) pkt;
+ icmp = (struct icmphdr *) (void *) pkt;
icmp->icmp_type = ICMP_ECHO;
icmp->icmp_code = 0;
icmp->icmp_cksum = 0;
(struct sockaddr *) &from,
&fromlen);
debug(37, 9, "icmpRecv: %d bytes from %s\n", n, inet_ntoa(from.sin_addr));
- ip = (struct iphdr *) pkt;
+ ip = (struct iphdr *) (void *) pkt;
iphdrlen = ip->ip_hl << 2;
- icmp = (struct icmphdr *) (pkt + iphdrlen);
+ icmp = (struct icmphdr *) (void *) (pkt + iphdrlen);
if (icmp->icmp_type == ICMP_ECHOREPLY) {
if (icmp->icmp_id == icmp_ident) {
hops = ipHops(ip->ip_ttl);
(void *) IcmpQueueHead);
}
-void
+static void
icmpSend(int fd, icmpQueueData * queue)
{
int x;
debug(37, 0, "icmpSend: Wrote %d of %d bytes\n", x, queue->len);
}
IcmpQueueHead = queue->next;
- icmpLog((struct icmphdr *) queue->msg, queue->to.sin_addr, 0, 0);
+ icmpLog((struct icmphdr *) (void *) queue->msg, queue->to.sin_addr, 0, 0);
if (queue->free)
queue->free(queue->msg);
safe_free(queue);
/*
- * $Id: ident.cc,v 1.14 1996/09/16 21:20:47 wessels Exp $
+ * $Id: ident.cc,v 1.15 1996/09/17 16:32:41 wessels Exp $
*
* DEBUG: section 30 Ident (RFC 931)
* AUTHOR: Duane Wessels
identStart(int sock, icpStateData * icpState)
{
char *host;
- u_short port;
LOCAL_ARRAY(char, reqbuf, BUFSIZ);
int status;
host = inet_ntoa(icpState->peer.sin_addr);
- port = ntohs(icpState->peer.sin_port);
if (sock < 0) {
sock = comm_open(SOCK_STREAM,
/*
- * $Id: main.cc,v 1.79 1996/09/17 02:30:00 wessels Exp $
+ * $Id: main.cc,v 1.80 1996/09/17 16:32:42 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
int opt_no_ipcache = 0; /* use ipcache by default */
static int opt_send_signal = -1; /* no signal to send */
int vhost_mode = 0;
-int unbuffered_logs = 1; /* debug and hierarhcy unbuffered by default */
-int shutdown_pending = 0; /* set by SIGTERM handler (shut_down()) */
-int reread_pending = 0; /* set by SIGHUP handler */
+volatile int unbuffered_logs = 1; /* debug and hierarchy unbuffered by default */
+volatile int shutdown_pending = 0; /* set by SIGTERM handler (shut_down()) */
+volatile int reread_pending = 0; /* set by SIGHUP handler */
char version_string[] = SQUID_VERSION;
char appname[] = "squid";
char localhost[] = "127.0.0.1";
/* for error reporting from xmalloc and friends */
extern void (*failure_notify) __P((char *));
-static int rotate_pending = 0; /* set by SIGUSR1 handler */
+volatile static int rotate_pending = 0; /* set by SIGUSR1 handler */
static int httpPortNumOverride = 1;
static int icpPortNumOverride = 1; /* Want to detect "-u 0" */
#if MALLOC_DBG
mainMaintenance(void)
{
time_t next;
- int n;
if (squid_curtime >= next_maintain) {
storeMaintainSwapSpace();
next_maintain = squid_curtime + 1;
}
- if (store_rebuilding != STORE_NOT_REBUILDING)
- goto maintenance_done;
- if (squid_curtime >= next_ip_purge) {
- ipcache_purgelru();
- next_ip_purge = squid_curtime + 10;
- } else if (squid_curtime >= next_dirclean) {
- /* clean a cache directory every 15 seconds */
- /* 15 * 16 * 256 = 17 hrs */
- storeDirClean();
- next_dirclean = squid_curtime + 15;
- } else if (squid_curtime >= next_cleaning) {
- n = storePurgeOld();
- next_cleaning = squid_curtime + Config.cleanRate;
- } else if (squid_curtime >= next_announce) {
- send_announce();
- next_announce = squid_curtime + Config.Announce.rate;
+
+ if (store_rebuilding == STORE_NOT_REBUILDING) {
+ if (squid_curtime >= next_ip_purge) {
+ ipcache_purgelru();
+ next_ip_purge = squid_curtime + 10;
+ } else if (squid_curtime >= next_dirclean) {
+ /* clean a cache directory every 15 seconds */
+ /* 15 * 16 * 256 = 17 hrs */
+ storeDirClean();
+ next_dirclean = squid_curtime + 15;
+ } else if (squid_curtime >= next_cleaning) {
+ storePurgeOld();
+ next_cleaning = squid_curtime + Config.cleanRate;
+ } else if (squid_curtime >= next_announce) {
+ send_announce();
+ next_announce = squid_curtime + Config.Announce.rate;
+ }
}
- maintenance_done:
+
next = next_ip_purge;
if (next_dirclean < next)
next = next_dirclean;
/*
- * $Id: squid.h,v 1.49 1996/09/16 21:11:14 wessels Exp $
+ * $Id: squid.h,v 1.50 1996/09/17 16:32:45 wessels Exp $
*
* AUTHOR: Duane Wessels
*
#endif
#ifndef INADDR_NONE
-#define INADDR_NONE -1
+#define INADDR_NONE ((unsigned long) -1)
#endif
#if !defined(HAVE_RUSAGE) && defined(_SQUID_HPUX_)
extern int theHttpConnection; /* main.c */
extern int theInIcpConnection; /* main.c */
extern int theOutIcpConnection; /* main.c */
-extern int shutdown_pending; /* main.c */
-extern int reread_pending; /* main.c */
+extern volatile int shutdown_pending; /* main.c */
+extern volatile int reread_pending; /* main.c */
extern int opt_unlink_on_reload; /* main.c */
extern int opt_reload_hit_only; /* main.c */
extern int opt_dns_tests; /* main.c */
/*
- * $Id: stat.cc,v 1.71 1996/09/17 02:30:03 wessels Exp $
+ * $Id: stat.cc,v 1.72 1996/09/17 16:32:46 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
/* GLOBALS */
Meta_data meta_data;
-unsigned long ntcpconn = 0;
-unsigned long nudpconn = 0;
+volatile unsigned long ntcpconn = 0;
+volatile unsigned long nudpconn = 0;
struct _iostats IOStats;
char *stat_describe();
/*
- * $Id: tools.cc,v 1.60 1996/09/17 02:30:06 wessels Exp $
+ * $Id: tools.cc,v 1.61 1996/09/17 16:32:49 wessels Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
{
struct tm *tm;
static char buf[128];
- static char last_t = 0;
+ static time_t last_t = 0;
if (t != last_t) {
tm = localtime(&t);
strftime(buf, 127, "%y/%m/%d %T", tm);