/*
- * $Id: access_log.cc,v 1.19 1998/02/02 21:14:54 wessels Exp $
+ * $Id: access_log.cc,v 1.20 1998/02/03 04:21:10 wessels Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
LogfileStatus = LOG_ENABLE;
}
-#define SKIP_BASIC_SZ 6
void
accessLogLog(AccessLogEntry * al)
{
/*
- * $Id: acl.cc,v 1.131 1998/02/02 21:59:43 wessels Exp $
+ * $Id: acl.cc,v 1.132 1998/02/03 04:21:11 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
return 0;
}
-#define SKIP_BASIC_SZ 6
static int
aclMatchProxyAuth(struct _acl_proxy_auth *p, aclCheck_t * checklist)
{
passwd = strtok(NULL, "\n");
debug(28, 5) ("aclReadProxyAuth: adding new passwords to hash table\n");
while (user != NULL) {
- if (strlen(user) > 1 && passwd && strlen(passwd) > 1) {
+ if ((int)strlen(user) > 1 && passwd && (int) strlen(passwd) > 1) {
debug(28, 6) ("aclReadProxyAuth: adding %s, %s to hash table\n", user, passwd);
hash_insert(p->hash, xstrdup(user), (void *) xstrdup(passwd));
}
/*
- * $Id: asn.cc,v 1.16 1998/02/02 21:16:17 wessels Exp $
+ * $Id: asn.cc,v 1.17 1998/02/03 04:21:11 wessels Exp $
*
* DEBUG: section 53 AS Number handling
* AUTHOR: Duane Wessels, Kostas Anagnostakis
static void
destroyRadixNodeInfo(as_info * e_info)
{
- intlist *first, *prev;
+ intlist *prev = NULL;
intlist *data = e_info->as_number;
- first = data;
- prev = NULL;
while (data) {
prev = data;
data = data->next;
/*
- * $Id: client_side.cc,v 1.202 1998/02/02 21:16:19 wessels Exp $
+ * $Id: client_side.cc,v 1.203 1998/02/03 04:21:12 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
http->http_code = HTTP_OK;
}
msg = httpReplyHeader(1.0, http->http_code, NULL, 0, 0, -1);
- if (strlen(msg) < 8190)
+ if ((int)strlen(msg) < 8190)
strcat(msg, "\r\n");
comm_write(fd, xstrdup(msg), strlen(msg), clientWriteComplete, http, xfree);
}
comm_close(fd);
} else if (entry->store_status == STORE_ABORTED) {
comm_close(fd);
- } else if ((done = clientCheckTransferDone(http)) || size == 0) {
+ } else if ((done = clientCheckTransferDone(http)) != 0 || size == 0) {
debug(12, 5) ("clientWriteComplete: FD %d transfer is DONE\n", fd);
/* We're finished case */
if (http->entry->mem_obj->reply->content_length < 0 || !done ||
#define STORE_ENTRY_WITHOUT_MEMOBJ 0
#define STORE_SWAP_BUF DISK_PAGE_SIZE
#define VM_WINDOW_SZ DISK_PAGE_SIZE
+
+#define SKIP_BASIC_SZ ((size_t) 6)
/*
- * $Id: fqdncache.cc,v 1.78 1998/01/12 04:30:37 wessels Exp $
+ * $Id: fqdncache.cc,v 1.79 1998/02/03 04:21:13 wessels Exp $
*
* DEBUG: section 35 FQDN Cache
* AUTHOR: Harvest Derived
i = 0;
while (fq != NULL) {
newname[vp->namelen] = i + 1;
- result = compare(name, *length, newname, (int) vp->namelen + 1);
+ result = snmpCompare(name, *length, newname, (int) vp->namelen + 1);
if ((exact && (result == 0)) || (!exact && (result < 0))) {
debug(49, 5) ("snmp var_fqdn_entry: yup, a match.\n");
break;
/*
- * $Id: ftp.cc,v 1.189 1998/02/02 21:16:25 wessels Exp $
+ * $Id: ftp.cc,v 1.190 1998/02/03 04:21:14 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
size_t width = Config.Ftp.list_width;
ftpListParts *parts;
int flags = ftpState->flags;
- if (strlen(line) > 1024) {
+ if ((int)strlen(line) > 1024) {
snprintf(html, 8192, "%s\n", line);
return html;
}
ftpSendPort(ftpState);
return;
}
- if (strlen(buf) > 1024) {
+ if ((int)strlen(buf) > 1024) {
debug(9, 1) ("ftpReadPasv: Avoiding potential buffer overflow\n");
ftpSendPort(ftpState);
return;
if (request->port != urlDefaultPort(request->protocol))
snprintf(portbuf, 32, ":%d", request->port);
loginbuf[0] = '\0';
- if (strlen(request->login) > 0) {
+ if ((int)strlen(request->login) > 0) {
strcpy(loginbuf, request->login);
if ((t = strchr(loginbuf, ':')))
*t = '\0';
/*
- * $Id: http.cc,v 1.234 1998/01/12 04:30:39 wessels Exp $
+ * $Id: http.cc,v 1.235 1998/02/03 04:21:15 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
EBIT_SET(cc_flags, CCC_MAXAGE);
} else if (strncasecmp(xbuf, "Via:", 4) == 0) {
for (s = xbuf + 4; *s && isspace(*s); s++);
- if (strlen(viabuf) + strlen(s) < 4000)
+ if ((int)strlen(viabuf) + (int)strlen(s) < 4000)
strcat(viabuf, s);
strcat(viabuf, ", ");
continue;
} else if (strncasecmp(xbuf, "X-Forwarded-For:", 16) == 0) {
for (s = xbuf + 16; *s && isspace(*s); s++);
- if (strlen(fwdbuf) + strlen(s) < 4000)
+ if ((int)strlen(fwdbuf) + (int)strlen(s) < 4000)
strcat(fwdbuf, s);
strcat(fwdbuf, ", ");
continue;
/*
- * $Id: icmp.cc,v 1.54 1998/01/31 05:31:58 wessels Exp $
+ * $Id: icmp.cc,v 1.55 1998/02/03 04:21:16 wessels Exp $
*
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels
{
icmpQueueData *queue = data;
int x;
- while ((queue = IcmpQueueHead)) {
+ while ((queue = IcmpQueueHead) != NULL) {
x = send(icmp_sock,
queue->msg,
queue->len,
debug(29, 0) ("Closing Pinger socket on FD %d\n", icmp_sock);
comm_close(icmp_sock);
icmp_sock = -1;
- while ((queue = IcmpQueueHead)) {
+ while ((queue = IcmpQueueHead) != NULL) {
IcmpQueueHead = queue->next;
if (queue->free_func)
queue->free_func(queue->msg);
const cache_key *key;
request_t *icp_request = NULL;
int allow = 0;
- int pkt_len;
aclCheck_t checklist;
icp_common_t *reply;
int src_rtt = 0;
entry = storeGet(key);
debug(12, 5) ("icpHandleIcpV2: OPCODE %s\n", icp_opcode_str[header.opcode]);
if (icpCheckUdpHit(entry, icp_request)) {
- pkt_len = sizeof(icp_common_t) + strlen(url) + 1 + 2 + entry->object_len;
reply = icpCreateMessage(ICP_HIT, flags, url, header.reqnum, src_rtt);
icpUdpSend(fd, &from, reply, LOG_UDP_HIT, icp_request->protocol);
break;
/*
- * $Id: ipcache.cc,v 1.153 1998/01/06 05:15:41 wessels Exp $
+ * $Id: ipcache.cc,v 1.154 1998/02/03 04:21:17 wessels Exp $
*
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
for (m = lru_list.head; m; m = m->next, cnt++) {
newname[vp->namelen] = cnt;
- result = compare(name, *length, newname, (int) vp->namelen + 1);
+ result = snmpCompare(name, *length, newname, (int) vp->namelen + 1);
if ((exact && (result == 0)) || (!exact && (result < 0))) {
debug(49, 5) ("snmp var_ipcache_entry: yup, a match.\n");
break;
/*
- * $Id: net_db.cc,v 1.60 1998/01/12 04:30:06 wessels Exp $
+ * $Id: net_db.cc,v 1.61 1998/02/03 04:21:18 wessels Exp $
*
* DEBUG: section 37 Network Measurement Database
* AUTHOR: Duane Wessels
netdbRelease(netdbEntry * n)
{
net_db_name *x;
- net_db_name *next;
+ net_db_name *next = NULL;
for (x = n->hosts; x; x = next) {
next = x->next;
netdbHashUnlink(x->name);
return;
}
next = (netdbEntry *) hash_first(addr_table);
- while ((n = next)) {
+ while ((n = next) != NULL) {
next = (netdbEntry *) hash_next(addr_table);
if (n->pings_recv == 0)
continue;
}
for (j = 0; j < i; j++) {
n = *(L1 + j);
- while ((x = n->hosts)) {
+ while ((x = n->hosts) != NULL) {
n->hosts = x->next;
safe_free(x);
}
n = (netdbEntry *) hash_first(addr_table);
while (n != NULL) {
newname[vp->namelen] = cnt++;
- result = compare(name, *length, newname, (int) vp->namelen + 1);
+ result = snmpCompare(name, *length, newname, (int) vp->namelen + 1);
if ((exact && (result == 0)) || (!exact && (result < 0))) {
debug(49, 5) ("snmp var_netdb_entry: yup, a match.\n");
break;
/*
- * $Id: peer_select.cc,v 1.36 1998/01/31 05:32:03 wessels Exp $
+ * $Id: peer_select.cc,v 1.37 1998/02/03 04:21:19 wessels Exp $
*
* DEBUG: section 44 Peer Selection Algorithm
* AUTHOR: Duane Wessels
debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], request->host);
hierarchyNote(&request->hier, code, &psstate->icp, request->host);
peerSelectCallback(psstate, NULL);
- } else if ((p = psstate->closest_parent_miss)) {
+ } else if ((p = psstate->closest_parent_miss) != NULL) {
code = CLOSEST_PARENT_MISS;
debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], p->host);
hierarchyNote(&request->hier, code, &psstate->icp, p->host);
peerSelectCallback(psstate, p);
- } else if ((p = psstate->first_parent_miss)) {
+ } else if ((p = psstate->first_parent_miss) != NULL) {
code = FIRST_PARENT_MISS;
debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], p->host);
hierarchyNote(&request->hier, code, &psstate->icp, p->host);
/*
- * $Id: pinger.cc,v 1.29 1998/01/31 05:32:03 wessels Exp $
+ * $Id: pinger.cc,v 1.30 1998/02/03 04:21:19 wessels Exp $
*
* DEBUG: section 42 ICMP Pinger program
* AUTHOR: Duane Wessels
struct icmphdr *icmp = NULL;
icmpEchoData *echo;
int icmp_pktsize = sizeof(struct icmphdr);
- int x;
struct sockaddr_in S;
memset(pkt, '\0', MAX_PKT_SZ);
icmp = (struct icmphdr *) (void *) pkt;
icmp->icmp_code = 0;
icmp->icmp_cksum = 0;
icmp->icmp_id = icmp_ident;
- icmp->icmp_seq = icmp_pkts_sent++;
+ icmp->icmp_seq = (u_short) icmp_pkts_sent++;
echo = (icmpEchoData *) (icmp + 1);
echo->opcode = (unsigned char) opcode;
echo->tv = current_time;
S.sin_family = AF_INET;
S.sin_addr = to;
S.sin_port = 0;
- x = sendto(icmp_sock,
+ sendto(icmp_sock,
pkt,
icmp_pktsize,
0,
extern int create_user(char **);
extern int create_community(char **);
extern void tokenize(char *, char **, int);
+extern int snmpCompare(oid * name1, int len1, oid * name2, int len2);
#endif /* SQUID_SNMP */
extern void AppendUdp(icpUdpData *);
time_t timestamp,
time_t lastref,
time_t lastmod,
- u_num32 refcount,
- u_num32 flags,
+ u_short refcount,
+ u_short flags,
int clean);
extern int storeGetNextFile(int *sfileno, int *size);
extern StoreEntry * storeAddDiskRestore(const cache_key * key,
/*
- * $Id: recv-announce.cc,v 1.16 1998/02/02 21:16:28 wessels Exp $
+ * $Id: recv-announce.cc,v 1.17 1998/02/03 04:21:20 wessels Exp $
*
* DEBUG: section 0 Announcement Server
* AUTHOR: Harvest Derived
dup(1);
- while (1) {
+ for(;;) {
memset(buf, '\0', RECV_BUF_SIZE);
memset(&R, '\0', len = sizeof(R));
void snmp_trap();
int create_identical();
int parse_var_op_list();
-void setVariable();
struct pbuf *definitelyGetBuf();
int get_community();
/* fwd: */
-static int check_auth();
-static int bulk_var_op_list();
-static int goodValue();
+static int check_auth(struct snmp_session *, u_char *, int, u_char *, int, usecEntry **);
+static int bulk_var_op_list(u_char *, int, u_char *, int, int, int, long *);
+static int goodValue(u_char, int, u_char, int);
+static void setVariable(u_char *, u_char, int, u_char *, int);
/* from usec.c: */
extern void increment_stat();
extern void create_report();
extern void md5Digest();
extern int parse_parameters();
-
int
init_agent_auth(void)
{
}
int
-snmp_agent_parse(sn_data, length, out_sn_data, out_length, sourceip, ireqid)
- u_char *sn_data;
- int length;
- u_char *out_sn_data;
- int *out_length;
- u_long sourceip; /* possibly for authentication */
- long *ireqid;
+snmp_agent_parse(u_char *sn_data,
+ int length,
+ u_char *out_sn_data,
+ int *out_length,
+ u_long sourceip, /* possibly for authentication */
+ long *ireqid)
{
u_char msgtype, type;
long zero = 0;
}
if (ret < 0) {
increment_stat(-ret);
- if ((sn_data = asn_parse_header(sn_data, &length, &msgtype))
+ if ((sn_data = asn_parse_header(sn_data, &length, &msgtype)) != NULL
&& asn_parse_int(sn_data, &length, &type, &reqid, sizeof(reqid))) {
if (msgtype == REPORT_MSG)
return 0;
if (errstat == SNMP_ERR_NOSUCHNAME) {
/* see if we have forwarding turned on */
- if (Config.Snmp.localPort > 0) {
+ if (Config.Snmp.localPort != 0) {
*ireqid = reqid;
return 2;
}
* If any error occurs, an error code is returned.
*/
int
-parse_var_op_list(sn_data, length, out_sn_data, out_length, index, msgtype, action)
- u_char *sn_data;
- int length;
- u_char *out_sn_data;
- int out_length;
- long *index;
- int msgtype;
- int action;
+parse_var_op_list(u_char *sn_data,
+ int length,
+ u_char *out_sn_data,
+ int out_length,
+ long *index,
+ int msgtype,
+ int action)
{
u_char type;
oid var_name[MAX_NAME_LEN];
* Returns 1 upon success and 0 upon failure.
*/
int
-create_identical(snmp_in, snmp_out, snmp_length, errstat, errindex)
- u_char *snmp_in;
- u_char *snmp_out;
- int snmp_length;
- long errstat, errindex;
+create_identical(u_char *snmp_in,
+ u_char *snmp_out,
+ int snmp_length,
+ long errstat,
+ long errindex)
{
u_char *sn_data;
u_char type;
}
static int
-check_auth(session, sn_data, length, pp, plen, ueret)
- struct snmp_session *session;
- u_char *sn_data;
- int length;
- u_char *pp;
- int plen;
- usecEntry **ueret;
+check_auth(struct snmp_session *session,
+ u_char *sn_data,
+ int length,
+ u_char *pp,
+ int plen,
+ usecEntry **ueret)
{
usecEntry *ue;
Parameters params;
/* verify that the requested qoS is supported by the userName */
- if ((params.qoS & USEC_QOS_AUTHPRIV) > ue->qoS)
+ if ((u_char) (params.qoS & USEC_QOS_AUTHPRIV) > ue->qoS)
return -USEC_STAT_UNSUPPORTED_QOS;
xmemcpy(session->authKey, ue->authKey, 16);
}
int
-get_community(sessionid)
- u_char *sessionid;
+get_community(char *sessionid)
{
communityEntry *cp;
debug(49, 5) ("get_community: %s\n", sessionid);
for (cp = Config.Snmp.communities; cp; cp = cp->next) {
debug(49, 5) ("get_community: %s\n", cp->name);
- if (!strcmp(cp->name, (char *) sessionid))
+ if (!strcmp(cp->name, sessionid))
break;
}
}
static int
-goodValue(inType, inLen, actualType, actualLen)
- u_char inType, actualType;
- int inLen, actualLen;
+goodValue(u_char inType, int inLen, u_char actualType, int actualLen)
{
if (inLen > actualLen)
return FALSE;
}
-void
-setVariable(var_val, var_val_type, var_val_len, statP, statLen)
- u_char *var_val;
- u_char var_val_type;
- int var_val_len;
- u_char *statP;
- int statLen;
+static void
+setVariable(u_char *var_val,
+ u_char var_val_type,
+ int var_val_len,
+ u_char *statP,
+ int statLen)
{
int buffersize = 1000;
static int
-bulk_var_op_list(sn_data, length, out_sn_data, out_length, non_repeaters, max_repetitions, index)
- u_char *sn_data;
- int length;
- u_char *out_sn_data;
- int out_length;
- int non_repeaters;
- int max_repetitions;
- long *index;
+bulk_var_op_list(u_char *sn_data,
+ int length,
+ u_char *out_sn_data,
+ int out_length,
+ int non_repeaters,
+ int max_repetitions,
+ long *index)
{
u_char type;
oid var_name[MAX_NAME_LEN];
/*
- * $Id: stat.cc,v 1.189 1998/02/03 01:17:07 wessels Exp $
+ * $Id: stat.cc,v 1.190 1998/02/03 04:21:24 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
int i;
struct _store_client *sc;
next = (StoreEntry *) hash_first(store_table);
- while (entry = next) {
+ while ((entry = next) != NULL) {
next = (StoreEntry *) hash_next(store_table);
mem = entry->mem_obj;
if (vm_or_not && mem == NULL)
#define STORE_META_BUFSZ 4096
+struct _rebuild_dir {
+ int dirn;
+ FILE *log;
+ int speed;
+ int clean;
+ struct _rebuild_dir *next;
+};
+
struct storeRebuildState {
- struct _rebuild_dir {
- int dirn;
- FILE *log;
- int speed;
- int clean;
- struct _rebuild_dir *next;
- } *rebuild_dir;
+ struct _rebuild_dir *rebuild_dir;
int objcount; /* # objects successfully reloaded */
int expcount; /* # objects expired */
int linecount; /* # lines parsed from cache logfile */
time_t timestamp,
time_t lastref,
time_t lastmod,
- u_num32 refcount,
- u_num32 flags,
+ u_short refcount,
+ u_short flags,
int clean)
{
int fd_r, fd_w;
debug(20, 3) ("storeGetNextFile: empty dir.\n");
#endif
in_dir = 0;
- if ((curlvl2 = (curlvl2 + 1) % Config.cacheSwap.swapDirs[dirn].l2))
+ if ((curlvl2 = (curlvl2 + 1) % Config.cacheSwap.swapDirs[dirn].l2) != 0)
continue;
- if ((curlvl1 = (curlvl1 + 1) % Config.cacheSwap.swapDirs[dirn].l1))
+ if ((curlvl1 = (curlvl1 + 1) % Config.cacheSwap.swapDirs[dirn].l1) != 0)
continue;
- if ((dirn = (dirn + 1) % Config.cacheSwap.n_configured))
+ if ((dirn = (dirn + 1) % Config.cacheSwap.n_configured) != 0)
continue;
else
done = 1;
timestamp,
lastref,
lastmod,
- (u_num32) scan6, /* refcount */
- (u_num32) scan7, /* flags */
+ (u_short) scan6, /* refcount */
+ (u_short) scan7, /* flags */
d->clean);
#if 0
storeDirSwapLog(e);
storeBuildMetaData(StoreEntry * e, char *swap_buf_c)
{
MemObject *mem;
- int keylength;
int a = STORE_META_TLD_START;
char *meta_buf;
mem = e->mem_obj;
meta_buf = mem->swapout.meta_buf = xmalloc(1024);
/* construct header */
/* add Length(int)-Type(char)-Data encoded info */
- if (squid_key_size < 0)
- keylength = strlen(e->key);
- else
- keylength = squid_key_size;
meta_buf[0] = META_OK;
xmemcpy(&meta_buf[1], &a, sizeof(int));
mem->swapout.meta_len = STORE_META_TLD_START;
- addSwapHdr(STORE_META_KEY, keylength, (void *) e->key,
+ addSwapHdr(STORE_META_KEY, squid_key_size, (void *) e->key,
mem->swapout.meta_buf, &mem->swapout.meta_len);
addSwapHdr(STORE_META_STD, STORE_HDR_METASIZE, (void *) &e->timestamp,
mem->swapout.meta_buf, &mem->swapout.meta_len);
/*
- * $Id: url.cc,v 1.74 1998/01/12 04:30:16 wessels Exp $
+ * $Id: url.cc,v 1.75 1998/02/03 04:21:26 wessels Exp $
*
* DEBUG: section 23 URL Parsing
* AUTHOR: Duane Wessels
if (request->port != urlDefaultPort(request->protocol))
snprintf(portbuf, 32, ":%d", request->port);
loginbuf[0] = '\0';
- if (strlen(request->login) > 0) {
+ if ((int) strlen(request->login) > 0) {
strcpy(loginbuf, request->login);
if ((t = strchr(loginbuf, ':')))
*t = '\0';