The Squid Team are pleased to announce the release of Squid-3.0.STABLE20.
+The Squid Team are pleased to announce the release of Squid-3.0.STABLE21.
This new release is available for download from http://www.squid-cache.org/Versions/v3/3.0/ or the mirrors.
diff -u -r -N squid-3.0.STABLE20/src/ACLTimeData.cc squid-3.0.STABLE21/src/ACLTimeData.cc --- squid-3.0.STABLE20/src/ACLTimeData.cc 2009-10-29 23:05:45.000000000 +1300 +++ squid-3.0.STABLE21/src/ACLTimeData.cc 2009-12-22 19:50:32.000000000 +1300 @@ -127,7 +127,7 @@ ACLTimeData::parse() { ACLTimeData **Tail; - long weekbits = 0; + long parsed_weekbits = 0; for (Tail = &next; *Tail; Tail = &((*Tail)->next)) @@ -146,35 +146,35 @@ switch (*t++) { case 'S': - weekbits |= ACL_SUNDAY; + parsed_weekbits |= ACL_SUNDAY; break; case 'M': - weekbits |= ACL_MONDAY; + parsed_weekbits |= ACL_MONDAY; break; case 'T': - weekbits |= ACL_TUESDAY; + parsed_weekbits |= ACL_TUESDAY; break; case 'W': - weekbits |= ACL_WEDNESDAY; + parsed_weekbits |= ACL_WEDNESDAY; break; case 'H': - weekbits |= ACL_THURSDAY; + parsed_weekbits |= ACL_THURSDAY; break; case 'F': - weekbits |= ACL_FRIDAY; + parsed_weekbits |= ACL_FRIDAY; break; case 'A': - weekbits |= ACL_SATURDAY; + parsed_weekbits |= ACL_SATURDAY; break; case 'D': - weekbits |= ACL_WEEKDAYS; + parsed_weekbits |= ACL_WEEKDAYS; break; case '-': @@ -201,7 +201,7 @@ return; } - if ((weekbits == 0) && (start == 0) && (stop == 0)) + if ((parsed_weekbits == 0) && (start == 0) && (stop == 0)) q = this; else q = new ACLTimeData; @@ -210,9 +210,9 @@ q->stop = h2 * 60 + m2; - q->weekbits = weekbits; + q->weekbits = parsed_weekbits; - weekbits = 0; + parsed_weekbits = 0; if (q->start > q->stop) { debugs(28, 0, "aclParseTimeSpec: Reversed time range"); @@ -234,23 +234,18 @@ } } - if (weekbits) { + if (parsed_weekbits) { - if ((weekbits == 0) && (start == 0) && (stop == 0)) - q = this; - else - q = new ACLTimeData; + q = new ACLTimeData; q->start = 0 * 60 + 0; q->stop = 24 * 60 + 0; - q->weekbits = weekbits; + q->weekbits = parsed_weekbits; - if (q != this) { - *(Tail) = q; - Tail = &q->next; - } + *(Tail) = q; + Tail = &q->next; } } diff -u -r -N squid-3.0.STABLE20/src/asn.cc squid-3.0.STABLE21/src/asn.cc --- squid-3.0.STABLE20/src/asn.cc 2009-10-29 23:05:46.000000000 +1300 +++ squid-3.0.STABLE21/src/asn.cc 2009-12-22 19:50:32.000000000 +1300 @@ -110,9 +110,17 @@ static STCB asHandleReply; -static int destroyRadixNode(struct squid_radix_node *rn, void *w); -static int printRadixNode(struct squid_radix_node *rn, void *sentry); +#if defined(__cplusplus) +extern "C" { +#endif + + static int destroyRadixNode(struct squid_radix_node *rn, void *w); + static int printRadixNode(struct squid_radix_node *rn, void *sentry); + +#if defined(__cplusplus) +} +#endif void asnAclInitialize(ACL * acls); diff -u -r -N squid-3.0.STABLE20/src/cbdata.h squid-3.0.STABLE21/src/cbdata.h --- squid-3.0.STABLE20/src/cbdata.h 2009-10-29 23:05:47.000000000 +1300 +++ squid-3.0.STABLE21/src/cbdata.h 2009-12-22 19:50:33.000000000 +1300 @@ -73,6 +73,7 @@ #define cbdataInternalUnlock(a) cbdataInternalUnlockDbg(a,__FILE__,__LINE__) #define cbdataReferenceValidDone(var, ptr) cbdataInternalReferenceDoneValidDbg((void **)&(var), (ptr), __FILE__,__LINE__) #define CBDATA_CLASS2(type) \ + private: \ static cbdata_type CBDATA_##type; \ public: \ void *operator new(size_t size) { \ @@ -83,8 +84,8 @@ void operator delete (void *address) { \ if (address) cbdataInternalFreeDbg(address,__FILE__,__LINE__); \ } \ - private: #else +#else /* CBDATA_DEBUG */ #define cbdataAlloc(type) ((type *)cbdataInternalAlloc(CBDATA_##type)) #define cbdataFree(var) do {if (var) {cbdataInternalFree(var); var = NULL;}} while(0) #define cbdataReferenceValidDone(var, ptr) cbdataInternalReferenceDoneValid((void **)&(var), (ptr)) diff -u -r -N squid-3.0.STABLE20/src/client_side_reply.cc squid-3.0.STABLE21/src/client_side_reply.cc --- squid-3.0.STABLE20/src/client_side_reply.cc 2009-10-29 23:05:47.000000000 +1300 +++ squid-3.0.STABLE21/src/client_side_reply.cc 2009-12-22 19:50:33.000000000 +1300 @@ -1302,8 +1302,8 @@ hdr->putStr(HDR_VIA, strVia.buf()); } /* Signal keep-alive if needed */ - hdr->putStr(http->flags.accel ? HDR_CONNECTION : HDR_PROXY_CONNECTION, - request->flags.proxy_keepalive ? "keep-alive" : "close"); + hdr->putStr( (http->flags.accel || http->flags.transparent)? HDR_CONNECTION : HDR_PROXY_CONNECTION, + request->flags.proxy_keepalive ? "keep-alive" : "close"); #if ADD_X_REQUEST_URI /* diff -u -r -N squid-3.0.STABLE20/src/dnsserver.cc squid-3.0.STABLE21/src/dnsserver.cc --- squid-3.0.STABLE20/src/dnsserver.cc 2009-10-29 23:05:47.000000000 +1300 +++ squid-3.0.STABLE21/src/dnsserver.cc 2009-12-22 19:50:33.000000000 +1300 @@ -276,11 +276,10 @@ char request[512]; char *t = NULL; int c; -#if HAVE_RES_INIT - int opt_s = 0; -#if HAVE_RES_NSADDR_LIST || HAVE_RES_NS_LIST +#if HAVE_RES_INIT +#if HAVE_RES_NSADDR_LIST || HAVE_RES_NS_LIST extern char *optarg; #endif #endif @@ -288,7 +287,6 @@ safe_inet_addr("255.255.255.255", &no_addr); #if HAVE_RES_INIT - res_init(); #ifdef RES_DEFAULT diff -u -r -N squid-3.0.STABLE20/src/ftp.cc squid-3.0.STABLE21/src/ftp.cc --- squid-3.0.STABLE20/src/ftp.cc 2009-10-29 23:05:47.000000000 +1300 +++ squid-3.0.STABLE21/src/ftp.cc 2009-12-22 19:50:33.000000000 +1300 @@ -3032,10 +3032,11 @@ void FtpStateData::failedErrorMessage(err_type error, int xerrno) { - ErrorState *err; + ErrorState *ftperr; const char *command, *reply; + /* Translate FTP errors into HTTP errors */ - err = NULL; + ftperr = NULL; switch (error) { @@ -3049,12 +3050,12 @@ if (ctrl.replycode > 500) if (password_url) - err = errorCon(ERR_FTP_FORBIDDEN, HTTP_FORBIDDEN, fwd->request); + ftperr = errorCon(ERR_FTP_FORBIDDEN, HTTP_FORBIDDEN, fwd->request); else - err = errorCon(ERR_FTP_FORBIDDEN, HTTP_UNAUTHORIZED, fwd->request); + ftperr = errorCon(ERR_FTP_FORBIDDEN, HTTP_UNAUTHORIZED, fwd->request); else if (ctrl.replycode == 421) - err = errorCon(ERR_FTP_UNAVAILABLE, HTTP_SERVICE_UNAVAILABLE, fwd->request); + ftperr = errorCon(ERR_FTP_UNAVAILABLE, HTTP_SERVICE_UNAVAILABLE, fwd->request); break; @@ -3062,7 +3063,7 @@ case SENT_RETR: if (ctrl.replycode == 550) - err = errorCon(ERR_FTP_NOT_FOUND, HTTP_NOT_FOUND, fwd->request); + ftperr = errorCon(ERR_FTP_NOT_FOUND, HTTP_NOT_FOUND, fwd->request); break; @@ -3073,20 +3074,20 @@ break; case ERR_READ_TIMEOUT: - err = errorCon(error, HTTP_GATEWAY_TIMEOUT, fwd->request); + ftperr = errorCon(error, HTTP_GATEWAY_TIMEOUT, fwd->request); break; default: - err = errorCon(error, HTTP_BAD_GATEWAY, fwd->request); + ftperr = errorCon(error, HTTP_BAD_GATEWAY, fwd->request); break; } - if (err == NULL) - err = errorCon(ERR_FTP_FAILURE, HTTP_BAD_GATEWAY, fwd->request); + if (ftperr == NULL) + ftperr = errorCon(ERR_FTP_FAILURE, HTTP_BAD_GATEWAY, fwd->request); - err->xerrno = xerrno; + ftperr->xerrno = xerrno; - err->ftp.server_msg = ctrl.message; + ftperr->ftp.server_msg = ctrl.message; ctrl.message = NULL; @@ -3104,12 +3105,13 @@ reply = ctrl.last_reply; if (command) - err->ftp.request = xstrdup(command); + ftperr->ftp.request = xstrdup(command); if (reply) - err->ftp.reply = xstrdup(reply); + ftperr->ftp.reply = xstrdup(reply); - fwd->fail(err); + entry->replaceHttpReply( errorBuildReply(ftperr) ); + errorStateFree(ftperr); } static void @@ -3150,7 +3152,8 @@ else err->ftp.reply = xstrdup(""); - errorAppendEntry(ftpState->entry, err); + ftpState->entry->replaceHttpReply( errorBuildReply(err) ); + errorStateFree(err); ftpSendQuit(ftpState); } diff -u -r -N squid-3.0.STABLE20/src/HttpHdrContRange.cc squid-3.0.STABLE21/src/HttpHdrContRange.cc --- squid-3.0.STABLE20/src/HttpHdrContRange.cc 2009-10-29 23:05:45.000000000 +1300 +++ squid-3.0.STABLE21/src/HttpHdrContRange.cc 2009-12-22 19:50:32.000000000 +1300 @@ -84,22 +84,34 @@ if (!httpHeaderParseOffset(field, &spec->offset)) return 0; + /* Additional check for BUG2155 - there MUST BE first-byte-pos and it MUST be positive*/ + if (spec->offset < 0) { + debugs(68, 2, "invalid (no first-byte-pos or it is negative) resp-range-spec near: '" << field << "'"); + return 0; + } + p++; /* do we have last-pos ? */ - if (p - field < flen) { - int64_t last_pos; + if (p - field >= flen) { + debugs(68, 2, "invalid (no last-byte-pos) resp-range-spec near: '" << field << "'"); + return 0; + } + + int64_t last_pos; - if (!httpHeaderParseOffset(p, &last_pos)) - return 0; + if (!httpHeaderParseOffset(p, &last_pos)) + return 0; - spec->length = size_diff(last_pos + 1, spec->offset); - /* Ensure typecast is safe */ - assert (spec->length >= 0); + if (last_pos < spec->offset) { + debugs(68, 2, "invalid (negative last-byte-pos) resp-range-spec near: '" << field << "'"); + return 0; } + spec->length = size_diff(last_pos + 1, spec->offset); + /* we managed to parse, check if the result makes sence */ - if (known_spec(spec->length) && spec->length == 0) { + if (spec->length <= 0) { debugs(68, 2, "invalid range (" << spec->offset << " += " << (long int) spec->length << ") in resp-range-spec near: '" << field << "'"); return 0; @@ -176,6 +188,14 @@ range->elength = range_spec_unknown; else if (!httpHeaderParseOffset(p, &range->elength)) return 0; + else if (range->elength <= 0) { + /* Additional paranoidal check for BUG2155 - entity-length MUST be > 0 */ + debugs(68, 2, "invalid (entity-length is negative) content-range-spec near: '" << str << "'"); + return 0; + } else if (known_spec(range->spec.length) && range->elength < (range->spec.offset + range->spec.length)) { + debugs(68, 2, "invalid (range is outside entity-length) content-range-spec near: '" << str << "'"); + return 0; + } debugs(68, 8, "parsed content-range field: " << (long int) range->spec.offset << "-" << diff -u -r -N squid-3.0.STABLE20/src/HttpHeader.cc squid-3.0.STABLE21/src/HttpHeader.cc --- squid-3.0.STABLE20/src/HttpHeader.cc 2009-10-29 23:05:45.000000000 +1300 +++ squid-3.0.STABLE21/src/HttpHeader.cc 2009-12-22 19:50:32.000000000 +1300 @@ -504,9 +504,10 @@ debugs(55, 7, "parsing hdr: (" << this << ")" << std::endl << getStringPrefix(header_start, header_end)); HttpHeaderStats[owner].parsedCount++; - if (memchr(header_start, '\0', header_end - header_start)) { + char *nulpos; + if ((nulpos = (char*)memchr(header_start, '\0', header_end - header_start))) { debugs(55, 1, "WARNING: HTTP header contains NULL characters {" << - getStringPrefix(header_start, header_end) << "}"); + getStringPrefix(header_start, nulpos) << "}\nNULL\n{" << getStringPrefix(nulpos+1, header_end) << "}"); goto reset; } diff -u -r -N squid-3.0.STABLE20/src/SquidNew.cc squid-3.0.STABLE21/src/SquidNew.cc --- squid-3.0.STABLE20/src/SquidNew.cc 2009-10-29 23:05:46.000000000 +1300 +++ squid-3.0.STABLE21/src/SquidNew.cc 2009-12-22 19:50:32.000000000 +1300 @@ -33,5 +33,28 @@ * */ -#define _SQUID_EXTERNNEW_ +/* #define _SQUID_EXTERNNEW_ */ /* Why? kinkie */ #include "squid.h" + + +#ifdef __SUNPRO_CC + +#include