]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
8 years ago3.5.17 SQUID_3_5_17
Amos Jeffries [Wed, 20 Apr 2016 12:21:39 +0000 (00:21 +1200)] 
3.5.17

8 years agoBug 4495: Unknown SSL option SSL_OP_NO_TICKET
Amos Jeffries [Wed, 20 Apr 2016 11:56:48 +0000 (23:56 +1200)] 
Bug 4495: Unknown SSL option SSL_OP_NO_TICKET

8 years agonullptr is a C++11 feature
Amos Jeffries [Wed, 20 Apr 2016 10:14:06 +0000 (22:14 +1200)] 
nullptr is a C++11 feature

8 years agoFix several ESI element construction issues
Amos Jeffries [Wed, 20 Apr 2016 06:36:04 +0000 (18:36 +1200)] 
Fix several ESI element construction issues

* Do not wrap active logic in assert().

* Fix localbuf array bounds checking.

* Add Must() conditions to verify array writes will succeed

8 years agoSourceFormat Enforcement
Source Maintenance [Wed, 20 Apr 2016 06:14:12 +0000 (06:14 +0000)] 
SourceFormat Enforcement

8 years agocachemgr.cgi: use dynamic MemBuf for internal content generation
Amos Jeffries [Wed, 20 Apr 2016 03:54:04 +0000 (15:54 +1200)] 
cachemgr.cgi: use dynamic MemBuf for internal content generation

Using a fixed size buffer limits how big content lines can be. Modern
HTTP is fast reaching the point where such limits are problematic.
Also fixes incorrect uses of snprintf() by removing them.

8 years agoAdd chained certificates and signing certificate to peek-then-bumped connections.
Nathan Hoad [Tue, 19 Apr 2016 15:04:09 +0000 (03:04 +1200)] 
Add chained certificates and signing certificate to peek-then-bumped connections.

The scenario this patch addresses is when Squid is configured with an
intermediate signing CA certificate, and clients have the root CA installed on
their machines. What happens is that the generated certificates come down with
an unknown issuer (the intermediate signing certificate), with no
intermediates, so they are rejected. By adding the configured certificate chain
as old client-first mode did, the intermediate and root certificates come down
as well, resulting in the issuer being identified and the connection being
established "securely".

This work is submitted on behalf of Bloomberg L.P.

8 years agoHandshake Error: ccs received early: fix typo
Christos Tsantilas [Mon, 18 Apr 2016 15:28:15 +0000 (18:28 +0300)] 
Handshake Error: ccs received early: fix typo

8 years agoAvoid startup/shutdown crashes [by avoiding static non-POD globals].
Alex Rousskov [Sun, 17 Apr 2016 11:19:27 +0000 (23:19 +1200)] 
Avoid startup/shutdown crashes [by avoiding static non-POD globals].

Squid crashes on startup when the parent process exit()s after fork()ing
the kid process. Squid may also crash on shutdown after exiting main().

In both cases, the crashes are build- and environment-specific. Many
environments show no problems at all. Even disabling compiler
optimizations may prevent crashes. When crashes do happen, their
symptoms (e.g., backtrace) point to problems during destruction of
global objects, but the details point to innocent objects (e.g., PortCfg
or SSL_CTX).

In some environments, the following malloc error is printed on console
before the crash: "corrupted double-linked list".

This change replaces two StatHist globals used for SBuf statistics
collection with always-available singletons. The replaced globals could
be destructed before the last SBuf object using them, leading to memory
corruption (that would eventually crash Squid).

There are probably more such globals.

8 years agoBug 4493: theObject->sharedMemorySize() == theSegment.size() exception
Alex Rousskov [Sun, 17 Apr 2016 11:02:41 +0000 (23:02 +1200)] 
Bug 4493: theObject->sharedMemorySize() == theSegment.size() exception

We should not expect the exact match because, as discovered during bug
3805 (r13947) fix, shared Segment::size() may exceed the originally
requested RAM amount due to stat() page rounding done by OSes like OS X.

Unfortunately, this rounding weakens the failed consistency check a lot.
TODO: Store the exact requested size and check against that as well.

8 years agoBug 4465: Header forgery detection leads to crash
Alex Rousskov [Sun, 17 Apr 2016 10:54:24 +0000 (22:54 +1200)] 
Bug 4465: Header forgery detection leads to crash

8 years agoHandshake Error: ccs received early
Christos Tsantilas [Sun, 17 Apr 2016 10:43:27 +0000 (22:43 +1200)] 
Handshake Error: ccs received early

Some servers cause an SSL handshake error with peek and splice.
The problem is related to the TLS Session Tickets extension handling. Squid
expects always a TLS Session Tickets extension, included in server hello
message, to assume that the ticket accepted and the session is a resumed
session, which is not always true.

This is a Measurement Factory project

8 years agoBug 4482: Solaris GCC 5.2 warning in src/ip/Intercept.cc
Carsten Grzemba [Tue, 12 Apr 2016 06:52:39 +0000 (18:52 +1200)] 
Bug 4482: Solaris GCC 5.2 warning in src/ip/Intercept.cc

8 years agoBug 4468: NotNode (!acl) naming: Terminate the name before strncat(name).
Alex Rousskov [Tue, 12 Apr 2016 06:04:23 +0000 (18:04 +1200)] 
Bug 4468: NotNode (!acl) naming: Terminate the name before strncat(name).

The fix may reduce or even eliminate garbage in logged ACL names (at
least). The bug was exposed by valgrind's "Conditional jump or move
depends on uninitialised value(s)" error.

8 years agoBug 4483: ./configure garbles -Og option in CFLAGS
Carsten Grzemba [Mon, 11 Apr 2016 13:14:25 +0000 (01:14 +1200)] 
Bug 4483: ./configure garbles -Og option in CFLAGS

8 years agoBug 4481: varyEvaluateMatch: Oops. Not a Vary match on second attempt
Amos Jeffries [Mon, 11 Apr 2016 13:11:30 +0000 (01:11 +1200)] 
Bug 4481: varyEvaluateMatch: Oops. Not a Vary match on second attempt

8 years agoBug 2460 partial: workaround deferred reads on shutdown and restart
Lubos Uhliarik [Mon, 11 Apr 2016 12:41:38 +0000 (00:41 +1200)] 
Bug 2460 partial: workaround deferred reads on shutdown and restart

8 years agoBug 4480: Regression in logformat [.width_max]
Amos Jeffries [Thu, 7 Apr 2016 04:43:45 +0000 (16:43 +1200)] 
Bug 4480: Regression in logformat [.width_max]

8 years ago3.5.16 SQUID_3_5_16
Amos Jeffries [Fri, 1 Apr 2016 21:00:41 +0000 (10:00 +1300)] 
3.5.16

8 years agopinger: drop capabilities on Linux
Yuriy M. Kaminskiy [Fri, 1 Apr 2016 20:38:29 +0000 (09:38 +1300)] 
pinger: drop capabilities on Linux

On linux, it is possible to install pinger helper with only CAP_NET_RAW
raised instead of full setuid-root:

 (setcap cap_net_raw+ep /path/to/pinger && chmod u-s /path/to/pinger) || :

However, pinger only drops setuid/setgid, and won't drop capabilities
after sockets are opened (when it is setuid-root, setuid(getuid()) also
drops capabilities, no code changes necessary; however, if it is only
setcap'ed, setuid() is no-op).

Fix is minimally tested, seems to work fine with both/either `setcap`
and `chmod u+s`; non-linux/non-libcap configurations should not be
affected).

* Also fixes errno debug outputs.

8 years agopinger: Fix select(2) to actually use max_fd
Yuriy M. Kaminskiy [Fri, 1 Apr 2016 06:23:24 +0000 (19:23 +1300)] 
pinger: Fix select(2) to actually use max_fd

8 years agoConvert Vary handling to SBuf
Amos Jeffries [Fri, 1 Apr 2016 06:15:31 +0000 (19:15 +1300)] 
Convert Vary handling to SBuf

8 years agopinger: Fix buffer overflow in Icmp6::Recv
Yuriy M. Kaminskiy [Wed, 30 Mar 2016 13:47:57 +0000 (02:47 +1300)] 
pinger: Fix buffer overflow in Icmp6::Recv

8 years agoCleanup: Automatically remove duplicated #include lines.
Alex Rousskov [Wed, 30 Mar 2016 13:25:34 +0000 (02:25 +1300)] 
Cleanup: Automatically remove duplicated #include lines.

8 years agoBug 4409 pt2: Fix krb5-config Heimdal detection
Amos Jeffries [Wed, 30 Mar 2016 11:38:27 +0000 (00:38 +1300)] 
Bug 4409 pt2: Fix krb5-config Heimdal detection

8 years agoBug 4476: Removed duplicated #include line.
Alex Rousskov [Tue, 29 Mar 2016 16:44:16 +0000 (05:44 +1300)] 
Bug 4476: Removed duplicated #include line.

8 years agoFix build errors from nullptr
Amos Jeffries [Wed, 23 Mar 2016 15:43:55 +0000 (04:43 +1300)] 
Fix build errors from nullptr

8 years agoBug 2831: Cache-control: max-age not sent on TCP_IMS_HIT/304
Dave Dykstra [Wed, 23 Mar 2016 15:36:45 +0000 (04:36 +1300)] 
Bug 2831: Cache-control: max-age not sent on TCP_IMS_HIT/304

8 years agoBug 4452: squid -z segfaults with ufs
Marcos Mello [Wed, 23 Mar 2016 14:48:36 +0000 (03:48 +1300)] 
Bug 4452: squid -z segfaults with ufs

8 years agoBug 4423: adding stdio: prefix to cache_log directive produces FATAL error
Amos Jeffries [Wed, 23 Mar 2016 14:46:37 +0000 (03:46 +1300)] 
Bug 4423: adding stdio: prefix to cache_log directive produces FATAL error

8 years agoFix memory leak of HttpRequest objects
Nathan Hoad [Wed, 23 Mar 2016 14:41:24 +0000 (03:41 +1300)] 
Fix memory leak of HttpRequest objects

8 years agoDetect when a child method declaration hides parent's virtual method.
Alex Rousskov [Wed, 23 Mar 2016 14:37:23 +0000 (03:37 +1300)] 
Detect when a child method declaration hides parent's virtual method.

Adding -Woverloaded-virtual exposed one problem in the existing code.

8 years agoCleanup: improved EUI debugging
Amos Jeffries [Wed, 23 Mar 2016 14:05:31 +0000 (03:05 +1300)] 
Cleanup: improved EUI debugging

8 years agoRFC 7725: Add registry entry for 451 status text
Amos Jeffries [Wed, 23 Mar 2016 14:00:51 +0000 (03:00 +1300)] 
RFC 7725: Add registry entry for 451 status text

While Squid does not generate these messages automatically we still have
to relay the status line text accurately, and admin may want to use it
for deny_info status.

8 years agoFix memory leak when the cache of sslcrtvalidator_program is disabled via ttl=0
William Lima [Wed, 23 Mar 2016 13:17:31 +0000 (02:17 +1300)] 
Fix memory leak when the cache of sslcrtvalidator_program is disabled via ttl=0

8 years agoSourceFormat Enforcement
Source Maintenance [Tue, 15 Mar 2016 18:14:15 +0000 (18:14 +0000)] 
SourceFormat Enforcement

8 years agoassertion failed: Write.cc:41: "!ccb->active()"
Christos Tsantilas [Tue, 15 Mar 2016 17:33:14 +0000 (19:33 +0200)] 
assertion failed: Write.cc:41: "!ccb->active()"

Bug description:
   - The client side and server side are finished
   - On server side the Ftp::Relay::finalizeDataDownload() is called and
     schedules the Ftp::Server::originDataCompletionCheckpoint
   - On client side the "Ftp::Server::userDataCompletionCheckpoint" is
     called. This is schedules a write to control connection and closes
     data connection.
   - The Ftp::Server::originDataCompletionCheckpoint is called which is
     trying to write to control connection and the assertion triggered.

This bug is an corner case, where the client-side  (FTP::Server) should
wait for the server side (Ftp::Client/Ftp::Relay) to finish its job before
respond to the FTP client. In this bug the existing mechanism, designed
to handle such problems, did not worked correctly and resulted to a double
write response to the client.

This patch try to fix the existing mechanism as follows:

- When Ftp::Server receives a "startWaitingForOrigin" callback, postpones
  writting possible responses to the client and keeps waiting for the
  stopWaitingForOrigin callback

- When the Ftp::Server receives a "stopWaitingForOrigin" callback,
  resumes any postponed response.

- When the Ftp::Client starts working on a DATA-related transaction, calls the
  Ftp::Server::startWaitingForOrigin callback

- When the Ftp::Client finishes its job or when its abort abnormaly, checks
  whether it needs to call Ftp::Server::stopWaitingForOrigin callback.

- Also this patch try to fix the status code returned to the FTP client
  taking in account the status code returned by FTP server. The
  "Ftp::Server::stopWaitingForOrigin" is used to pass the returned status code
  to the client side.

This is a Measurement Factory project

8 years agoSquid crashes on shutdown while cleaning up idle ICAP connections.
Christos Tsantilas [Wed, 2 Mar 2016 09:12:10 +0000 (11:12 +0200)] 
Squid crashes on shutdown while cleaning up idle ICAP connections.

The global Adaptation::Icap::TheConfig object is automatically
destroyed when Squid exits. Its destructor destroys Icap::ServiceRep
objects that, in turn, close all open connections in the idle
connections pool. Since this happens after comm_exit has destroyed all
Comm structures associated with those connections, Squid crases.

This is a Measurement Factory project.

8 years agoBug 4447:FwdState.cc:447 "serverConnection() == conn" assertion, part2
Christos Tsantilas [Mon, 29 Feb 2016 20:06:51 +0000 (22:06 +0200)] 
Bug 4447:FwdState.cc:447 "serverConnection() == conn" assertion, part2

Fix to allow make check  work again.

8 years agoBug 4447:FwdState.cc:447 "serverConnection() == conn" assertion
Christos Tsantilas [Mon, 29 Feb 2016 19:20:49 +0000 (21:20 +0200)] 
Bug 4447:FwdState.cc:447 "serverConnection() == conn" assertion

After certain failures, FwdState::retryOrBail() may be called twice,
once from FwdState::unregisterdServerEnd() [called from
HttpStateData::swanSong()] and once from the FwdState's own connection
close handler. This may result in two concurrent connections to the
remote server, followed by an assertion upon a connection closure.

This patch:

 - After HttpStateData failures, instead of closing the squid-to-peer
   connection directly (and, hence, triggering closure handlers), calls
   HttpStateData::closeServer() and mustStop() for a cleaner exit with
   fewer wasteful side effects and better debugging.

 - Creates and remembers a FwdState close handler AsyncCall so that
   comm_remove_close_handler() can cancel an already scheduled callback.
   The conversion to the AsyncCall was necessary because legacy [close
   handler callbacks] cannot be canceled once scheduled.

This is a Measurement Factory project.

8 years agoBug 4409: compile error when two Heimdal libraries are installed
Amos Jeffries [Thu, 25 Feb 2016 19:37:00 +0000 (08:37 +1300)] 
Bug 4409: compile error when two Heimdal libraries are installed

8 years ago3.5.15 SQUID_3_5_15
Amos Jeffries [Tue, 23 Feb 2016 16:24:56 +0000 (05:24 +1300)] 
3.5.15

8 years agoLog noise reduction: No eCAP debugging messages at DBG_IMPORTANT level.
Alex Rousskov [Tue, 23 Feb 2016 15:58:54 +0000 (04:58 +1300)] 
Log noise reduction: No eCAP debugging messages at DBG_IMPORTANT level.

8 years agoMacOS: shorten testRock store path to fit in shm segment filename size limitations;
Francesco Chemolli [Tue, 23 Feb 2016 15:52:04 +0000 (04:52 +1300)] 
MacOS: shorten testRock store path to fit in shm segment filename size limitations;

... also change some tools.cc stubs into nops

8 years agoBug 3870: assertion failed: String.cc: 'len_ + len <65536' in ESI::CustomParser
William Lima [Tue, 23 Feb 2016 15:47:10 +0000 (04:47 +1300)] 
Bug 3870: assertion failed: String.cc: 'len_ + len <65536' in ESI::CustomParser

The custom ESI parser used in absence of libxml2 or libexpat parsers was
restricted to handling 64KB buffers but under some conditions could expand
to over 64KB during the parse process. Hitting this assertion.

TODO: the parser can now be redesigned to make use of Tokenizer and
      CharacterSet parsing tools. But that is left for later work.

8 years agoSourceFormat Enforcement
Source Maintenance [Sat, 20 Feb 2016 00:14:07 +0000 (00:14 +0000)] 
SourceFormat Enforcement

8 years agoThrow instead of asserting on some String overflows.
Alex Rousskov [Fri, 19 Feb 2016 23:15:41 +0000 (16:15 -0700)] 
Throw instead of asserting on some String overflows.

Note that Client-caught exceptions result in HTTP 500 (Internal Server
Error) responses with X-Squid-Error set to "ERR_CANNOT_FORWARD 0".

Also avoid stuck Client jobs on exceptions.

Also unified String size limit checks.

Essentially trunk r14552, which has a detailed commit message.

8 years agoBetter handling of huge response headers. Fewer "BUG 3279" messages.
Alex Rousskov [Thu, 18 Feb 2016 04:15:33 +0000 (21:15 -0700)] 
Better handling of huge response headers. Fewer "BUG 3279" messages.

When we failed to parse a response, do not store the fake half-baked
response (via a replaceHttpReply() call). Doing so leads to misleading
"BUG 3279: HTTP reply without Date" messages (at best).  The fake
response is only meant for continueAfterParsingHeader().

Also removed a misleading XXX that may have caused Bug 4432 in v4.0
(trunk r14548).

8 years agoDocs: fix incorrect ssl_bump example SQUID_3_5_14
Amos Jeffries [Mon, 15 Feb 2016 13:58:48 +0000 (02:58 +1300)] 
Docs: fix incorrect ssl_bump example

8 years agoDocs: Clarify libltdl copyright license
Amos Jeffries [Mon, 15 Feb 2016 13:54:57 +0000 (02:54 +1300)] 
Docs: Clarify libltdl copyright license

8 years ago3.5.14
Amos Jeffries [Mon, 15 Feb 2016 12:42:56 +0000 (01:42 +1300)] 
3.5.14

8 years agoFix %un logging external ACL username
Amos Jeffries [Mon, 15 Feb 2016 12:33:03 +0000 (01:33 +1300)] 
Fix %un logging external ACL username

8 years agoSourceFormat Enforcement
Source Maintenance [Mon, 15 Feb 2016 12:14:22 +0000 (12:14 +0000)] 
SourceFormat Enforcement

8 years agoCert Validation memory leaks
Christos Tsantilas [Mon, 15 Feb 2016 11:29:50 +0000 (00:29 +1300)] 
Cert Validation memory leaks

In the case SSL errors detected by certificate validator helper the objects
stored in Ssl::ServerBump::sslErrors  member and will never released.
This member normally points to an Ssl::CertErrors list attached to the related
SSL object which is responsible to release this list.
When the cert validator detects errors a new errors list created and attached
to the related Ssl::ServerBump::sslErrors member but the SSL objects still
hold the old one. The old list released but not the new one.

This patch also fixes the case the cbdata protected  Ssl::CertErrors list,
still is used through the related Ssl::ServerBump object but it is not valid
any more, because the SSL object which hold it gone.

This patch instead of storing the Ssl::CertErrors list to Ssl::ServerBump
object stores the SSL object and increases its reference to avoid be released

  This is a Measurement Factory project

8 years agoFix compile error in CPU affinity
Amos Jeffries [Mon, 15 Feb 2016 07:14:14 +0000 (20:14 +1300)] 
Fix compile error in CPU affinity

struct cpu_set_t may be defined (eg on Hurd) even if the CPU affinity API
is not fully existing, or a non-working stub.

8 years agoFix mgr:config report 'qos_flows mark' output
Yuriy M. Kaminskiy [Mon, 15 Feb 2016 06:24:05 +0000 (19:24 +1300)] 
Fix mgr:config report 'qos_flows mark' output

8 years agoBug 4437: Fix Segfault on Certain SSL Handshake Errors
Christos Tsantilas [Sat, 13 Feb 2016 06:24:27 +0000 (19:24 +1300)] 
Bug 4437: Fix Segfault on Certain SSL Handshake Errors

Squid after an unsuccesfull try to connect to the remote server may make two
concurrent retries to connect to the remote SSL server, calling twice the
FwdState::retryOrBail() method, which may result to unexpected behaviour.

Prevent this by just closing the connection to the remote SSL server inside
FwdState::connectedToPeer method on error and instead of calling the
FwdState::retryOrBail method, just allow comm_close handler to retry the
connection if required.

  This is a Measurement Factory project

8 years agoBug 4431: C code is not compiled with CFLAGS
Marcos Mello [Fri, 12 Feb 2016 04:51:02 +0000 (17:51 +1300)] 
Bug 4431: C code is not compiled with CFLAGS

8 years agoBug 4418: FlexibleArray compile error with GCC 6
Alex Rousskov [Tue, 9 Feb 2016 07:51:58 +0000 (20:51 +1300)] 
Bug 4418: FlexibleArray compile error with GCC 6

8 years agoSourceFormat Enforcement
Source Maintenance [Sun, 31 Jan 2016 06:14:05 +0000 (06:14 +0000)] 
SourceFormat Enforcement

8 years agoFix handling of shared memory left over by Squid crashes or bugs
Markus Mayer [Sun, 31 Jan 2016 05:43:08 +0000 (18:43 +1300)] 
Fix handling of shared memory left over by Squid crashes or bugs

A Squid instance may inherit an old shared memory segment from the
previous instance as the result of either a Squid crash or an at-exit
cleanup bug. This change fixes two problems triggered by old segments:

1. After an earlier OS X fix (bug 3805; trunk r13947), Squid stopped
   initializing previously used shared memory. Uninitialzed memory
   resulted in subtle bugs and crashes.

2. When called for an old Squid shared memory segment, OS X
   ftruncate() fails with EINVAL, preventing Squid from starting when
   the old segment is still around.

   More specifically: Darwin ftruncate() calls pshm_truncate().
   pshm_truncate() checks if the PSHM_ALLOCATED flag is already set on
   the memory region. If the flag is set, the call fails with EINVAL.
   Otherwise, pshm_truncate() sets PSHM_ALLOCATED for the region.
   Since Squid must call ftruncate() to size every new segment, all
   old Squid segments have that flag set, preventing ftruncate() calls
   for old segments in newer Sqid instances from succeeding.

   [1] http://www.opensource.apple.com/source/xnu/xnu-3248.20.55/bsd/kern/posix_shm.c

To fix both problems, Squid now uses shm_open(O_EXCL) to detect the
existence of an old segment and remove/recreate it as needed.

8 years agoFix invalid FTP connection handling on blocked content
Christos Tsantilas [Sun, 31 Jan 2016 05:39:09 +0000 (18:39 +1300)] 
Fix invalid FTP connection handling on blocked content

FTP client gets stuck after the following chain of events:
 * Client requests a file that will be blocked by ICAP.
 * Squid starts downloading the file from the FTP server
   and sends "150 Opening..." to the FTP client.
 * Squid aborts the data connection with the FTP server
   as soon as the ICAP service blocks it.
 * Squid sends "451 Forbidden" to the FTP client.
 * The FTP server sends "500 OOPS: setsockopt: linger" to Squid.
 * Squid terminates the control connection to the FTP server.
 * Squid establishes a new control connection to the FTP server
   but does not authenticate itself.
 * Further commands from the FTP client do not work any more.

The above and many similar problems exist because Squid handles
FTP client-to-squid and squid-to-FTP server data connections
independently from each other. In many cases, one connection does
not get notified about the problems with the other connection.

This patch:
  - Add Ftp::MasterState::userDataDone to record received
    the FTP client final response status code to sent (or to be send)
    to the client.
  - The Ftp::MasterState::waitForOriginData flag to hold status of the
    squid-to-server side. If the squid-to-server side is not finishes
    yet this is true.
  - Send a control reply to the FTP client only after the data transfered
    on both server and client sides.
  - Split Client::abortTransaction to Client::abortOnData and to
    Client::abortAll()
  - Implement the Ftp::Relay::abortOnData() and Ftp::Relay::Abort()
    (i.e., StoreEntry abort handler) to avoid closing the control
    connection when the data connection is closed unexpectedly.

This is a Measurement Factory project.

8 years agoBug 4378: assertion failed: DestinationIp.cc:60: 'checklist->conn() && checklist...
Eduard Bagdasaryan [Sun, 31 Jan 2016 05:22:31 +0000 (18:22 +1300)] 
Bug 4378: assertion failed: DestinationIp.cc:60: 'checklist->conn() && checklist->conn()->clientConnection != NULL'

8 years agoSsl::CertValidationHelper::sslSubmit: Assure that the callback->getDialer() SQUID_3_5_13
Christos Tsantilas [Wed, 6 Jan 2016 14:32:07 +0000 (03:32 +1300)] 
Ssl::CertValidationHelper::sslSubmit: Assure that the callback->getDialer()

 ... return non NULL before use the result

Detected by Coverity Scan. Issue 1346998

8 years ago3.5.13
Amos Jeffries [Wed, 6 Jan 2016 14:27:36 +0000 (03:27 +1300)] 
3.5.13

8 years agoFix build error with ICC
Christos Tsantilas [Tue, 5 Jan 2016 15:42:46 +0000 (04:42 +1300)] 
Fix build error with ICC

8 years agoFix GnuTLS detection via pkg-config
Francesco Chemolli [Tue, 5 Jan 2016 05:41:39 +0000 (18:41 +1300)] 
Fix GnuTLS detection via pkg-config

8 years agoReflect the [ugly] reality in external_acl_type cache=n documentation.
Alex Rousskov [Tue, 5 Jan 2016 05:36:22 +0000 (18:36 +1300)] 
Reflect the [ugly] reality in external_acl_type cache=n documentation.

The patch does not change how the cache works, but may help admins
configure the cache correctly if they stumble upon the updated docs.

A typical external ACL cache with the default cache settings consumes
about 70 MB of RAM (more in many cases, e.g., if annotations are used
with external ACLs). Besides memory usage, the default cache is using
only 977 hash buckets for 262144 entries so there may be quite a bit
of linear search going on by default.

8 years agoSourceFormat Enforcement
Source Maintenance [Fri, 1 Jan 2016 06:13:45 +0000 (06:13 +0000)] 
SourceFormat Enforcement

8 years agoSourceFormat Enforcement
Source Maintenance [Fri, 1 Jan 2016 00:14:27 +0000 (00:14 +0000)] 
SourceFormat Enforcement

8 years agoAvoid memory leaks when a certificate validator is used with SslBump
Christos Tsantilas [Tue, 22 Dec 2015 08:11:59 +0000 (21:11 +1300)] 
Avoid memory leaks when a certificate validator is used with SslBump

When a certificate validator was used, sslCrtvdHandleReplyWrapper delivered
validator response directly to the Ssl::PeerConnector job using job's
Ssl::CertValidationHelper::CVHCB callback. If that synchronous call happened
to be the last job call, then Ssl::PeerConnector::done() would become true
for the job, as it should, but nobody would notice that the PeerConnector
job object should be deleted, and the object would leak.

This fix converts CVHCB into an async job call to avoid direct, unprotected
job calls in this context.

This is a Measurement Factory project.

8 years agoSupport Ephemeral Elliptic Curve Diffie-Hellman (EECDH) key exchange
Paulo Matias [Tue, 22 Dec 2015 07:54:23 +0000 (20:54 +1300)] 
Support Ephemeral Elliptic Curve Diffie-Hellman (EECDH) key exchange

Which allows for forward secrecy with better performance than traditional
ephemeral DH.

Also replaces http(s)_port dhparams= option with tls-dh= that takes a
curve name as well as filename for curve parameters.

8 years agoFix clang build error after rev.13961
Amos Jeffries [Tue, 22 Dec 2015 02:59:42 +0000 (15:59 +1300)] 
Fix clang build error after rev.13961

8 years agoBug 4397: DragonFly BSD, POSIX shared memory is implemented as filepath
Stephen Welker [Fri, 18 Dec 2015 12:53:35 +0000 (01:53 +1300)] 
Bug 4397: DragonFly BSD, POSIX shared memory is implemented as filepath

8 years agoFix startup crash with a misconfigured (too-small) shared memory cache
Alex Rousskov [Fri, 18 Dec 2015 12:50:46 +0000 (01:50 +1300)] 
Fix startup crash with a misconfigured (too-small) shared memory cache

Controller condition for allocating MemStore is slightly different from
MemStore condition for allocating MemStore::map, resulting in MemStore
without a map. Until that discrepancy is fixed, be careful when
dereferencing MemStore::map.

8 years agoFix connection retry and fallback after failed server TLS connections
Christos Tsantilas [Fri, 18 Dec 2015 12:44:01 +0000 (01:44 +1300)] 
Fix connection retry and fallback after failed server TLS connections

FwdState should retry connect to the next ip after a Ssl::PeerConnector failure

When the Ssl::PeerConnector fails to establish an SSL connection FwdState does
not retry to connect to the next destination server ip address, but instead
returns an error.

This is a Measurement Factory project

8 years agoComplete certificate chains using external intermediate certificates
Christos Tsantilas [Fri, 18 Dec 2015 11:11:53 +0000 (00:11 +1300)] 
Complete certificate chains using external intermediate certificates

 ... stored in sslproxy_foreign_intermediate_certs PEM file.

Many origin servers do not send complete certificate chains. Many
browsers use certificate extensions in the server certificate to
download the missing intermediate certificates automatically from
the Internet. Squid does not do that (yet?).

This patch adds the sslproxy_foreign_intermediate_certs configuration directive
to allow an admin to supply a file with intermediate certificates that
Squid may use to complete certificate chains. These intermediate
certificates are _not_ treated as trusted root certificates.

This is a Measurement Factory project.

8 years agoBug 4387: Kerberos build errors on Solaris
Amos Jeffries [Fri, 18 Dec 2015 07:23:23 +0000 (20:23 +1300)] 
Bug 4387: Kerberos build errors on Solaris

8 years ago3.5.12 SQUID_3_5_12
Amos Jeffries [Sat, 28 Nov 2015 14:27:51 +0000 (06:27 -0800)] 
3.5.12

8 years agoAdd missing stub definition for CPU_ISSET
Amos Jeffries [Sat, 28 Nov 2015 14:03:20 +0000 (06:03 -0800)] 
Add missing stub definition for CPU_ISSET

8 years agoFix build errors in cpuafinity.cc
Amos Jeffries [Tue, 24 Nov 2015 06:36:50 +0000 (22:36 -0800)] 
Fix build errors in cpuafinity.cc

So OS provide stub sched.h which contain various amounts of the CPU_*
macro gadgets but not working sched_setaffinity / sched_getaffinity.

We need to check for each macro separately and limit the
HAVE_CPU_AFFINITY protection to the syscalls which configure actually
checked for.

8 years agoBug 4228: links with krb5 libs despite --without options
Amos Jeffries [Tue, 24 Nov 2015 06:28:46 +0000 (22:28 -0800)] 
Bug 4228: links with krb5 libs despite --without options

8 years agoFix delay_parameters documentation
Amos Jeffries [Thu, 19 Nov 2015 05:10:00 +0000 (21:10 -0800)] 
Fix delay_parameters documentation

8 years agoStop using dangling pointers for eCAP-set custom HTTP reason phrases.
Alex Rousskov [Thu, 19 Nov 2015 05:08:41 +0000 (21:08 -0800)] 
Stop using dangling pointers for eCAP-set custom HTTP reason phrases.

Squid still does not support [external] custom reason phrases and,
hence, cannot reliably support eCAP API that sets the reason phrase to
the one supplied by the adapter.  This and r14398 changes fix [known]
regression bugs introduced by r12728 ("SourceLayout").

8 years agoFix status code-based HTTP reason phrase for eCAP-generated messages.
Alex Rousskov [Thu, 19 Nov 2015 05:05:49 +0000 (21:05 -0800)] 
Fix status code-based HTTP reason phrase for eCAP-generated messages.

Calling .reason() on a not-yet-set theMessage.sline object resulted in
"Init" status reason phrase for all from-scratch (i.e., not cloned)
eCAP-made HTTP responses. This fix lets Squid compute the reason phrase
based on the status code, just like Squid does for forwarded responses
(IIRC).

8 years agoRevert r13921: Migrate StoreEntry to using MEMPROXY_CLASS
Amos Jeffries [Thu, 19 Nov 2015 05:00:37 +0000 (21:00 -0800)] 
Revert r13921: Migrate StoreEntry to using MEMPROXY_CLASS

This change has been identified as teh trigger for several object caching
errors. The real cause is not yet known, but reverting this optimisation
avoids it, so is being done for stability.

8 years agoFix cache_peer forceddomain= in CONNECT
Aymeric Vincent [Sun, 15 Nov 2015 01:16:18 +0000 (17:16 -0800)] 
Fix cache_peer forceddomain= in CONNECT

8 years agoTLS: Handshake Problem during Renegotiation
Christos Tsantilas [Sun, 15 Nov 2015 01:13:29 +0000 (17:13 -0800)] 
TLS: Handshake Problem during Renegotiation

Here is what happens:

 - Squid receives TLS Hello from the client (TCP connection A).
 - Squid successfully negotiates an TLS connection with the origin server
   (TCP connection B).
 - Squid successfully negotiates an TLS connection with the client
   (TCP connection A).
 - Squid marks connection B as "idle" and waits an HTTP request from
   connection A.
 - The origin server continues talking to Squid (TCP connection B).
   Squid detects a network read on an idle connection and closes TCP
   connection B (and then the associated TCP connection A as well).

This patch:
 - When squid detects a network read on server idle connection do an
   SSL_read to:
    a) see if application data received from server and abort in this case
    b) detect possible TLS error, or TLS shutdown message from server
    c) or ignore if only TLS protocol related packets received.

This is a Measurement Factory project

8 years agoDocs: Updated stale Ssl text to make the comment match the code again.
Alex Rousskov [Sat, 14 Nov 2015 23:42:41 +0000 (15:42 -0800)] 
Docs: Updated stale Ssl text to make the comment match the code again.

8 years agoFix SSL_get_certificate() problem detection
Stuart Henderson [Tue, 10 Nov 2015 09:30:19 +0000 (01:30 -0800)] 
Fix SSL_get_certificate() problem detection

The autoconf check for SQUID_SSLGETCERTIFICATE_BUGGY fails on ssl library
builds which don't include SSLv3; as a result of the autoconf decision
this can end up triggering the assert(0) in Ssl::verifySslCertificate()
in ssl/support.cc (line 1712 in 3.5.11).

8 years agoPolished cache_peer_access and related documentation.
Alex Rousskov [Tue, 10 Nov 2015 09:27:57 +0000 (01:27 -0800)] 
Polished cache_peer_access and related documentation.

Admins complained that it is not clear how cache_peer_access is
evaluated and how it interacts with cache peer selection algorithms.

8 years agoBug 4374: refresh_pattern config parser (%)
Amos Jeffries [Tue, 10 Nov 2015 09:24:03 +0000 (01:24 -0800)] 
Bug 4374: refresh_pattern config parser (%)

8 years agoBug 4373: assertion failed: client_side_request.cc:1709: 'calloutContext->redirect_st...
Amos Jeffries [Tue, 10 Nov 2015 09:10:40 +0000 (01:10 -0800)] 
Bug 4373: assertion failed: client_side_request.cc:1709: 'calloutContext->redirect_state == REDIRECT_NONE'

8 years agoMake FATAL messages have a consistent prefix
Amos Jeffries [Tue, 3 Nov 2015 14:44:38 +0000 (06:44 -0800)] 
Make FATAL messages have a consistent prefix

8 years ago3.5.11 SQUID_3_5_11
Amos Jeffries [Sun, 1 Nov 2015 10:43:51 +0000 (02:43 -0800)] 
3.5.11

8 years agoAdd Locker friend class to SBuf for protection against memory issues
Amos Jeffries [Fri, 30 Oct 2015 18:26:41 +0000 (11:26 -0700)] 
Add Locker friend class to SBuf for protection against memory issues

When appending or otherwise modifying an SBuf based on a SBuf& or char*
the parameter used may be pointing at the MemBlob memory buffer
indirectly without holding a separate ref-count lock to it.

If 'this' SBuf then requires reallocation for any reason the char* or
buffer pointer taken from the SBuf&, which is being manipulated may in
fact be left pointing at invalid memory.

Utilize a private Locker class to create relatively cheap ref-count locks
on the store_ MemBlob when this problem MAY occur. This Locker needs to
be used on all non-const SBuf methods accepting char* or SBuf& argument.

8 years agoConnection stats, including %<lp, missing for persistent connections.
Alex Rousskov [Wed, 28 Oct 2015 03:47:56 +0000 (20:47 -0700)] 
Connection stats, including %<lp, missing for persistent connections.

The code reusing a pconn was missing a hier.note() call, resulting in 0
values logged for %<lp (local port number of the last server or peer
connection) and probably other missing stats.

Also refactored poorly copied statistics collection code to remove
duplication and always update to-server connection stats when the actual
connection becomes available.

Positive side effect: Upon setsockopt(2) failures, the tos and nfmark
fields of a pinned connection were set to the desired (but not actually
applied) values, while persistent connection fields were left intact
(and, hence, stale). Both fields are now reset to zero on failures, for
both types of connections.

8 years agoFix incorrect authentication headers on cache digest requests
Aymeric Vincent [Tue, 27 Oct 2015 22:48:24 +0000 (15:48 -0700)] 
Fix incorrect authentication headers on cache digest requests

  login=NEGOTIATE can have an additional parameter specified,
   like login=NEGOTIATE:xxx

One test added in rev.12714 does not take this case into account and it
will send a garbage "login:password" (== "NEGOTIATE:xxx") to its peer
when requesting a digest.

This is a workaround patch to remove the broken Authentication headers
entirely. Support for Negotiate to the peer on these digest requests is
still needed.

8 years agoBug 4281: copy-paste typos in src/tools.cc
Marcos Mello [Tue, 27 Oct 2015 22:47:21 +0000 (15:47 -0700)] 
Bug 4281: copy-paste typos in src/tools.cc

8 years agoBug 4188: Bumping intercepted SSL connections does not work on Solaris
Alex Rousskov [Tue, 27 Oct 2015 22:45:11 +0000 (15:45 -0700)] 
Bug 4188: Bumping intercepted SSL connections does not work on Solaris