--------------------- PatchSet 3155 Date: 2001/10/12 23:31:35 Author: hno Branch: hno-emara Tag: (none) Log: indent Members: src/cache_cf.c:1.33.4.5->1.33.4.6 src/client_side.c:1.34.4.6->1.34.4.7 src/dns_internal.c:1.11.4.1->1.11.4.2 src/errormap.c:1.1.18.1->1.1.18.2 src/errorpage.c:1.13.14.2->1.13.14.3 src/external_acl.c:1.1.12.2->1.1.12.3 src/http.c:1.14.12.3->1.14.12.4 src/icmp.c:1.4.58.1->1.4.58.2 src/ipc.c:1.4.58.3->1.4.58.4 src/neighbors.c:1.12.12.3->1.12.12.4 src/protos.h:1.32.4.5->1.32.4.6 src/snmp_agent.c:1.6.56.2->1.6.56.3 src/snmp_core.c:1.7.12.2->1.7.12.3 src/ssl_support.c:1.3.16.4->1.3.16.5 src/store.c:1.13.12.2->1.13.12.3 src/structs.h:1.38.6.8->1.38.6.9 src/typedefs.h:1.23.6.3->1.23.6.4 Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.33.4.5 retrieving revision 1.33.4.6 diff -u -r1.33.4.5 -r1.33.4.6 --- squid/src/cache_cf.c 11 Oct 2001 13:41:18 -0000 1.33.4.5 +++ squid/src/cache_cf.c 12 Oct 2001 23:31:35 -0000 1.33.4.6 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.33.4.5 2001/10/11 13:41:18 hno Exp $ + * $Id: cache_cf.c,v 1.33.4.6 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -2221,7 +2221,7 @@ } static void -parse_errormap(errormap **head) +parse_errormap(errormap ** head) { errormap *m = xcalloc(1, sizeof(*m)); char *url = strtok(NULL, w_space); @@ -2231,7 +2231,7 @@ self_destruct(); m->url = xstrdup(url); while ((token = strtok(NULL, w_space))) { - struct error_map_entry *e = xcalloc(1, sizeof (*e)); + struct error_map_entry *e = xcalloc(1, sizeof(*e)); e->value = xstrdup(token); e->status = atoi(token); if (!e->status) @@ -2249,7 +2249,7 @@ static void dump_errormap(StoreEntry * entry, const char *name, errormap * map) { - while(map) { + while (map) { struct error_map_entry *me; storeAppendPrintf(entry, "%s %s", name, map->url); @@ -2261,12 +2261,12 @@ } static void -free_errormap(errormap **head) +free_errormap(errormap ** head) { while (*head) { errormap *map = *head; *head = map->next; - while(map->map) { + while (map->map) { struct error_map_entry *me = map->map; map->map = me->next; safe_free(me->value); @@ -2537,7 +2537,7 @@ safe_free(s->key); s->key = xstrdup(token + 4); } else if (strncmp(token, "version=", 8) == 0) { - s->version = atoi(token+8); + s->version = atoi(token + 8); } else if (strncmp(token, "options=", 8) == 0) { safe_free(s->options); s->options = xstrdup(token + 8); @@ -2607,4 +2607,3 @@ if (stat(path, &sb) < 0) fatalf("%s: %s", path, xstrerror()); } - Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.34.4.6 retrieving revision 1.34.4.7 diff -u -r1.34.4.6 -r1.34.4.7 --- squid/src/client_side.c 11 Oct 2001 13:41:18 -0000 1.34.4.6 +++ squid/src/client_side.c 12 Oct 2001 23:31:35 -0000 1.34.4.7 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.34.4.6 2001/10/11 13:41:18 hno Exp $ + * $Id: client_side.c,v 1.34.4.7 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -427,7 +427,7 @@ } static void -clientHandleETagMiss(clientHttpRequest *http) +clientHandleETagMiss(clientHttpRequest * http) { StoreEntry *entry = http->entry; MemObject *mem = entry->mem_obj; @@ -458,7 +458,7 @@ if (request->vary) { storeLocateVaryDone(request->vary); request->vary = NULL; - request->etags = NULL; /* pointed into request->vary */ + request->etags = NULL; /* pointed into request->vary */ } safe_free(request->etag); safe_free(request->vary_headers); @@ -521,7 +521,7 @@ } static void -clientProcessETag(clientHttpRequest *http) +clientProcessETag(clientHttpRequest * http) { char *url = http->uri; StoreEntry *entry = NULL; @@ -631,7 +631,7 @@ * the servers 304 reply */ if (httpHeaderHas(&new_entry->mem_obj->reply->header, HDR_ETAG) && - httpHeaderHas(&request->header, HDR_IF_NONE_MATCH)) { + httpHeaderHas(&request->header, HDR_IF_NONE_MATCH)) { const char *etag = httpHeaderGetStr(&new_entry->mem_obj->reply->header, HDR_ETAG); String etags = httpHeaderGetList(&request->header, HDR_IF_NONE_MATCH); int etag_match = strListIsMember(&etags, etag, ','); @@ -1575,11 +1575,11 @@ } /* Append Via */ { - LOCAL_ARRAY(char, bbuf, MAX_URL+32); + LOCAL_ARRAY(char, bbuf, MAX_URL + 32); String strVia = httpHeaderGetList(hdr, HDR_VIA); snprintf(bbuf, sizeof(bbuf), "%d.%d %s", - rep->sline.version.major, - rep->sline.version.minor, ThisCache); + rep->sline.version.major, + rep->sline.version.minor, ThisCache); strListAdd(&strVia, bbuf, ','); httpHeaderDelById(hdr, HDR_VIA); httpHeaderPutStr(hdr, HDR_VIA, strBuf(strVia)); @@ -1634,7 +1634,7 @@ * varies and we need to get the correct variant */ static void -clientProcessVary(VaryData *vary, void *data) +clientProcessVary(VaryData * vary, void *data) { clientHttpRequest *http = data; if (!vary) { @@ -1646,7 +1646,7 @@ } else { int i; debug(33, 2) ("clientProcessVary MISS\n"); - for (i=0; ietags.count; i++) { + for (i = 0; i < vary->etags.count; i++) { debug(33, 3) ("ETag: %s\n", vary->etags.items[i]); } } @@ -1732,7 +1732,7 @@ * to requery the cache. */ store_client *sc = http->sc; - http->entry = NULL; /* saved in e */ + http->entry = NULL; /* saved in e */ memFree(buf, MEM_CLIENT_SOCK_BUF); /* Warning: storeUnregister may abort the object so we must * call storeLocateVary before unregistering, and @@ -2210,15 +2210,15 @@ return; } assert(http->out.offset == 0); - if (Config.onoff.log_mime_hdrs) { - size_t k; - if ((k = headersEnd(buf, size))) { - safe_free(http->al.headers.reply); - http->al.headers.reply = xcalloc(k + 1, 1); - xstrncpy(http->al.headers.reply, buf, k); - } + if (Config.onoff.log_mime_hdrs) { + size_t k; + if ((k = headersEnd(buf, size))) { + safe_free(http->al.headers.reply); + http->al.headers.reply = xcalloc(k + 1, 1); + xstrncpy(http->al.headers.reply, buf, k); } - rep = clientBuildReply(http, buf, size); + } + rep = clientBuildReply(http, buf, size); if (!rep) { if (size < CLIENT_SOCK_SZ && entry->store_status == STORE_PENDING) { /* wait for more to arrive */ @@ -2238,25 +2238,25 @@ return; } } - httpReplyBodyBuildSize(http->request, rep, &Config.ReplyBodySize); - if (clientReplyBodyTooLarge(rep, rep->content_length)) { - ErrorState *err = errorCon(ERR_TOO_BIG, HTTP_FORBIDDEN); - err->request = requestLink(http->request); - storeUnregister(http->sc, http->entry, http); - http->sc = NULL; - storeUnlockObject(http->entry); - http->entry = clientCreateStoreEntry(http, http->request->method, - null_request_flags); - errorAppendEntry(http->entry, err); - httpReplyDestroy(rep); - return; - } - body_size = size - rep->hdr_sz; - body_buf = buf + rep->hdr_sz; + httpReplyBodyBuildSize(http->request, rep, &Config.ReplyBodySize); + if (clientReplyBodyTooLarge(rep, rep->content_length)) { + ErrorState *err = errorCon(ERR_TOO_BIG, HTTP_FORBIDDEN); + err->request = requestLink(http->request); + storeUnregister(http->sc, http->entry, http); + http->sc = NULL; + storeUnlockObject(http->entry); + http->entry = clientCreateStoreEntry(http, http->request->method, + null_request_flags); + errorAppendEntry(http->entry, err); + httpReplyDestroy(rep); + return; + } + body_size = size - rep->hdr_sz; + body_buf = buf + rep->hdr_sz; assert(body_size >= 0); - http->range_iter.prefix_size = rep->hdr_sz; + http->range_iter.prefix_size = rep->hdr_sz; debug(33, 3) ("clientSendMoreHeaderData: Appending %d bytes after %d bytes of headers\n", - body_size, rep->hdr_sz); + body_size, rep->hdr_sz); CBDATA_INIT_TYPE(clientCheckHeaderStateData); state = cbdataAlloc(clientCheckHeaderStateData); state->http = http; @@ -2399,39 +2399,39 @@ clientCheckHeaderDone(state); return; } - debug(33, 2) ("The reply for %s %s is %s, because it matched '%s'\n", - RequestMethodStr[http->request->method], http->uri, + debug(33, 2) ("The reply for %s %s is %s, because it matched '%s'\n", + RequestMethodStr[http->request->method], http->uri, answer ? "ALLOWED" : "DENIED", - AclMatchedName ? AclMatchedName : "NO ACL's"); + AclMatchedName ? AclMatchedName : "NO ACL's"); if (answer != ACCESS_ALLOWED && rep->sline.status != HTTP_FORBIDDEN - && !clientAlwaysAllowResponse(rep->sline.status)) { - /* the if above is slightly broken, but there is no way - * to tell if this is a squid generated error page, or one from - * upstream at this point. */ - ErrorState *err; - err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN); - err->request = requestLink(http->request); - storeUnregister(http->sc, http->entry, http); - http->sc = NULL; - storeUnlockObject(http->entry); - http->entry = clientCreateStoreEntry(http, http->request->method, - null_request_flags); - errorAppendEntry(http->entry, err); - httpReplyDestroy(rep); - return; - } + && !clientAlwaysAllowResponse(rep->sline.status)) { + /* the if above is slightly broken, but there is no way + * to tell if this is a squid generated error page, or one from + * upstream at this point. */ + ErrorState *err; + err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN); + err->request = requestLink(http->request); + storeUnregister(http->sc, http->entry, http); + http->sc = NULL; + storeUnlockObject(http->entry); + http->entry = clientCreateStoreEntry(http, http->request->method, + null_request_flags); + errorAppendEntry(http->entry, err); + httpReplyDestroy(rep); + return; + } clientCheckErrorMap(state); } static void -clientCheckErrorMapDone(StoreEntry *e, int body_offset, ssize_t content_length, void *data) +clientCheckErrorMapDone(StoreEntry * e, int body_offset, ssize_t content_length, void *data) { - clientCheckHeaderStateData * state = data; + clientCheckHeaderStateData *state = data; if (!cbdataValid(state->http)) { /* oops.. */ clientCheckHeaderDone(state); - return; - } + return; + } if (e) { clientHttpRequest *http = state->http; /* Get rid of the old request entry */ @@ -2485,8 +2485,8 @@ cbdataFree(state); if (!cbdataValid(http)) goto aborted; - /* reset range iterator */ - http->range_iter.pos = HttpHdrRangeInitPos; + /* reset range iterator */ + http->range_iter.pos = HttpHdrRangeInitPos; if (http->request->method == METHOD_HEAD) { /* do not forward body for HEAD replies */ body_size = 0; @@ -2570,18 +2570,18 @@ return; } if (http->request->method == METHOD_HEAD) { - /* - * If we are here, then store_status == STORE_OK and it - * seems we have a HEAD repsponse which is missing the - * empty end-of-headers line (home.mira.net, phttpd/0.99.72 - * does this). Because clientBuildReply() fails we just - * call this reply a body, set the done_copying flag and - * continue... - */ - http->flags.done_copying = 1; - } + /* + * If we are here, then store_status == STORE_OK and it + * seems we have a HEAD repsponse which is missing the + * empty end-of-headers line (home.mira.net, phttpd/0.99.72 + * does this). Because clientBuildReply() fails we just + * call this reply a body, set the done_copying flag and + * continue... + */ + http->flags.done_copying = 1; + } /* init mb; put status line and headers if any */ - memBufDefInit(&mb); + memBufDefInit(&mb); if (http->request->range) { /* Only GET requests should have ranges */ assert(http->request->method == METHOD_GET); @@ -3166,11 +3166,11 @@ if (*url == '/') { int vhost = conn->port->vhost || conn->port->transparent; int vport = conn->port->vport || conn->port->transparent; - if (internalCheck(url)) { - /* prepend our name & port */ - http->uri = xstrdup(internalLocalUri(NULL, url)); - http->flags.internal = 1; - http->flags.accel = 1; + if (internalCheck(url)) { + /* prepend our name & port */ + http->uri = xstrdup(internalLocalUri(NULL, url)); + http->flags.internal = 1; + http->flags.accel = 1; debug(33, 5) ("INTERNAL REWRITE: '%s'\n", http->uri); } else if (vhost && (t = mime_get_header(req_hdr, "Host"))) { url_sz = strlen(url) + 32 + Config.appendDomainLen + @@ -3265,7 +3265,7 @@ conn->in.buf = xrealloc(conn->in.buf, conn->in.size); /* XXX account conn->in.buf */ debug(33, 2) ("growing request buffer: offset=%ld size=%ld\n", - (long) conn->in.offset, (long) conn->in.size); + (long) conn->in.offset, (long) conn->in.size); len = conn->in.size - conn->in.offset - 1; } statCounter.syscalls.sock.reads++; @@ -4113,6 +4113,7 @@ HttpSockets[NHttpSockets++] = fd; } } + #endif void Index: squid/src/dns_internal.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/dns_internal.c,v retrieving revision 1.11.4.1 retrieving revision 1.11.4.2 diff -u -r1.11.4.1 -r1.11.4.2 --- squid/src/dns_internal.c 11 Oct 2001 13:41:19 -0000 1.11.4.1 +++ squid/src/dns_internal.c 12 Oct 2001 23:31:35 -0000 1.11.4.2 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.c,v 1.11.4.1 2001/10/11 13:41:19 hno Exp $ + * $Id: dns_internal.c,v 1.11.4.2 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -631,7 +631,7 @@ * statement. Doing so messes up the internal _db_level */ port = comm_local_port(DnsSocket); - debug(78, 1) ("DNS Socket created at %s, port %d, FD %d\n", + debug(78, 1) ("DNS Socket created at %s, port %d, FD %d\n", inet_ntoa(addr), port, DnsSocket); } Index: squid/src/errormap.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/errormap.c,v retrieving revision 1.1.18.1 retrieving revision 1.1.18.2 diff -u -r1.1.18.1 -r1.1.18.2 --- squid/src/errormap.c 26 Aug 2001 20:02:41 -0000 1.1.18.1 +++ squid/src/errormap.c 12 Oct 2001 23:31:35 -0000 1.1.18.2 @@ -36,7 +36,7 @@ #include "squid.h" static const char * -getErrorMap(const errormap *map, const http_status status, const char *squid_error, const char *aclname) +getErrorMap(const errormap * map, const http_status status, const char *squid_error, const char *aclname) { while (map) { struct error_map_entry *m; @@ -54,7 +54,8 @@ } -static int client_header_identities[] = { +static int client_header_identities[] = +{ HDR_USER_AGENT, HDR_COOKIE, HDR_X_FORWARDED_FOR, @@ -65,7 +66,8 @@ }; HttpHeaderMask client_headers; -static int server_header_identities[] = { +static int server_header_identities[] = +{ HDR_VIA, HDR_SERVER, HDR_LOCATION, @@ -85,7 +87,7 @@ CBDATA_TYPE(ErrorMapState); static void -errorMapFetchComplete(ErrorMapState *state) +errorMapFetchComplete(ErrorMapState * state) { storeUnregister(state->sc, state->e, state); state->sc = NULL; @@ -100,7 +102,7 @@ } static void -errorMapFetchAbort(ErrorMapState *state) +errorMapFetchAbort(ErrorMapState * state) { if (cbdataValid(state->callback_data)) state->callback(NULL, -1, -1, state->callback_data); @@ -131,7 +133,7 @@ /* Send object to caller (cbdataValid verified above) */ state->callback(state->e, hdr_size, httpHeaderGetInt(&reply->header, HDR_CONTENT_LENGTH), state->callback_data); return errorMapFetchComplete(state); - } + } if (size >= 4096) { /* Not enought space for reply headers */ return errorMapFetchAbort(state); @@ -141,7 +143,7 @@ } int -errorMapStart(const errormap *map, request_t *client_req, HttpReply *reply, const char *aclname, ERRMAPCB *callback, void *callback_data) +errorMapStart(const errormap * map, request_t * client_req, HttpReply * reply, const char *aclname, ERRMAPCB * callback, void *callback_data) { char squid_error[100]; int len = 0; @@ -168,7 +170,7 @@ errorUrl = getErrorMap(map, status, squid_error, aclname); if (!errorUrl) return 0; - req = urlParse(METHOD_GET, (char *)errorUrl); + req = urlParse(METHOD_GET, (char *) errorUrl); if (!req) { debug(0, 0) ("error_map: Invalid error URL '%s'\n", errorUrl); return 0; @@ -193,7 +195,7 @@ if (CBIT_TEST(server_headers, hdr->id)) httpHeaderAddEntry(&req->header, httpHeaderEntryClone(hdr)); } - httpHeaderPutInt(&req->header, HDR_X_ERROR_STATUS, (int)reply->sline.status); + httpHeaderPutInt(&req->header, HDR_X_ERROR_STATUS, (int) reply->sline.status); httpHeaderPutStr(&req->header, HDR_X_REQUEST_URI, urlCanonical(client_req)); state->buf = memAllocate(MEM_4K_BUF); @@ -207,7 +209,6 @@ { CBDATA_INIT_TYPE(ErrorMapState); - httpHeaderCalcMask(&client_headers, client_header_identities, sizeof(client_header_identities) / sizeof (*client_header_identities)); - httpHeaderCalcMask(&server_headers, server_header_identities, sizeof(server_header_identities) / sizeof (*server_header_identities)); + httpHeaderCalcMask(&client_headers, client_header_identities, sizeof(client_header_identities) / sizeof(*client_header_identities)); + httpHeaderCalcMask(&server_headers, server_header_identities, sizeof(server_header_identities) / sizeof(*server_header_identities)); } - Index: squid/src/errorpage.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/errorpage.c,v retrieving revision 1.13.14.2 retrieving revision 1.13.14.3 diff -u -r1.13.14.2 -r1.13.14.3 --- squid/src/errorpage.c 6 Sep 2001 22:11:41 -0000 1.13.14.2 +++ squid/src/errorpage.c 12 Oct 2001 23:31:35 -0000 1.13.14.3 @@ -1,6 +1,6 @@ /* - * $Id: errorpage.c,v 1.13.14.2 2001/09/06 22:11:41 hno Exp $ + * $Id: errorpage.c,v 1.13.14.3 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -233,7 +233,7 @@ if (strcmp(err_type_str[i], name) == 0) return i; for (i = 0; i < ErrorDynamicPages.count; i++) - if (strcmp(((ErrorDynamicPageInfo *)ErrorDynamicPages.items[i])->page_name, name) == 0) + if (strcmp(((ErrorDynamicPageInfo *) ErrorDynamicPages.items[i])->page_name, name) == 0) return i + ERR_MAX; return -1; } Index: squid/src/external_acl.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/external_acl.c,v retrieving revision 1.1.12.2 retrieving revision 1.1.12.3 diff -u -r1.1.12.2 -r1.1.12.3 --- squid/src/external_acl.c 26 Aug 2001 20:28:24 -0000 1.1.12.2 +++ squid/src/external_acl.c 12 Oct 2001 23:31:35 -0000 1.1.12.3 @@ -1,6 +1,6 @@ /* - * $Id: external_acl.c,v 1.1.12.2 2001/08/26 20:28:24 hno Exp $ + * $Id: external_acl.c,v 1.1.12.3 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom @@ -39,8 +39,8 @@ typedef struct _external_acl_data external_acl_data; typedef struct _external_acl_cache_entry external_acl_cache_entry; -static char *makeExternalAclKey(aclCheck_t *ch, external_acl_data *acl_data); -static int external_acl_cache_lookup(external_acl *def, const char *key); +static char *makeExternalAclKey(aclCheck_t * ch, external_acl_data * acl_data); +static int external_acl_cache_lookup(external_acl * def, const char *key); static FREE free_external_acl_hash; /****************************************************************** @@ -70,23 +70,26 @@ external_acl_format *next; char *header; }; + /* FIXME: These are not really cbdata, but it is an easy way * to get them pooled, refcounted, accounted and freed properly... */ CBDATA_TYPE(external_acl); CBDATA_TYPE(external_acl_format); -static void free_external_acl_format(void *data) +static void +free_external_acl_format(void *data) { external_acl_format *p = data; safe_free(p->header); } -static void free_external_acl(void *data) +static void +free_external_acl(void *data) { external_acl *p = data; safe_free(p->name); - while(p->format) { + while (p->format) { external_acl_format *f = p->format; p->format = f->next; cbdataFree(f); @@ -103,7 +106,8 @@ } } -void parse_externalAclHelper(external_acl **list) +void +parse_externalAclHelper(external_acl ** list) { external_acl *a; char *token; @@ -123,7 +127,7 @@ a->name = xstrdup(token); p = &a->format; - while((token = strtok(NULL, w_space)) != NULL) { + while ((token = strtok(NULL, w_space)) != NULL) { external_acl_format *format = cbdataAlloc(external_acl_format); /* stop on forst non-format token found */ @@ -133,24 +137,24 @@ if (strncmp(token, "%{", 2) == 0) { /* header format */ format->type = EXT_ACL_HEADER; - format->header = xstrdup(token+2); + format->header = xstrdup(token + 2); /* and cut away the terminating } */ if (!strlen(format->header)) self_destruct(); - format->header[strlen(format->header)-1] = '\0'; + format->header[strlen(format->header) - 1] = '\0'; } #define PARSE_EXT_ACL_TYPE(a) \ else if (strcmp(token, "%" #a) == 0) { \ format->type = EXT_ACL_##a; \ } PARSE_EXT_ACL_TYPE(LOGIN) - PARSE_EXT_ACL_TYPE(IDENT) - PARSE_EXT_ACL_TYPE(SRC) - PARSE_EXT_ACL_TYPE(DST) - PARSE_EXT_ACL_TYPE(PROTO) - PARSE_EXT_ACL_TYPE(PORT) - PARSE_EXT_ACL_TYPE(METHOD) - else { + PARSE_EXT_ACL_TYPE(IDENT) + PARSE_EXT_ACL_TYPE(SRC) + PARSE_EXT_ACL_TYPE(DST) + PARSE_EXT_ACL_TYPE(PROTO) + PARSE_EXT_ACL_TYPE(PORT) + PARSE_EXT_ACL_TYPE(METHOD) + else { self_destruct(); } *p = format; @@ -159,14 +163,15 @@ if (!token) self_destruct(); wordlistAdd(&a->cmdline, token); - while((token = strtok(NULL, w_space)) != NULL) + while ((token = strtok(NULL, w_space)) != NULL) wordlistAdd(&a->cmdline, token); - while(*list) + while (*list) list = &(*list)->next; *list = a; } -void dump_externalAclHelper(StoreEntry *sentry, char *name, external_acl *list) +void +dump_externalAclHelper(StoreEntry * sentry, char *name, external_acl * list) { time_t ttl = Config.externalAclTTL; int children = Config.externalAclChildren; @@ -176,7 +181,7 @@ for (node = list; node; node = node->next) { if (node->ttl != ttl) { ttl = node->ttl; - storeAppendPrintf(sentry, "external_acl_ttl %d seconds\n", (int)node->ttl); + storeAppendPrintf(sentry, "external_acl_ttl %d seconds\n", (int) node->ttl); } if (node->children != children) { children = node->children; @@ -184,7 +189,7 @@ } storeAppendPrintf(sentry, "%s %s", name, node->name); for (format = node->format; format; format = format->next) { - switch(format->type) { + switch (format->type) { case EXT_ACL_HEADER: storeAppendPrintf(sentry, " %%{%s}", format->header); break; @@ -192,13 +197,13 @@ case EXT_ACL_##a: \ storeAppendPrintf(sentry, " %%%s", #a); \ break - DUMP_EXT_ACL_TYPE(LOGIN); - DUMP_EXT_ACL_TYPE(IDENT); - DUMP_EXT_ACL_TYPE(SRC); - DUMP_EXT_ACL_TYPE(DST); - DUMP_EXT_ACL_TYPE(PROTO); - DUMP_EXT_ACL_TYPE(PORT); - DUMP_EXT_ACL_TYPE(METHOD); + DUMP_EXT_ACL_TYPE(LOGIN); + DUMP_EXT_ACL_TYPE(IDENT); + DUMP_EXT_ACL_TYPE(SRC); + DUMP_EXT_ACL_TYPE(DST); + DUMP_EXT_ACL_TYPE(PROTO); + DUMP_EXT_ACL_TYPE(PORT); + DUMP_EXT_ACL_TYPE(METHOD); } } for (word = node->cmdline; word; word = word->next) @@ -207,9 +212,10 @@ } } -void free_externalAclHelper(external_acl **list) +void +free_externalAclHelper(external_acl ** list) { - while(*list) { + while (*list) { external_acl *node = *list; *list = node->next; node->next = NULL; @@ -217,7 +223,8 @@ } } -static external_acl *find_externalAclHelper(const char *name) +static external_acl * +find_externalAclHelper(const char *name) { external_acl *node; @@ -237,8 +244,10 @@ external_acl *def; wordlist *arguments; }; + CBDATA_TYPE(external_acl_data); -static void free_external_acl_data(void *data) +static void +free_external_acl_data(void *data) { external_acl_data *p = data; wordlistDestroy(&p->arguments); @@ -246,7 +255,8 @@ p->def = NULL; } -void aclParseExternal(void *dataptr) +void +aclParseExternal(void *dataptr) { external_acl_data **datap = dataptr; external_acl_data *data; @@ -268,12 +278,14 @@ *datap = data; } -void aclDestroyExternal(void **dataptr) +void +aclDestroyExternal(void **dataptr) { cbdataFree(*dataptr); } -int aclMatchExternal(void *data, aclCheck_t *ch) +int +aclMatchExternal(void *data, aclCheck_t * ch) { int result; external_acl_data *acl = data; @@ -289,7 +301,8 @@ return result; } -wordlist *aclDumpExternal(void *data) +wordlist * +aclDumpExternal(void *data) { external_acl_data *acl = data; wordlist *result = NULL; @@ -313,11 +326,13 @@ hash_link hash; int result; time_t date; - hash_table *hash_table; /* yuck, but hashFreeItems don't tell us... */ + hash_table *hash_table; /* yuck, but hashFreeItems don't tell us... */ }; + CBDATA_TYPE(external_acl_cache_entry); -static char *makeExternalAclKey(aclCheck_t *ch, external_acl_data *acl_data) +static char * +makeExternalAclKey(aclCheck_t * ch, external_acl_data * acl_data) { static MemBuf mb = MemBufNULL; char buf[256]; @@ -330,7 +345,7 @@ memBufReset(&mb); for (format = acl_data->def->format; format; format = format->next) { const char *str = NULL; - switch(format->type) { + switch (format->type) { case EXT_ACL_LOGIN: str = authenticateUserRequestUsername(request->auth_user_request); /* FIXME: How to request authentication if not done? */ @@ -388,9 +403,10 @@ return NULL; } -static int external_acl_cache_lookup(external_acl * def, const char *key) +static int +external_acl_cache_lookup(external_acl * def, const char *key) { - external_acl_cache_entry * entry = hash_lookup(def->cache, key); + external_acl_cache_entry *entry = hash_lookup(def->cache, key); if (!entry) { debug(82, 2) ("external_acl_cache_lookup: '%s' = unknown\n", key); return -1; @@ -409,20 +425,23 @@ return entry->result; } -static void free_external_acl_cache_entry(void *data) +static void +free_external_acl_cache_entry(void *data) { external_acl_cache_entry *entry = data; safe_free(entry->hash.key); } -static void free_external_acl_hash(void *data) +static void +free_external_acl_hash(void *data) { external_acl_cache_entry *entry = data; hash_remove_link(entry->hash_table, &entry->hash); cbdataFree(data); } -static void external_acl_cache_add(external_acl *def, const char *key, int result) +static void +external_acl_cache_add(external_acl * def, const char *key, int result) { - external_acl_cache_entry * entry = hash_lookup(def->cache, key); + external_acl_cache_entry *entry = hash_lookup(def->cache, key); debug(82, 2) ("external_acl_cache_add: Adding '%s' = %d\n", key, result); if (entry) { debug(82, 3) ("external_acl_cache_add: updating existing entry\n"); @@ -450,8 +469,10 @@ char *key; external_acl *def; }; + CBDATA_TYPE(externalAclState); -static void free_externalAclState(void *data) +static void +free_externalAclState(void *data) { externalAclState *state = data; safe_free(state->key); @@ -459,7 +480,8 @@ cbdataUnlock(state->def); } -static void externalAclHandleReply(void *data, char *reply) +static void +externalAclHandleReply(void *data, char *reply) { externalAclState *state = data; int result = 0; @@ -480,7 +502,8 @@ cbdataFree(state); } -void externalAclLookup(aclCheck_t *ch, void *acl_data, EAH *callback, void *callback_data) +void +externalAclLookup(aclCheck_t * ch, void *acl_data, EAH * callback, void *callback_data) { MemBuf buf; external_acl_data *acl = acl_data; @@ -495,7 +518,7 @@ } if (def->helper->stats.queue_size >= def->helper->n_running) { int result = -1; - external_acl_cache_entry * entry = hash_lookup(def->cache, key); + external_acl_cache_entry *entry = hash_lookup(def->cache, key); debug(82, 1) ("externalAclLookup: '%s' queue overload\n", def->name); if (entry) result = entry->result; @@ -529,14 +552,15 @@ } } -void externalAclInit(void) +void +externalAclInit(void) { static int firstTimeInit = 1; external_acl *p; for (p = Config.externalAclHelperList; p; p = p->next) { if (!p->cache) - p->cache = hash_create((HASHCMP *)strcmp, hashPrime(1024), hash4); + p->cache = hash_create((HASHCMP *) strcmp, hashPrime(1024), hash4); if (!p->helper) p->helper = helperCreate(p->name); p->helper->cmdline = p->cmdline; @@ -552,7 +576,8 @@ CBDATA_INIT_TYPE_FREECB(externalAclState, free_externalAclState); } } -void externalAclShutdown(void) +void +externalAclShutdown(void) { external_acl *p; for (p = Config.externalAclHelperList; p; p = p->next) { @@ -560,4 +585,3 @@ helperShutdown(p->helper); } } - Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.14.12.3 retrieving revision 1.14.12.4 diff -u -r1.14.12.3 -r1.14.12.4 --- squid/src/http.c 11 Oct 2001 13:41:19 -0000 1.14.12.3 +++ squid/src/http.c 12 Oct 2001 23:31:35 -0000 1.14.12.4 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.14.12.3 2001/10/11 13:41:19 hno Exp $ + * $Id: http.c,v 1.14.12.4 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -736,14 +736,13 @@ /* append our IMS header */ if (request->lastmod > -1 && request->method == METHOD_GET) httpHeaderPutTime(hdr_out, HDR_IF_MODIFIED_SINCE, request->lastmod); - if (request->etag) + if (request->etag) httpHeaderPutStr(hdr_out, HDR_IF_NONE_MATCH, request->etag); else if (request->etags) { int i; for (i = 0; i < request->etags->count; i++) httpHeaderPutStr(hdr_out, HDR_IF_NONE_MATCH, request->etags->items[i]); } - /* decide if we want to do Ranges ourselves * (and fetch the whole object now) * We want to handle Ranges ourselves iff @@ -787,11 +786,11 @@ /* Pass on WWW authentication. */ if (!flags.originpeer) { - httpHeaderAddEntry(hdr_out, httpHeaderEntryClone(e)); + httpHeaderAddEntry(hdr_out, httpHeaderEntryClone(e)); } else { /* In accelerators, only forward authentication if enabled * (see also below for proxy->server authentication) - */ + */ if (orig_request->peer_login && (strcmp(orig_request->peer_login, "PASS") == 0 || strcmp(orig_request->peer_login, "PROXYPASS") == 0)) { httpHeaderAddEntry(hdr_out, httpHeaderEntryClone(e)); } @@ -849,14 +848,13 @@ /* append Via */ if (Config.onoff.via) { String strVia = httpHeaderGetList(hdr_in, HDR_VIA); - snprintf(bbuf, BBUF_SZ, "%d.%d %s", - orig_request->http_ver.major, - orig_request->http_ver.minor, ThisCache); - strListAdd(&strVia, bbuf, ','); - httpHeaderPutStr(hdr_out, HDR_VIA, strBuf(strVia)); - stringClean(&strVia); + snprintf(bbuf, BBUF_SZ, "%d.%d %s", + orig_request->http_ver.major, + orig_request->http_ver.minor, ThisCache); + strListAdd(&strVia, bbuf, ','); + httpHeaderPutStr(hdr_out, HDR_VIA, strBuf(strVia)); + stringClean(&strVia); } - /* append X-Forwarded-For */ strFwd = httpHeaderGetList(hdr_in, HDR_X_FORWARDED_FOR); strListAdd(&strFwd, (cfd < 0 ? "unknown" : fd_table[cfd].ipaddr), ','); @@ -868,7 +866,7 @@ if (orig_request->peer_domain) { httpHeaderPutStr(hdr_out, HDR_HOST, orig_request->peer_domain); } else if (orig_request->port == urlDefaultPort(orig_request->protocol)) { - /* use port# only if not default */ + /* use port# only if not default */ httpHeaderPutStr(hdr_out, HDR_HOST, orig_request->host); } else { httpHeaderPutStrf(hdr_out, HDR_HOST, "%s:%d", @@ -1011,7 +1009,7 @@ if (p != NULL) { if (p->options.originserver) httpState->flags.originpeer = 1; - else + else httpState->flags.proxying = 1; } else { httpState->flags.proxying = 0; Index: squid/src/icmp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/icmp.c,v retrieving revision 1.4.58.1 retrieving revision 1.4.58.2 diff -u -r1.4.58.1 -r1.4.58.2 --- squid/src/icmp.c 26 Aug 2001 20:28:24 -0000 1.4.58.1 +++ squid/src/icmp.c 12 Oct 2001 23:31:35 -0000 1.4.58.2 @@ -1,6 +1,6 @@ /* - * $Id: icmp.c,v 1.4.58.1 2001/08/26 20:28:24 hno Exp $ + * $Id: icmp.c,v 1.4.58.2 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels @@ -206,7 +206,7 @@ return; assert(rfd == wfd); icmp_sock = rfd; - fd_note (icmp_sock, "pinger"); + fd_note(icmp_sock, "pinger"); commSetSelect(icmp_sock, COMM_SELECT_READ, icmpRecv, NULL, 0); commSetTimeout(icmp_sock, -1, NULL, NULL); debug(29, 1) ("Pinger socket opened on FD %d\n", icmp_sock); Index: squid/src/ipc.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ipc.c,v retrieving revision 1.4.58.3 retrieving revision 1.4.58.4 diff -u -r1.4.58.3 -r1.4.58.4 --- squid/src/ipc.c 11 Oct 2001 13:41:19 -0000 1.4.58.3 +++ squid/src/ipc.c 12 Oct 2001 23:31:35 -0000 1.4.58.4 @@ -1,6 +1,6 @@ /* - * $Id: ipc.c,v 1.4.58.3 2001/10/11 13:41:19 hno Exp $ + * $Id: ipc.c,v 1.4.58.4 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -131,10 +131,10 @@ debug(50, 0) ("ipcCreate: socketpair: %s\n", xstrerror()); return -1; } - setsockopt(fds[0], SOL_SOCKET, SO_SNDBUF, (void *)&buflen, sizeof(buflen)); - setsockopt(fds[0], SOL_SOCKET, SO_RCVBUF, (void *)&buflen, sizeof(buflen)); - setsockopt(fds[1], SOL_SOCKET, SO_SNDBUF, (void *)&buflen, sizeof(buflen)); - setsockopt(fds[1], SOL_SOCKET, SO_RCVBUF, (void *)&buflen, sizeof(buflen)); + setsockopt(fds[0], SOL_SOCKET, SO_SNDBUF, (void *) &buflen, sizeof(buflen)); + setsockopt(fds[0], SOL_SOCKET, SO_RCVBUF, (void *) &buflen, sizeof(buflen)); + setsockopt(fds[1], SOL_SOCKET, SO_SNDBUF, (void *) &buflen, sizeof(buflen)); + setsockopt(fds[1], SOL_SOCKET, SO_RCVBUF, (void *) &buflen, sizeof(buflen)); fd_open(prfd = pwfd = fds[0], FD_PIPE, "IPC UNIX STREAM Parent"); fd_open(crfd = cwfd = fds[1], FD_PIPE, "IPC UNIX STREAM Parent"); } else if (type == IPC_UNIX_DGRAM) { Index: squid/src/neighbors.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/neighbors.c,v retrieving revision 1.12.12.3 retrieving revision 1.12.12.4 diff -u -r1.12.12.3 -r1.12.12.4 --- squid/src/neighbors.c 11 Oct 2001 13:41:19 -0000 1.12.12.3 +++ squid/src/neighbors.c 12 Oct 2001 23:31:35 -0000 1.12.12.4 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.c,v 1.12.12.3 2001/10/11 13:41:19 hno Exp $ + * $Id: neighbors.c,v 1.12.12.4 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -365,26 +365,25 @@ peer *next; int fd = theInIcpConnection; if (fd >= 0) { - memset(&name, '\0', sizeof(struct sockaddr_in)); - if (getsockname(fd, (struct sockaddr *) &name, &len) < 0) - debug(15, 1) ("getsockname(%d,%p,%p) failed.\n", fd, &name, &len); - for (this = Config.peers; this; this = next) { + memset(&name, '\0', sizeof(struct sockaddr_in)); + if (getsockname(fd, (struct sockaddr *) &name, &len) < 0) + debug(15, 1) ("getsockname(%d,%p,%p) failed.\n", fd, &name, &len); + for (this = Config.peers; this; this = next) { http_port_list *s; - next = this->next; - if (0 != strcmp(this->host, me)) - continue; - for (s = Config.Sockaddr.http; s; s = s->next) { - if (this->http_port != ntohs(s->s.sin_port)) + next = this->next; + if (0 != strcmp(this->host, me)) continue; - debug(15, 1) ("WARNING: Peer looks like this host\n"); - debug(15, 1) (" Ignoring %s %s/%d/%d\n", - neighborTypeStr(this), this->host, this->http_port, - this->icp.port); - neighborRemove(this); + for (s = Config.Sockaddr.http; s; s = s->next) { + if (this->http_port != ntohs(s->s.sin_port)) + continue; + debug(15, 1) ("WARNING: Peer looks like this host\n"); + debug(15, 1) (" Ignoring %s %s/%d/%d\n", + neighborTypeStr(this), this->host, this->http_port, + this->icp.port); + neighborRemove(this); + } } } - } - peerRefreshDNS((void *) 1); if (0 == echo_hdr.opcode) { echo_hdr.opcode = ICP_SECHO; @@ -402,10 +401,10 @@ "Peer Cache Statistics", neighborDumpPeers, 0, 1); if (theInIcpConnection >= 0) { - cachemgrRegister("non_peers", - "List of Unknown sites sending ICP messages", - neighborDumpNonPeers, 0, 1); -} + cachemgrRegister("non_peers", + "List of Unknown sites sending ICP messages", + neighborDumpNonPeers, 0, 1); + } } int @@ -1310,17 +1309,17 @@ storeAppendPrintf(sentry, "AVG RTT : %d msec\n", e->stats.rtt); storeAppendPrintf(sentry, "OPEN CONNS : %d\n", e->stats.conn_open); if (!e->options.no_query) { - storeAppendPrintf(sentry, "LAST QUERY : %8d seconds ago\n", - (int) (squid_curtime - e->stats.last_query)); + storeAppendPrintf(sentry, "LAST QUERY : %8d seconds ago\n", + (int) (squid_curtime - e->stats.last_query)); if (e->stats.last_reply > 0) - storeAppendPrintf(sentry, "LAST REPLY : %8d seconds ago\n", - (int) (squid_curtime - e->stats.last_reply)); + storeAppendPrintf(sentry, "LAST REPLY : %8d seconds ago\n", + (int) (squid_curtime - e->stats.last_reply)); else storeAppendPrintf(sentry, "LAST REPLY : none received\n"); - storeAppendPrintf(sentry, "PINGS SENT : %8d\n", e->stats.pings_sent); - storeAppendPrintf(sentry, "PINGS ACKED: %8d %3d%%\n", - e->stats.pings_acked, - percent(e->stats.pings_acked, e->stats.pings_sent)); + storeAppendPrintf(sentry, "PINGS SENT : %8d\n", e->stats.pings_sent); + storeAppendPrintf(sentry, "PINGS ACKED: %8d %3d%%\n", + e->stats.pings_acked, + percent(e->stats.pings_acked, e->stats.pings_sent)); } storeAppendPrintf(sentry, "FETCHES : %8d %3d%%\n", e->stats.fetches, @@ -1329,27 +1328,27 @@ e->stats.ignored_replies, percent(e->stats.ignored_replies, e->stats.pings_acked)); if (!e->options.no_query) { - storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n"); + storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n"); #if USE_HTCP - if (e->options.htcp) { - storeAppendPrintf(sentry, "\tMisses\t%8d %3d%%\n", - e->htcp.counts[0], - percent(e->htcp.counts[0], e->stats.pings_acked)); - storeAppendPrintf(sentry, "\tHits\t%8d %3d%%\n", - e->htcp.counts[1], - percent(e->htcp.counts[1], e->stats.pings_acked)); - } else { + if (e->options.htcp) { + storeAppendPrintf(sentry, "\tMisses\t%8d %3d%%\n", + e->htcp.counts[0], + percent(e->htcp.counts[0], e->stats.pings_acked)); + storeAppendPrintf(sentry, "\tHits\t%8d %3d%%\n", + e->htcp.counts[1], + percent(e->htcp.counts[1], e->stats.pings_acked)); + } else { #endif - for (op = ICP_INVALID; op < ICP_END; op++) { - if (e->icp.counts[op] == 0) - continue; - storeAppendPrintf(sentry, " %12.12s : %8d %3d%%\n", - icp_opcode_str[op], - e->icp.counts[op], - percent(e->icp.counts[op], e->stats.pings_acked)); - } + for (op = ICP_INVALID; op < ICP_END; op++) { + if (e->icp.counts[op] == 0) + continue; + storeAppendPrintf(sentry, " %12.12s : %8d %3d%%\n", + icp_opcode_str[op], + e->icp.counts[op], + percent(e->icp.counts[op], e->stats.pings_acked)); + } #if USE_HTCP - } + } #endif } if (e->stats.last_connect_failure) { Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.32.4.5 retrieving revision 1.32.4.6 diff -u -r1.32.4.5 -r1.32.4.6 --- squid/src/protos.h 11 Oct 2001 13:41:19 -0000 1.32.4.5 +++ squid/src/protos.h 12 Oct 2001 23:31:35 -0000 1.32.4.6 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.32.4.5 2001/10/11 13:41:19 hno Exp $ + * $Id: protos.h,v 1.32.4.6 2001/10/12 23:31:35 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1329,27 +1329,27 @@ #endif /* Vary support functions */ -void storeLocateVaryDone(VaryData *data); -void storeLocateVary(StoreEntry * e, int offset, const char *vary_data, STLVCB *callback, void *cbdata); -void storeAddVary(const char *url, const char *log_url, const method_t method, const cache_key *key, const char *etag, const char *vary, const char *vary_headers); +void storeLocateVaryDone(VaryData * data); +void storeLocateVary(StoreEntry * e, int offset, const char *vary_data, STLVCB * callback, void *cbdata); +void storeAddVary(const char *url, const char *log_url, const method_t method, const cache_key * key, const char *etag, const char *vary, const char *vary_headers); /* peer_monitor.c */ extern void peerMonitorInit(void); /* errormap.c */ extern void errorMapInit(void); -extern int errorMapStart(const errormap *map, request_t *req, HttpReply *reply, const char *aclname, ERRMAPCB *callback, void *data); +extern int errorMapStart(const errormap * map, request_t * req, HttpReply * reply, const char *aclname, ERRMAPCB * callback, void *data); /* external_acl.c */ extern void parse_externalAclHelper(external_acl **); -extern void dump_externalAclHelper(StoreEntry *sentry, char *name, external_acl *); +extern void dump_externalAclHelper(StoreEntry * sentry, char *name, external_acl *); extern void free_externalAclHelper(external_acl **); extern void aclParseExternal(void *curlist); extern void aclDestroyExternal(void **curlust); -extern int aclMatchExternal(void *dataptr, aclCheck_t *ch); +extern int aclMatchExternal(void *dataptr, aclCheck_t * ch); extern wordlist *aclDumpExternal(void *dataptr); typedef void EAH(int result, void *data); -extern void externalAclLookup(aclCheck_t *ch, void *acl_data, EAH *handler, void *data); +extern void externalAclLookup(aclCheck_t * ch, void *acl_data, EAH * handler, void *data); extern void externalAclInit(void); extern void externalAclShutdown(void); Index: squid/src/snmp_agent.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/snmp_agent.c,v retrieving revision 1.6.56.2 retrieving revision 1.6.56.3 diff -u -r1.6.56.2 -r1.6.56.3 --- squid/src/snmp_agent.c 6 Sep 2001 22:11:41 -0000 1.6.56.2 +++ squid/src/snmp_agent.c 12 Oct 2001 23:31:35 -0000 1.6.56.3 @@ -1,6 +1,6 @@ /* - * $Id: snmp_agent.c,v 1.6.56.2 2001/09/06 22:11:41 hno Exp $ + * $Id: snmp_agent.c,v 1.6.56.3 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 49 SNMP Interface * AUTHOR: Kostas Anagnostakis @@ -154,18 +154,18 @@ *ErrP = SNMP_ERR_NOERROR; switch (Var->name[LEN_SQ_MESH + 1]) { case 1: - laddr = oid2addr(&Var->name[LEN_SQ_MESH + 3]); + laddr = oid2addr(&Var->name[LEN_SQ_MESH + 3]); for (p = Config.peers; p != NULL; p = p->next, cnt++) { index++; - if (p->in_addr.sin_addr.s_addr == laddr->s_addr) - break; + if (p->in_addr.sin_addr.s_addr == laddr->s_addr) + break; } break; case 2: index = Var->name[LEN_SQ_MESH + 3]; loop = 1; p = Config.peers; - while(loop != index && p != NULL) { + while (loop != index && p != NULL) { loop++; p = p->next; } Index: squid/src/snmp_core.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/snmp_core.c,v retrieving revision 1.7.12.2 retrieving revision 1.7.12.3 diff -u -r1.7.12.2 -r1.7.12.3 --- squid/src/snmp_core.c 6 Sep 2001 22:11:41 -0000 1.7.12.2 +++ squid/src/snmp_core.c 12 Oct 2001 23:31:35 -0000 1.7.12.3 @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.c,v 1.7.12.2 2001/09/06 22:11:41 hno Exp $ + * $Id: snmp_core.c,v 1.7.12.3 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -837,7 +837,7 @@ laddr = oid2addr(&name[*len - 4]); host_addr = inet_ntoa(*laddr); last_addr = xstrdup(host_addr); -skip_duplicate: + skip_duplicate: current_addr = inet_ntoa(peerptr->in_addr.sin_addr); while (peerptr && strcmp(last_addr, current_addr) != 0) { peerptr = peerptr->next; @@ -862,18 +862,18 @@ xfree(last_addr); if (peerptr) { - instance = xmalloc(sizeof(name) * (*len)); - xmemcpy(instance, name, (sizeof(name) * *len)); + instance = xmalloc(sizeof(name) * (*len)); + xmemcpy(instance, name, (sizeof(name) * *len)); cp = (u_char *) & (peerptr->in_addr.sin_addr.s_addr); - instance[*len - 4] = *cp++; - instance[*len - 3] = *cp++; - instance[*len - 2] = *cp++; - instance[*len - 1] = *cp++; + instance[*len - 4] = *cp++; + instance[*len - 3] = *cp++; + instance[*len - 2] = *cp++; + instance[*len - 1] = *cp++; } } *Fn = current->parsefunction; - return (instance); - } + return (instance); +} static oid * peer_InstIndex(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn) @@ -887,8 +887,8 @@ xmemcpy(instance, name, (sizeof(name) * *len)); instance[*len] = 1; *len += 1; - } else { - int identifier, loop = 1; /* our index starts at 1 */ + } else { + int identifier, loop = 1; /* our index starts at 1 */ peer *p = Config.peers; identifier = name[*len - 1]; Index: squid/src/ssl_support.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ssl_support.c,v retrieving revision 1.3.16.4 retrieving revision 1.3.16.5 diff -u -r1.3.16.4 -r1.3.16.5 --- squid/src/ssl_support.c 30 Aug 2001 12:03:15 -0000 1.3.16.4 +++ squid/src/ssl_support.c 12 Oct 2001 23:31:35 -0000 1.3.16.5 @@ -87,35 +87,83 @@ } static struct ssl_option { - char *name; - long value; + char *name; + long value; } ssl_options[] = { - {"MICROSOFT_SESS_ID_BUG", SSL_OP_MICROSOFT_SESS_ID_BUG}, - {"NETSCAPE_CHALLENGE_BUG", SSL_OP_NETSCAPE_CHALLENGE_BUG}, - {"NETSCAPE_REUSE_CIPHER_CHANGE_BUG", SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG}, - {"SSLREF2_REUSE_CERT_TYPE_BUG", SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG}, - {"MICROSOFT_BIG_SSLV3_BUFFER", SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER}, - {"MSIE_SSLV2_RSA_PADDING", SSL_OP_MSIE_SSLV2_RSA_PADDING}, - {"SSLEAY_080_CLIENT_DH_BUG", SSL_OP_SSLEAY_080_CLIENT_DH_BUG}, - {"TLS_D5_BUG", SSL_OP_TLS_D5_BUG}, - {"TLS_BLOCK_PADDING_BUG", SSL_OP_TLS_BLOCK_PADDING_BUG}, - {"TLS_ROLLBACK_BUG", SSL_OP_TLS_ROLLBACK_BUG}, - {"SINGLE_DH_USE", SSL_OP_SINGLE_DH_USE}, - {"EPHEMERAL_RSA", SSL_OP_EPHEMERAL_RSA}, - {"PKCS1_CHECK_1", SSL_OP_PKCS1_CHECK_1}, - {"PKCS1_CHECK_2", SSL_OP_PKCS1_CHECK_2}, - {"NETSCAPE_CA_DN_BUG", SSL_OP_NETSCAPE_CA_DN_BUG}, - {"NON_EXPORT_FIRST", SSL_OP_NON_EXPORT_FIRST}, - {"NETSCAPE_DEMO_CIPHER_CHANGE_BUG", SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG}, - {"ALL", SSL_OP_ALL}, - {"NO_SSLv2", SSL_OP_NO_SSLv2}, - {"NO_SSLv3", SSL_OP_NO_SSLv3}, - {"NO_TLSv1", SSL_OP_NO_TLSv1}, - {"", 0}, - {NULL, 0} + + { + "MICROSOFT_SESS_ID_BUG", SSL_OP_MICROSOFT_SESS_ID_BUG + }, + { + "NETSCAPE_CHALLENGE_BUG", SSL_OP_NETSCAPE_CHALLENGE_BUG + }, + { + "NETSCAPE_REUSE_CIPHER_CHANGE_BUG", SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG + }, + { + "SSLREF2_REUSE_CERT_TYPE_BUG", SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG + }, + { + "MICROSOFT_BIG_SSLV3_BUFFER", SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER + }, + { + "MSIE_SSLV2_RSA_PADDING", SSL_OP_MSIE_SSLV2_RSA_PADDING + }, + { + "SSLEAY_080_CLIENT_DH_BUG", SSL_OP_SSLEAY_080_CLIENT_DH_BUG + }, + { + "TLS_D5_BUG", SSL_OP_TLS_D5_BUG + }, + { + "TLS_BLOCK_PADDING_BUG", SSL_OP_TLS_BLOCK_PADDING_BUG + }, + { + "TLS_ROLLBACK_BUG", SSL_OP_TLS_ROLLBACK_BUG + }, + { + "SINGLE_DH_USE", SSL_OP_SINGLE_DH_USE + }, + { + "EPHEMERAL_RSA", SSL_OP_EPHEMERAL_RSA + }, + { + "PKCS1_CHECK_1", SSL_OP_PKCS1_CHECK_1 + }, + { + "PKCS1_CHECK_2", SSL_OP_PKCS1_CHECK_2 + }, + { + "NETSCAPE_CA_DN_BUG", SSL_OP_NETSCAPE_CA_DN_BUG + }, + { + "NON_EXPORT_FIRST", SSL_OP_NON_EXPORT_FIRST + }, + { + "NETSCAPE_DEMO_CIPHER_CHANGE_BUG", SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG + }, + { + "ALL", SSL_OP_ALL + }, + { + "NO_SSLv2", SSL_OP_NO_SSLv2 + }, + { + "NO_SSLv3", SSL_OP_NO_SSLv3 + }, + { + "NO_TLSv1", SSL_OP_NO_TLSv1 + }, + { + "", 0 + }, + { + NULL, 0 + } }; -static long ssl_parse_options(const char *options) +static long +ssl_parse_options(const char *options) { long op = SSL_OP_ALL; char *tmp; @@ -126,23 +174,25 @@ tmp = xstrdup(options); option = strtok(tmp, ":,"); - while(option) { + while (option) { struct ssl_option *opt = NULL, *opttmp; long value = 0; - enum { MODE_ADD, MODE_REMOVE } mode; + enum { + MODE_ADD, MODE_REMOVE + } mode; switch (*option) { case '!': case '-': - mode = MODE_REMOVE; - option++; - break; + mode = MODE_REMOVE; + option++; + break; case '+': - mode = MODE_ADD; - option++; - break; + mode = MODE_ADD; + option++; + break; default: - mode = MODE_ADD; - break; + mode = MODE_ADD; + break; } for (opttmp = ssl_options; opttmp->name; opttmp++) { if (strcmp(opttmp->name, option) == 0) { @@ -154,12 +204,12 @@ value = opt->value; else if (strncmp(option, "0x", 2) == 0) { /* Special case.. hex specification */ - value = strtol(option+2, NULL, 16); + value = strtol(option + 2, NULL, 16); } else { fatalf("Unknown SSL option '%s'", option); - value = 0; /* Keep GCC happy */ + value = 0; /* Keep GCC happy */ } - switch(mode) { + switch (mode) { case MODE_ADD: op |= value; break; @@ -171,7 +221,7 @@ } safe_free(tmp); -no_options: + no_options: return op; } @@ -229,7 +279,6 @@ ERR_error_string(ssl_error, NULL)); } } - debug(81, 1) ("Using certificate in %s\n", certfile); if (!SSL_CTX_use_certificate_file(sslContext, certfile, SSL_FILETYPE_PEM)) { ssl_error = ERR_get_error(); @@ -247,10 +296,9 @@ debug(81, 5) ("Comparing private and public SSL keys.\n"); if (!SSL_CTX_check_private_key(sslContext)) { debug(81, 0) ("SSL private key %s does not match public key %s\n", - keyfile, certfile); + keyfile, certfile); return NULL; } - debug(81, 9) ("Setting RSA key generation callback.\n"); SSL_CTX_set_tmp_rsa_callback(sslContext, ssl_temp_rsa_cb); @@ -294,7 +342,7 @@ if (!fd_table[fd].ssl_shutdown) { fd_table[fd].ssl_shutdown = 1; if (Config.SSL.unclean_shutdown) - SSL_set_shutdown(ssl, SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); + SSL_set_shutdown(ssl, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); else SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN); } Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.13.12.2 retrieving revision 1.13.12.3 diff -u -r1.13.12.2 -r1.13.12.3 --- squid/src/store.c 11 Oct 2001 13:41:19 -0000 1.13.12.2 +++ squid/src/store.c 12 Oct 2001 23:31:35 -0000 1.13.12.3 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.13.12.2 2001/10/11 13:41:19 hno Exp $ + * $Id: store.c,v 1.13.12.3 2001/10/12 23:31:35 hno Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -401,8 +401,10 @@ int ignore:1; } current; } AddVaryState; + CBDATA_TYPE(AddVaryState); -static void free_AddVaryState(void *data) +static void +free_AddVaryState(void *data) { AddVaryState *state = data; debug(11, 2) ("free_AddVaryState: %p\n", data); @@ -434,7 +436,8 @@ } } -static void storeAddVaryFlush(AddVaryState *state) +static void +storeAddVaryFlush(AddVaryState * state) { if (state->current.ignore || state->current.key_used) { /* do nothing */ @@ -506,7 +509,7 @@ safe_free(state->current.key); safe_free(state->current.etag); memset(&state->current, 0, sizeof(state->current)); - state->current.key = xmalloc(l2+1); + state->current.key = xmalloc(l2 + 1); memcpy(state->current.key, p2, l2); state->current.key[l2] = '\0'; if (state->key) { @@ -520,7 +523,7 @@ p2 = p + 6; l2 = e - p2; safe_free(state->current.etag); - state->current.etag = xmalloc(l2+1); + state->current.etag = xmalloc(l2 + 1); memcpy(state->current.etag, p2, l2); state->current.etag[l2] = '\0'; if (state->etag && strcmp(state->current.etag, state->etag) == 0) { @@ -530,8 +533,8 @@ const cache_key *oldkey = storeKeyScan(state->current.key); if (strmatch(p2, state->key, l) != 0) { StoreEntry *old_e = storeGet(oldkey); - if (old_e) - storeRelease(old_e); + if (old_e) + storeRelease(old_e); safe_free(state->current.key); state->current.key = xstrdup(state->key); state->current.this_key = 1; @@ -556,13 +559,13 @@ p = e; if (l == 0) break; - assert(l>0); - assert(p < (buf+size)); + assert(l > 0); + assert(p < (buf + size)); } state->offset += p - buf; debug(11, 3) ("storeReadVary: %p offset=%d seen_offset=%d\n", data, state->offset, state->seen_offset); storeClientCopy(state->sc, state->oe, - state->seen_offset, + state->seen_offset, state->offset, CLIENT_SOCK_SZ, state->buf, @@ -576,7 +579,7 @@ * At leas one of key or etag must be specified, preferably both. */ void -storeAddVary(const char *url, const char *log_url, const method_t method, const cache_key *key, const char *etag, const char *vary, const char *vary_headers) +storeAddVary(const char *url, const char *log_url, const method_t method, const cache_key * key, const char *etag, const char *vary, const char *vary_headers) { AddVaryState *state; http_version_t version; @@ -637,12 +640,13 @@ static MemPool *VaryData_pool = NULL; -void storeLocateVaryDone(VaryData *data) +void +storeLocateVaryDone(VaryData * data) { int i; safe_free(data->key); - data->etag = NULL; /* points to an entry in etags */ - for (i=0 ; i < data->etags.count; i++) { + data->etag = NULL; /* points to an entry in etags */ + for (i = 0; i < data->etags.count; i++) { safe_free(data->etags.items[i]); } arrayClean(&data->etags); @@ -663,16 +667,17 @@ char *etag; } current; } LocateVaryState; + CBDATA_TYPE(LocateVaryState); -static void -storeLocateVaryCallback(LocateVaryState *state) +static void +storeLocateVaryCallback(LocateVaryState * state) { if (cbdataValid(state->callback_data)) { VaryData *data = state->data; if (data->key || data->etags.count) { state->callback(data, state->callback_data); - state->data = NULL; /* now owned by the caller */ + state->data = NULL; /* now owned by the caller */ } else { state->callback(NULL, state->callback_data); } @@ -682,7 +687,7 @@ storeLocateVaryDone(state->data); state->data = NULL; } - state->current.etag = NULL; /* shared by data->entries[x] */ + state->current.etag = NULL; /* shared by data->entries[x] */ safe_free(state->vary_data); safe_free(state->current.key); if (state->sc) { @@ -723,7 +728,7 @@ state->current.etag = NULL; safe_free(state->current.etag); memset(&state->current, 0, sizeof(state->current)); - state->current.key = xmalloc(l2+1); + state->current.key = xmalloc(l2 + 1); memcpy(state->current.key, p2, l2); state->current.key[l2] = '\0'; debug(11, 3) ("storeLocateVaryRead: Key: %s\n", state->current.key); @@ -732,7 +737,7 @@ char *etag; p2 = p + 6; l2 = e - p2; - etag = xmalloc(l2+1); + etag = xmalloc(l2 + 1); memcpy(etag, p2, l2); etag[l2] = '\0'; state->current.etag = etag; @@ -755,8 +760,8 @@ p = e; if (l == 0) break; - assert(l>0); - assert(p < (buf+size)); + assert(l > 0); + assert(p < (buf + size)); } state->offset += p - buf; debug(11, 3) ("storeReadVary: %p offset=%d seen_offset=%d\n", data, state->offset, state->seen_offset); @@ -764,7 +769,7 @@ } void -storeLocateVary(StoreEntry * e, int offset, const char *vary_data, STLVCB *callback, void *cbdata) +storeLocateVary(StoreEntry * e, int offset, const char *vary_data, STLVCB * callback, void *cbdata) { LocateVaryState *state; debug(11, 2) ("storeLocateVary: %s\n", vary_data); Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.38.6.8 retrieving revision 1.38.6.9 diff -u -r1.38.6.8 -r1.38.6.9 --- squid/src/structs.h 11 Oct 2001 13:41:19 -0000 1.38.6.8 +++ squid/src/structs.h 12 Oct 2001 23:31:35 -0000 1.38.6.9 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.38.6.8 2001/10/11 13:41:19 hno Exp $ + * $Id: structs.h,v 1.38.6.9 2001/10/12 23:31:35 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -331,7 +331,7 @@ char *name; /* visible name */ char *defaultsite; /* default web site */ char *urlgroup; /* default urlgroup */ - unsigned int transparent:1; /* transparent proxy */ + unsigned int transparent:1; /* transparent proxy */ unsigned int vhost:1; /* uses host header */ unsigned int vport:1; /* virtual port support */ }; @@ -1328,7 +1328,7 @@ int max_conn; struct { char *url; - ssize_t min,max; + ssize_t min, max; int interval; int timeout; int state; @@ -1625,7 +1625,7 @@ unsigned int hierarchical:1; unsigned int loopdetect:1; unsigned int proxy_keepalive:1; - unsigned int proxying:1; /* this should be killed, also in httpstateflags */ + unsigned int proxying:1; /* this should be killed, also in httpstateflags */ unsigned int refresh:1; unsigned int redirected:1; unsigned int need_validation:1; Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.23.6.3 retrieving revision 1.23.6.4 diff -u -r1.23.6.3 -r1.23.6.4 --- squid/src/typedefs.h 11 Oct 2001 13:41:19 -0000 1.23.6.3 +++ squid/src/typedefs.h 12 Oct 2001 23:31:35 -0000 1.23.6.4 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.23.6.3 2001/10/11 13:41:19 hno Exp $ + * $Id: typedefs.h,v 1.23.6.4 2001/10/12 23:31:35 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -367,6 +367,6 @@ typedef struct _external_acl external_acl; typedef struct _VaryData VaryData; -typedef void STLVCB(VaryData *vary, void *cbdata); +typedef void STLVCB(VaryData * vary, void *cbdata); #endif /* SQUID_TYPEDEFS_H */