]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
8 years agoBug 4428: mal-formed Cache-Control:stale-if-error header
Amos Jeffries [Wed, 17 Aug 2016 02:55:01 +0000 (14:55 +1200)] 
Bug 4428: mal-formed Cache-Control:stale-if-error header

9 years agoSquid segfault via Ftp::Client::readControlReply().
Christos Tsantilas [Fri, 5 Aug 2016 14:59:33 +0000 (02:59 +1200)] 
Squid segfault via Ftp::Client::readControlReply().

Ftp::Client::scheduleReadControlReply(), which may called from the
asynchronous start() or readControlReply()/handleControlReply()
handlers, does not check whether the control connection is still usable
before using it.

This is a Measurement Factory project.

9 years agoSourceFormat Enforcement
Source Maintenance [Sat, 23 Jul 2016 12:13:51 +0000 (12:13 +0000)] 
SourceFormat Enforcement

9 years agoBug #4542: authentication credentials IP TTL updated incorrectly
Anonymous [Sat, 23 Jul 2016 07:19:30 +0000 (19:19 +1200)] 
Bug #4542: authentication credentials IP TTL updated incorrectly

9 years agoBug 4534: assertion failure in xcalloc when using many cache_dir
Amos Jeffries [Sat, 23 Jul 2016 07:16:20 +0000 (19:16 +1200)] 
Bug 4534: assertion failure in xcalloc when using many cache_dir

9 years ago3.5.20 SQUID_3_5_20
Amos Jeffries [Fri, 1 Jul 2016 11:36:16 +0000 (23:36 +1200)] 
3.5.20

9 years agoAssertion failed: Write.cc:38: "fd_table[conn->fd].flags.open"
Christos Tsantilas [Thu, 30 Jun 2016 21:09:12 +0000 (09:09 +1200)] 
Assertion failed: Write.cc:38: "fd_table[conn->fd].flags.open"

The Ftp::Server::stopWaitingForOrigin() notification may come after
Ftp::Server (or an external force) has started closing the control
connection but before the Ftp::Server job became unreachable for
notifications. Writing a response in this state leads to assertions.

Other, currently unknown paths may lead to the same write-after-close
problems. This change protects all asynchronous notification methods
(except the connection closure handler itself) from exposing underlying
code to a closing control connection. This is very similar to checking
for ERR_CLOSING in Comm handlers.

This is a Measurement Factory project.

9 years agoBug 4523: smblib compile fails on NetBSD
Ian Clark [Thu, 30 Jun 2016 20:53:30 +0000 (08:53 +1200)] 
Bug 4523: smblib compile fails on NetBSD

9 years agoDo not make bogus recvmsg(2) calls when closing UDS sockets.
Alex Rousskov [Thu, 30 Jun 2016 20:51:54 +0000 (08:51 +1200)] 
Do not make bogus recvmsg(2) calls when closing UDS sockets.

comm_empty_os_read_buffers() assumes that all non-blocking
FD_READ_METHODs can read into an opaque buffer filled with random
characters. That assumption is wrong for UDS sockets that require an
initialized msghdr structure. Feeding random data to recvmsg(2) leads to
confusing errors, at best. Squid does not log those errors, but they
are visible in, for example, strace:

  recvmsg(17, 0x7fffbb, MSG_DONTWAIT) = -1 EMSGSIZE (Message too long)

comm_empty_os_read_buffers() is meant to prevent TCP RST packets. The
function now ignores UDS sockets that are not used for TCP.

TODO: Useless reads may also exist for UDP and some TCP sockets.

9 years agoFix SEGFAULT parsing malformed adaptation service configuration
Amos Jeffries [Thu, 30 Jun 2016 20:47:53 +0000 (08:47 +1200)] 
Fix SEGFAULT parsing malformed adaptation service configuration

icap_service or ecap_service directives with missing field values need to
abort cleanly with an error.

Also, fix config parsing error messages in adaptation service parse to
use "ERROR:" prefix consistent with squid.conf general behaviour.

9 years agoFixed ConnStateData::In::maybeMakeSpaceAvailable() logic.
Alex Rousskov [Sat, 18 Jun 2016 13:36:07 +0000 (01:36 +1200)] 
Fixed ConnStateData::In::maybeMakeSpaceAvailable() logic.

This change fixes logic bugs that mostly affect performance: In micro-
tests, this change gives 10% performance improvement.

maybeMakeSpaceAvailable() is called with an essentially random in.buf.
The method must prepare in.buf for the next network read. The old code
was not doing that [well enough], leading to performance problems.

In some environments, in.buf often ends up having tiny space exceeding 2
bytes (e.g., 6 bytes). This happens, for example, when Squid creates and
parses a fake CONNECT request. The old code often left such tiny in.bufs
"as is" because we tried to ensure that we have at least 2 bytes to read
instead of trying to provide a reasonable number of buffer space for the
next network read. Tiny buffers naturally result in tiny network reads,
which are very inefficient, especially for non-incremental parsers.

I have removed the explicit "2 byte" space checks: Both the new and the
old code do not _guarantee_ that at least 2 bytes of buffer space are
always available, and the caller does not check that condition either.
If some other code relies on it, more fixes will be needed (but this
change is not breaking that guarantee -- either it was broken earlier or
was never fully enforced). In practice, only buffers approaching
Config.maxRequestBufferSize limit may violate this guarantee AFAICT, and
those buffers ought to be rare, so the bug, if any, remains unnoticed.

Another subtle maybeMakeSpaceAvailable() problem was that the code
contained its own buffer capacity increase algorithm (n^2 growth).
However, increasing buffer capacity exponentially does not make much
sense because network read sizes are not going to increase
exponentially. Also, memAllocStringmemAllocate() overwrites n^2 growth
with its own logic. Besides, it is buffer _space_, not the total
capacity that should be increased. More work is needed to better match
Squid buffer size for from-user network reads with the TCP stack buffers
and traffic patterns.

Both the old and the new code reallocate in.buf MemBlobs. However, the
new code leaves "reallocate or memmove" decision to the new
SBuf::reserve(), opening the possibility for future memmove
optimizations that SBuf/MemBlob do not currently support.

It is probably wrong that in.buf points to an essentially random MemBlob
outside ConnStateData control but this change does not attempt to fix that.

9 years agoBug 3579: assertion failed 'MemPools[type]' from dst_as ACL
Amos Jeffries [Sat, 18 Jun 2016 11:48:03 +0000 (23:48 +1200)] 
Bug 3579: assertion failed 'MemPools[type]' from dst_as ACL

9 years agoSourceFormat Enforcement
Source Maintenance [Thu, 16 Jun 2016 00:14:16 +0000 (00:14 +0000)] 
SourceFormat Enforcement

9 years agoDo not allow low-level debugging to hide important/critical messages.
Alex Rousskov [Wed, 15 Jun 2016 22:08:16 +0000 (10:08 +1200)] 
Do not allow low-level debugging to hide important/critical messages.

Removed debugs() side effects that inadvertently resulted in some
important/critical messages logged at the wrong debugging level and,
hence, becoming invisible to the admin. The removed side effects set the
"current" debugging level when a debugs() parameter called a function
that also called debugs(). The last nested debugs() called affected the
level of all debugs() still in progress!

Related changes:

* Reentrant debugging messages no longer clobber parent messages. Each
  debugging message is logged separately, in the natural order of
  debugs() calls that would have happened if debugs() were a function
  (that gets already evaluated arguments) and not a macro (that
  evaluates its arguments in the middle of the call). This order is
  "natural" because good macros work like functions from the caller
  point of view.

* Assertions hit while evaluating debugs() parameters are now logged
  instead of being lost with the being-built debugs() log line.

* 10-20% faster debugs() performance because we no longer allocate a new
  std::ostringstream buffer for the vast majority of debugs() calls.
  Only reentrant calls get a new buffer.

* Removed old_debug(), addressing an old "needs to die" to-do.

* Removed do_debug() that changed debugging level while testing whether
  debugging is needed. Use side-effect-free Debug::Enabled() instead.

Also removed the OutStream wrapper class. The wrapper was added in trunk
revision 13767 that promised to (but did not?) MemPool the debug output
buffers. We no longer "new" the buffer stream so a custom new() method
would be unused. Besides, the r13767 explanation implied that providing
a Child::new() method would somehow overwrite Parent::allocator_type,
which did not compute for me. Finally, Squid "new"s other allocator-
enabled STL objects without overriding their new methods so either the
same problem is still there or it did not exist (or was different?).

Also removed Debug::xassert() because the debugs() assertions now work
OK without that hack.

9 years agoBug 4485: off-by-one out-of-bounds Parser::Tokenizer::int64() read errors
Eduard Bagdasaryan [Tue, 24 May 2016 20:05:03 +0000 (08:05 +1200)] 
Bug 4485: off-by-one out-of-bounds Parser::Tokenizer::int64() read errors

9 years agoIncrease debug level in a peek-and-splice related debug message
Christos Tsantilas [Sat, 21 May 2016 17:29:19 +0000 (05:29 +1200)] 
Increase debug level in a peek-and-splice related debug message

It may produced one debugging line for each SSL transaction in some cases

9 years agoFix icons loading speed.
Alex Rousskov [Sat, 21 May 2016 15:52:02 +0000 (03:52 +1200)] 
Fix icons loading speed.

Since trunk r14100 (Bug 3875: bad mimeLoadIconFile error handling), each
icon was read from disk and written to Store one character at a time. I
did not measure startup delays in production, but in debugging runs,
fixing this bug sped up icons loading from 1 minute to 4 seconds.

9 years agoFix OpenSSL detection on FreeBSD
Amos Jeffries [Sat, 21 May 2016 13:01:44 +0000 (01:01 +1200)] 
Fix OpenSSL detection on FreeBSD

9 years agoDo not override user defined -std option
Amos Jeffries [Sat, 21 May 2016 13:00:58 +0000 (01:00 +1200)] 
Do not override user defined -std option

9 years agoSourceFormat Enforcement
Source Maintenance [Tue, 17 May 2016 18:14:16 +0000 (18:14 +0000)] 
SourceFormat Enforcement

9 years agoSupport unified EUI format code in external_acl_type
Steve Hill [Tue, 17 May 2016 14:58:50 +0000 (02:58 +1200)] 
Support unified EUI format code in external_acl_type

Squid supports %>eui as a logformat specifier, which produces an EUI-48
for IPv4 clients and an EUI-64 for IPv6 clients.  However, This is not
allowed as a format specifier for the external ACLs, and you have to use
%SRCEUI48 and %SRCEUI64 instead.  %SRCEUI48 is only useful for IPv4
clients and %SRCEUI64 is only useful for IPv6 clients, so supporting
both v4 and v6 is a bit messy.

Adds the %>eui specifier for external ACLs and behaves in the same way
as the logformat specifier.

9 years ago3.5.19 SQUID_3_5_19
Amos Jeffries [Sun, 8 May 2016 12:41:25 +0000 (00:41 +1200)] 
3.5.19

9 years agoBug 4515: regression after CVE-2016-4554 patch
Amos Jeffries [Sun, 8 May 2016 12:41:07 +0000 (00:41 +1200)] 
Bug 4515: regression after CVE-2016-4554 patch

9 years agoSourceFormat Enforcement
Source Maintenance [Fri, 6 May 2016 12:14:15 +0000 (12:14 +0000)] 
SourceFormat Enforcement

9 years ago3.5.18 SQUID_3_5_18
Amos Jeffries [Fri, 6 May 2016 10:11:49 +0000 (22:11 +1200)] 
3.5.18

9 years agoFix SIGSEGV in ESIContext response handling
Amos Jeffries [Fri, 6 May 2016 09:39:48 +0000 (21:39 +1200)] 
Fix SIGSEGV in ESIContext response handling

HttpReply pointer was being unlocked without heving been locked.
Resulting in a double-free. Make it use RefCount instead of
manual locking to ensure locked/unlock is always symmetrical.

9 years agoBug 4455: SegFault from ESIInclude::Start
Amos Jeffries [Fri, 6 May 2016 08:24:29 +0000 (20:24 +1200)] 
Bug 4455: SegFault from ESIInclude::Start

9 years agoPrevent Squid forcing -b 2048 into the arguments for sslcrtd_program
Nathan Hoad [Fri, 6 May 2016 08:15:36 +0000 (20:15 +1200)] 
Prevent Squid forcing -b 2048 into the arguments for sslcrtd_program

Previously Squid assumed it was running with the default sslcrtd_program, which
takes an argument for the FS block size. This causes issues for administrators
that use their own helpers that happen to take a -b argument that means
something else entirely, causing confusion and preventing them from removing
this argument.

A summary of the changes:

* Move the block size retrieval from Squid into security_file_certgen. It
  does not use fsBlockSize as that introduces a lot of dependencies on
  unrelated Squid code, e.g. fde, Debug, MemBuf.

* Make the -b argument mostly redundant, but leave it there so
  administrators can overrule xstatvfs.

* Fix a small typo.

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

9 years agoBug 4510: Removed stale comment about 32KB limit on shared memory cache entries.
Alex Rousskov [Fri, 6 May 2016 06:36:08 +0000 (18:36 +1200)] 
Bug 4510: Removed stale comment about 32KB limit on shared memory cache entries.

9 years agoBug 4509: EUI compile error on NetBSD
Leonardo Taccari [Fri, 6 May 2016 06:28:50 +0000 (18:28 +1200)] 
Bug 4509: EUI compile error on NetBSD

9 years agoBug 4498: URL-unescape the login-info after extraction from URI
Amos Jeffries [Fri, 6 May 2016 06:25:07 +0000 (18:25 +1200)] 
Bug 4498: URL-unescape the login-info after extraction from URI

9 years agoHandshake Error: ccs received early part2
Christos Tsantilas [Wed, 4 May 2016 08:13:12 +0000 (11:13 +0300)] 
Handshake Error: ccs received early part2

Squid currently does not handle SSL server responses that start with
an SSL Alert Record. Squid fails to parse the Server Hello message and
also fails to detect and handle resuming sessions.

This is a Measurement Factory project.

9 years agoBug 4501: HTTP/1.1: normalize Host header
Amos Jeffries [Mon, 2 May 2016 10:51:18 +0000 (22:51 +1200)] 
Bug 4501: HTTP/1.1: normalize Host header

When absolute-URI is provided Host header should be ignored. However some
code still uses Host directly so normalize it using the URL authority
value before doing any further request processing.

For now preserve the case where Host is completely absent. That matters
to the CVE-2009-0801 protection.

This also has the desirable side effect of removing multiple or duplicate
Host header entries, and invalid port values.

9 years agoRequire exact match in Host header name lookup
Amos Jeffries [Mon, 2 May 2016 03:39:35 +0000 (15:39 +1200)] 
Require exact match in Host header name lookup

9 years ago3.5.17 SQUID_3_5_17
Amos Jeffries [Wed, 20 Apr 2016 12:21:39 +0000 (00:21 +1200)] 
3.5.17

9 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

9 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

9 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

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

9 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.

9 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.

9 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

9 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.

9 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.

9 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

9 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

9 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

9 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.

9 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

9 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

9 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

9 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]

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

9 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.

9 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

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

9 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

9 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.

9 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

9 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.

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

9 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

9 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

9 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

9 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

9 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.

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

9 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.

9 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

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

9 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

9 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.

9 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.

9 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.

9 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

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

9 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.

9 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

9 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.

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

9 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.

9 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).

9 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

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

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

9 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

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

9 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

9 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.

9 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

9 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

9 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

9 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

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

9 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.

9 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.

9 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'

9 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

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

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