#include "base64.h"
-#ifndef HAVE_SPNEGO
-#include "spnegohelp.h"
-#endif
// AYJ: must match the definition in src/auth/negotiate/auth_negotiate.cc
#define MAX_AUTHTOKEN_LEN 32768
@@ -209,10 +206,6 @@
gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER;
gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER;
const unsigned char *kerberosToken = NULL;
-#ifndef HAVE_SPNEGO
- int rc;
- size_t kerberosTokenLength = 0;
-#endif
const unsigned char *spnegoToken = NULL ;
size_t spnegoTokenLength = 0;
@@ -357,36 +350,6 @@
base64_decode(input_token.value,buf+3,input_token.length);
-#ifndef HAVE_SPNEGO
- if (( rc=parseNegTokenInit (input_token.value,
- input_token.length,
- &kerberosToken,
- &kerberosTokenLength))!=0 ){
- if (debug)
- fprintf(stderr, "%s| %s: parseNegTokenInit failed with rc=%d\n", LogTime(), PROGRAM, rc);
-
- /* if between 100 and 200 it might be a GSSAPI token and not a SPNEGO token */
- if ( rc < 100 || rc > 199 ) {
- if (debug)
- fprintf(stderr, "%s| %s: Invalid GSS-SPNEGO query [%s]\n", LogTime(), PROGRAM, buf);
- fprintf(stdout, "NA Invalid GSS-SPNEGO query\n");
- goto cleanup;
- }
- if ((input_token.length >= sizeof ntlmProtocol + 1) &&
- (!memcmp (input_token.value, ntlmProtocol, sizeof ntlmProtocol))) {
- if (debug)
- fprintf(stderr, "%s| %s: received type %d NTLM token\n", LogTime(), PROGRAM, (int) *((unsigned char *)input_token.value + sizeof ntlmProtocol));
- fprintf(stdout, "NA received type %d NTLM token\n",(int) *((unsigned char *)input_token.value + sizeof ntlmProtocol));
- goto cleanup;
- }
- spnego_flag=0;
- } else {
- gss_release_buffer(&minor_status, &input_token);
- input_token.length=kerberosTokenLength;
- input_token.value=(void *)kerberosToken;
- spnego_flag=1;
- }
-#else
if ((input_token.length >= sizeof ntlmProtocol + 1) &&
(!memcmp (input_token.value, ntlmProtocol, sizeof ntlmProtocol))) {
if (debug)
@@ -394,7 +357,6 @@
fprintf(stdout, "NA received type %d NTLM token\n",(int) *((unsigned char *)input_token.value + sizeof ntlmProtocol));
goto cleanup;
}
-#endif
if ( service_principal ) {
if ( strcasecmp(service_principal,"GSS_C_NO_NAME") ){
@@ -433,25 +395,8 @@
if (output_token.length) {
-#ifndef HAVE_SPNEGO
- if (spnego_flag) {
- if ((rc=makeNegTokenTarg (output_token.value,
- output_token.length,
- &spnegoToken,
- &spnegoTokenLength))!=0 ) {
- if (debug)
- fprintf(stderr, "%s| %s: makeNegTokenTarg failed with rc=%d\n", LogTime(), PROGRAM, rc);
- fprintf(stdout, "NA makeNegTokenTarg failed with rc=%d\n",rc);
- goto cleanup;
- }
- } else {
- spnegoToken = output_token.value;
- spnegoTokenLength = output_token.length;
- }
-#else
spnegoToken = output_token.value;
spnegoTokenLength = output_token.length;
-#endif
token = malloc(base64_encode_len(spnegoTokenLength));
if (token == NULL) {
if (debug)
diff -u -r -N squid-3.0.STABLE21/include/autoconf.h.in squid-3.0.STABLE23/include/autoconf.h.in
--- squid-3.0.STABLE21/include/autoconf.h.in 2009-12-22 19:50:31.000000000 +1300
+++ squid-3.0.STABLE23/include/autoconf.h.in 2010-02-02 22:49:59.000000000 +1300
@@ -562,9 +562,6 @@
/* socklen_t is defined by the system headers */
#undef HAVE_SOCKLEN_T
-/* Define to 1 if you have SPNEGO support */
-#undef HAVE_SPNEGO
-
/* Define to 1 if you have the `srand48' function. */
#undef HAVE_SRAND48
diff -u -r -N squid-3.0.STABLE21/include/version.h squid-3.0.STABLE23/include/version.h
--- squid-3.0.STABLE21/include/version.h 2009-12-22 19:50:35.000000000 +1300
+++ squid-3.0.STABLE23/include/version.h 2010-02-02 22:50:03.000000000 +1300
@@ -9,5 +9,5 @@
*/
#ifndef SQUID_RELEASE_TIME
-#define SQUID_RELEASE_TIME 1261464621
+#define SQUID_RELEASE_TIME 1265104190
#endif
diff -u -r -N squid-3.0.STABLE21/lib/rfc1035.c squid-3.0.STABLE23/lib/rfc1035.c
--- squid-3.0.STABLE21/lib/rfc1035.c 2009-12-22 19:50:31.000000000 +1300
+++ squid-3.0.STABLE23/lib/rfc1035.c 2010-02-02 22:49:59.000000000 +1300
@@ -287,7 +287,10 @@
size_t len;
assert(ns > 0);
do {
- assert((*off) < sz);
+ if ((*off) >= sz) {
+ RFC1035_UNPACK_DEBUG;
+ return 1;
+ }
c = *(buf + (*off));
if (c > 191) {
/* blasted compression */
diff -u -r -N squid-3.0.STABLE21/RELEASENOTES.html squid-3.0.STABLE23/RELEASENOTES.html
--- squid-3.0.STABLE21/RELEASENOTES.html 2009-12-22 19:52:08.000000000 +1300
+++ squid-3.0.STABLE23/RELEASENOTES.html 2010-02-02 22:51:10.000000000 +1300
@@ -2,10 +2,10 @@
- Squid 3.0.STABLE21 release notes
+ Squid 3.0.STABLE23 release notes
-Squid 3.0.STABLE21 release notes
+Squid 3.0.STABLE23 release notes
Squid Developers
@@ -60,7 +60,7 @@
-The Squid Team are pleased to announce the release of Squid-3.0.STABLE21.
+The Squid Team are pleased to announce the release of Squid-3.0.STABLE23.
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.STABLE21/src/cf.data.pre squid-3.0.STABLE23/src/cf.data.pre
--- squid-3.0.STABLE21/src/cf.data.pre 2009-12-22 19:50:33.000000000 +1300
+++ squid-3.0.STABLE23/src/cf.data.pre 2010-02-02 22:50:01.000000000 +1300
@@ -4735,6 +4735,24 @@
accept_filter data
DOC_END
+NAME: client_ip_max_connections
+TYPE: int
+LOC: Config.client_ip_max_connections
+DEFAULT: -1
+DOC_START
+ Set an absolute limit on the number of connections a single
+ client IP can use. Any more than this and Squid will begin to drop
+ new connections from the client until it closes some links.
+
+ Note that this is a global limit. It affects all HTTP, HTCP, Gopher and FTP
+ connections from the client. For finer control use the ACL access controls.
+
+ Requires client_db to be enabled (the default).
+
+ WARNING: This may noticably slow down traffic received via external proxies
+ or NAT devices and cause them to rebound error messages back to their clients.
+DOC_END
+
NAME: tcp_recv_bufsize
COMMENT: (bytes)
TYPE: b_size_t
diff -u -r -N squid-3.0.STABLE21/src/comm.cc squid-3.0.STABLE23/src/comm.cc
--- squid-3.0.STABLE21/src/comm.cc 2009-12-22 19:50:33.000000000 +1300
+++ squid-3.0.STABLE23/src/comm.cc 2010-02-02 22:50:02.000000000 +1300
@@ -45,6 +45,7 @@
#include "MemBuf.h"
#include "pconn.h"
#include "SquidTime.h"
+#include "protos.h"
#if defined(_SQUID_CYGWIN_)
#include
@@ -1355,6 +1356,13 @@
Slen = sizeof(details.me);
memset(&details.me, '\0', Slen);
+ if ( Config.client_ip_max_connections >= 0) {
+ if (clientdbEstablished(details.peer.sin_addr, 0) > Config.client_ip_max_connections) {
+ debugs(50, DBG_IMPORTANT, "WARNING: " << inet_ntoa(details.peer.sin_addr) << " attempting more than " << Config.client_ip_max_connections << " connections.");
+ return COMM_ERROR;
+ }
+ }
+
getsockname(sock, (struct sockaddr *) &details.me, &Slen);
commSetCloseOnExec(sock);
/* fdstat update */
diff -u -r -N squid-3.0.STABLE21/src/external_acl.cc squid-3.0.STABLE23/src/external_acl.cc
--- squid-3.0.STABLE21/src/external_acl.cc 2009-12-22 19:50:33.000000000 +1300
+++ squid-3.0.STABLE23/src/external_acl.cc 2010-02-02 22:50:02.000000000 +1300
@@ -223,6 +223,8 @@
a->ttl = DEFAULT_EXTERNAL_ACL_TTL;
a->negative_ttl = -1;
a->children = DEFAULT_EXTERNAL_ACL_CHILDREN;
+ a->cache_size = 256*1024;
+ a->quote = external_acl::QUOTE_METHOD_URL;
token = strtok(NULL, w_space);
@@ -233,8 +235,6 @@
token = strtok(NULL, w_space);
- a->quote = external_acl::QUOTE_METHOD_URL;
-
/* Parse options */
while (token) {
if (strncmp(token, "ttl=", 4) == 0) {
diff -u -r -N squid-3.0.STABLE21/src/http.cc squid-3.0.STABLE23/src/http.cc
--- squid-3.0.STABLE21/src/http.cc 2009-12-22 19:50:33.000000000 +1300
+++ squid-3.0.STABLE23/src/http.cc 2010-02-02 22:50:02.000000000 +1300
@@ -570,7 +570,7 @@
return 0;
default: /* Unknown status code */
- debugs (11, 0, HERE << "HttpStateData::cacheableReply: unexpected http status code " << rep->sline.status);
+ debugs (11, DBG_IMPORTANT, "WARNING: Unexpected http status code " << rep->sline.status);
return 0;
@@ -799,8 +799,9 @@
if (!vary) {
entry->makePrivate();
+ if (!fwd->reforwardableStatus(rep->sline.status))
+ EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
goto no_cache;
-
}
entry->mem_obj->vary_headers = xstrdup(vary);
diff -u -r -N squid-3.0.STABLE21/src/main.cc squid-3.0.STABLE23/src/main.cc
--- squid-3.0.STABLE21/src/main.cc 2009-12-22 19:50:33.000000000 +1300
+++ squid-3.0.STABLE23/src/main.cc 2010-02-02 22:50:02.000000000 +1300
@@ -632,7 +632,11 @@
refererCloseLog();
errorClean();
enter_suid(); /* root to read config file */
- parseConfigFile(ConfigFile, manager);
+ // parse the config returns a count of errors encountered.
+ if ( parseConfigFile(ConfigFile, manager) != 0) {
+ // for now any errors are a fatal condition...
+ self_destruct();
+ }
setUmask(Config.umask);
Mem::Report();
setEffectiveUser();
@@ -1057,29 +1061,49 @@
configured_once = 1;
}
+// unsafe main routine -- may throw
+int SquidMain(int argc, char **argv);
+/// unsafe main routine wrapper to catch exceptions
+static int SquidMainSafe(int argc, char **argv);
+
#if USE_WIN32_SERVICE
/* When USE_WIN32_SERVICE is defined, the main function is placed in win32.cc */
extern "C" void WINAPI
- SquidWinSvcMain(int argc, char **argv)
+SquidWinSvcMain(int argc, char **argv)
{
- SquidMain(argc, argv);
+ SquidMainSafe(argc, argv);
}
-
-int
-SquidMain(int argc, char **argv)
#else
int
main(int argc, char **argv)
+{
+ return SquidMainSafe(argc, argv);
+}
#endif
+
+static int
+SquidMainSafe(int argc, char **argv)
{
- int oldmask;
-#ifdef _SQUID_WIN32_
+ try {
+ return SquidMain(argc, argv);
+ } catch (const std::exception &e) {
+ std::cerr << "dying from an unhandled exception: " << e.what() << std::endl;
+ throw;
+ } catch (...) {
+ std::cerr << "dying from an unhandled exception." << std::endl;
+ throw;
+ }
+ return -1; // not reached
+}
+int
+SquidMain(int argc, char **argv)
+{
+#ifdef _SQUID_WIN32_
int WIN32_init_err;
#endif
#if HAVE_SBRK
-
sbrk_start = sbrk(0);
#endif
@@ -1125,7 +1149,7 @@
* set. Unfortunately, there is no way to get the current
* umask value without setting it.
*/
- oldmask = umask(S_IRWXO);
+ int oldmask = umask(S_IRWXO);
if (oldmask)
umask(oldmask);
@@ -1210,9 +1234,7 @@
parse_err = parseConfigFile(ConfigFile, manager);
Mem::Report();
-
- if (opt_parse_cfg_only)
-
+ if (opt_parse_cfg_only || parse_err > 0)
return parse_err;
}
setUmask(Config.umask);
diff -u -r -N squid-3.0.STABLE21/src/store.cc squid-3.0.STABLE23/src/store.cc
--- squid-3.0.STABLE21/src/store.cc 2009-12-22 19:50:34.000000000 +1300
+++ squid-3.0.STABLE23/src/store.cc 2010-02-02 22:50:02.000000000 +1300
@@ -1429,7 +1429,7 @@
(float) Config.Swap.highWaterMark) / (float) 100);
store_swap_low = (long) (((float) Store::Root().maxSize() *
(float) Config.Swap.lowWaterMark) / (float) 100);
- store_pages_max = Config.memMaxSize / SM_PAGE_SIZE;
+ store_pages_max = Config.memMaxSize / sizeof(mem_node);
}
int
diff -u -r -N squid-3.0.STABLE21/src/structs.h squid-3.0.STABLE23/src/structs.h
--- squid-3.0.STABLE21/src/structs.h 2009-12-22 19:50:34.000000000 +1300
+++ squid-3.0.STABLE23/src/structs.h 2010-02-02 22:50:02.000000000 +1300
@@ -743,6 +743,7 @@
char *accept_filter;
int umask;
+ int client_ip_max_connections;
};
struct _SquidConfig2