]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
11 years agoBug 3753: Removes the domain from the cache_peer server pconn key
Amos Jeffries [Fri, 1 Mar 2013 10:58:07 +0000 (03:58 -0700)] 
Bug 3753: Removes the domain from the cache_peer server pconn key

Under the squid-3.2 pconn model the IP:port specifying the destination
are part of the key and can be used to strictly filter selection when
locating pconn.  This means the domain is no longer a necessary part
of the key.

Squid using cache_peer can see a large number of wasted idle connections
to their peers due to the key domain value if the peer hostname is not
substituted properly. There is also a similar affect when contacting
servers with virtual hosted domains.

Also bug 3753 was located with peer host and name= values being used
inconsistently as the domain marker. Resulting in failed pop()
operations and extra FD usage.

This has been tested for several months now with only socket usage
benefits seen in several production networks.

NOTE: previous experience some years back with pconn has demonstrated
several broken web servers which assume all requests on a persistent
connection are for the same virtual host. For now this change avoids
altering the behaviour on DIRECT traffic for this reason.

This was sponsored by Treehouse Networks Ltd.

11 years agoDocs: Mention creation of diskers in cache_dir rock
Alex Rousskov [Fri, 1 Mar 2013 10:49:54 +0000 (03:49 -0700)] 
Docs: Mention creation of diskers in cache_dir rock

11 years agoBug 3763: diskd Error: no filename in shm buffer
Amos Jeffries [Sat, 16 Feb 2013 02:30:04 +0000 (19:30 -0700)] 
Bug 3763: diskd Error: no filename in shm buffer

11 years agoSolaris: Fix xstrto*() function linkages
Amos Jeffries [Sat, 16 Feb 2013 02:29:11 +0000 (19:29 -0700)] 
Solaris: Fix xstrto*() function linkages

These functions are only used by C++ code now and can be hidden from
the .c files.

11 years agoFix coverity scan issue 740457: unsecure temporary file creation
Francesco Chemolli [Sat, 16 Feb 2013 02:28:01 +0000 (19:28 -0700)] 
Fix coverity scan issue 740457: unsecure temporary file creation

11 years agoBug 3686: cache_dir max-size default fails
Amos Jeffries [Sat, 16 Feb 2013 02:26:31 +0000 (19:26 -0700)] 
Bug 3686: cache_dir max-size default fails

If some cache_dir are configured with max-size and some not the default
maximum_object_size limit fails.

This refactors the max-size management code such that each SwapDir always
has a value maxObjectSize(). This value is calculated from the SwapDir
local setting or global limit as appropriate.

The global maximum_object_size directive is migrated to simply be a default
for cache_dir max-size= option.

The global store_maxobjsize variable is altered to be the overall global
limit on how big an object may be cache by this proxy. It now takes into
account the max-size for all cache_dir and cache_mem limitation.

NP: The slow accumulation of these and earlier changes means Squid no
longer immediately caches unknown-length objects. The unit-tests are
therefore changed to test using explicit 0-length objects to ensure the
test is on a cached object not bypassing the apparently ested logic.
They are also provided with a large global store_maxobjsize limit in order
to do a weak test of the SwapDir types max-size in the presence of other
larger cache_dir or maximum_object_size settings.

11 years agoBug 3752: objects that cannot be cached in memory are not cached on disk if cache_dir...
Alex Rousskov [Fri, 15 Feb 2013 09:36:03 +0000 (02:36 -0700)] 
Bug 3752: objects that cannot be cached in memory are not cached on disk if cache_dir max-size is used.

This fix contains four related changes:

1) When fixing "trimMemory for unswappable objects" (trunk r11969), we
replaced swapoutPossible() with swappingOut()||mayStartSwapOut() but missed
the fact that swapoutPossible() had "possible now" semantics while
mayStartSwapOut() has "may start now or in the future" semantics. When all
cache_dirs had max-size set, mayStartSwapOut() returned false for objects of
unknown size and even for smaller-than-maximum but not-yet-received objects,
despite the fact that those objects could be swapped out later.

That false mayStartSwapOut() result allowed maybeTrimMemory() to trim those
objects memory and mark the objects for release, preventing their subsequent
disk caching.

2) To fix (1) above, mayStartSwapOut() had to return true for not-yet-received
objects of unknown size. However, returning true is correct only if no
subsequent check can return false. Thus, we had to move all lower/later checks
that could return false up, placing them before the maximum-of-all-max-sizes
check.

3) Once (2) was done, the end of mayStartSwapOut() had (a) a loop that could
return true while setting decision to MemObject::SwapOut::swPossible and (b)
an unconditional code that did ... the same thing. Thus, the loop could no
longer change the method outcome. The loop also had a lot of doubts and XXXs
attached to it. We removed it. If that loop is needed, it is needed and must
be resurrected elsewhere.

4) Since mayStartSwapOut() returns true if swapout is possible in the future
(but not necessarily now), we cannot rely on its return value to initiate
swapout code. We need to test whether swapout.decision is swPossible instead.

11 years agoRelease Notes: update and spelling corrections
Amos Jeffries [Sat, 9 Feb 2013 07:15:55 +0000 (00:15 -0700)] 
Release Notes: update and spelling corrections

* Move the formal deprecation of upgrade_headers to 3.2.
* spell-check 3.2 release notes
* spell-check squid.conf.documented

11 years agoBug 3767: tcp_outgoing_tos/mark ACLs do not obey acl_uses_indirect_client
Nick Rogers [Sat, 9 Feb 2013 07:05:40 +0000 (00:05 -0700)] 
Bug 3767: tcp_outgoing_tos/mark ACLs do not obey acl_uses_indirect_client

11 years agoDocs: handle unknown squid-2.7 directives cleaner
Amos Jeffries [Sat, 9 Feb 2013 07:05:03 +0000 (00:05 -0700)] 
Docs: handle unknown squid-2.7 directives cleaner

This uses the squid-3 'obsolete' directive logics to cleanly accept and
warn about squid-2.7 directives which are not yet ported to squid-3.

11 years agoPolish debugs on more obsolete options
Amos Jeffries [Sat, 9 Feb 2013 07:04:42 +0000 (00:04 -0700)] 
Polish debugs on more obsolete options

11 years agoMake squid -z for cache_dir rock work like UFS instead of like COSS.
Alex Rousskov [Sat, 9 Feb 2013 06:44:36 +0000 (23:44 -0700)] 
Make squid -z for cache_dir rock work like UFS instead of like COSS.

Also, Polish -z documentation and cache.log reporting.

When a startup script runs squid -z by mistake against a cache_dir that is
already initialized and full of cached entries, some admins prefer that
nothing happens. Rock store now skips reinitialization if both the cache_dir
directory and the db file in that directory exist. If one or both are missing,
the missing pieces are created.

UFS does something similar because it creates missing L1 and L2 directories
but does not erase any entries already present in the cache_dir path. COSS,
OTOH, re-initializes the existing db. Rock behavior will now be closer to UFS.

To clean a corrupted cache_dir, the admin must remove its top-level directory
before running squid -z.

Squid now logs "Creating missing swap directories" instead of "Creating Swap
Directories", and our documentation now reflects the "if missing" part of the
-z algorithm.

Also documented that recent Squid versions run -z in daemon mode (so that SMP
configuration macros continue to work).

11 years agoFix parsing of max-stale values in Surrogate-Control header
Amos Jeffries [Sat, 9 Feb 2013 06:42:44 +0000 (23:42 -0700)] 
Fix parsing of max-stale values in Surrogate-Control header

Skip parsing of the max-stale field when the initial max-age value
is not a valid integer value.

 Detected by Coverity Scan. Issue 740361

11 years agoBug 3723: tcp_outgoing_tos/mark broken for CONNECT requests
Sebastien Wenske [Sat, 9 Feb 2013 06:40:29 +0000 (23:40 -0700)] 
Bug 3723: tcp_outgoing_tos/mark broken for CONNECT requests

11 years agoBug 3515: crash in FtpStateData::ftpTimeout
Amos Jeffries [Sat, 9 Feb 2013 06:38:09 +0000 (23:38 -0700)] 
Bug 3515: crash in FtpStateData::ftpTimeout

Since revision squid-3.2-11174 restructured teh TCO connection handling
in FTP the data connection has had separate 'opener' connection.
Meaning the conn->fd state is always NULL when the setup times out.

This cleans up the data connection opener state and allows the error
message generation to take place.

11 years agoFixed several ConnOpener problems
Alex Rousskov [Sat, 9 Feb 2013 06:36:36 +0000 (23:36 -0700)] 
Fixed several ConnOpener problems

... by relying on AsyncJob protections and comm_close(), while maintaining a
tighter grip on various I/O and sleep states.

Problems addressed:

* Connection descriptor was not closed when attempting to reconnect after
  failures. We now properly close on failures, sleep with descriptor closed,
  and then reopen.

* Timeout handler was not cleaned up properly in some cases, causing memory
  leaks (for the handler Pointer) and possibly timeouts that were fired (for
  then-active handler) after the connection was passed to the initiator.

* Comm close handler was not cleaned up properly.

* statCounter.syscalls.sock.closes counter was not updated on FD closure.

* Waiting pending accepts were not kicked on FD closure.

* Connection timeout was enforced for each connection attempt instead of
  applying to all attempts taken together.

and possibly other problems. The full extent of all side-effects of mishandled
race conditions and state conflicts is probably unknown.

11 years agoBug 3749: IDENT lookup using wrong ports to identify the user
Amos Jeffries [Sat, 9 Feb 2013 06:31:57 +0000 (23:31 -0700)] 
Bug 3749: IDENT lookup using wrong ports to identify the user

11 years ago3.2.7 SQUID_3_2_7
Amos Jeffries [Fri, 1 Feb 2013 10:54:21 +0000 (03:54 -0700)] 
3.2.7

11 years agoFix ipv6 enabled pinger.
Amos Jeffries [Fri, 1 Feb 2013 04:58:59 +0000 (21:58 -0700)] 
Fix ipv6 enabled pinger.

Was failing with assertion failure due to ipv6 support not being probed
automatically.

11 years agoBug 3687: unhandled exception: c when using interception and peers
Amos Jeffries [Fri, 1 Feb 2013 04:57:13 +0000 (21:57 -0700)] 
Bug 3687: unhandled exception: c when using interception and peers

11 years agoBug 3111: Mid-term fix for the forward.cc "err" assertion.
Alex Rousskov [Fri, 1 Feb 2013 04:56:07 +0000 (21:56 -0700)] 
Bug 3111: Mid-term fix for the forward.cc "err" assertion.

The assert is triggered when a close handler for the server connection
destroys FwdState before we have received anything from the origin
server.
Instead of asserting, we now respond with a 502 (Bad Gateway)
ERR_READ_ERROR.

That error seems the most appropriate single choice among available
ones, but
it may be misleading (in access.log) when the close handler was called
due to
client problems. Hopefully, another error will be logged in most of
those
cases.

11 years agoSupport OpenSSL NO_Compression option
Sebastien Wenske [Fri, 1 Feb 2013 04:54:23 +0000 (21:54 -0700)] 
Support OpenSSL NO_Compression option

This option tells OpenSSL to disable TLS compression. A recent version
of OpenSSL library is required for this option to be available

11 years agoFix WCCPv2 'comparison between signed and unsigned integer expressions'
Amos Jeffries [Tue, 29 Jan 2013 07:00:55 +0000 (00:00 -0700)] 
Fix WCCPv2 'comparison between signed and unsigned integer expressions'

11 years agoBug 3567: Memory leak handling malformed requests
Amos Jeffries [Mon, 28 Jan 2013 11:49:40 +0000 (04:49 -0700)] 
Bug 3567: Memory leak handling malformed requests

11 years agoBug 3735: raw-IPv6 domain URLs crash if IPv6-disabled
Amos Jeffries [Mon, 28 Jan 2013 11:48:06 +0000 (04:48 -0700)] 
Bug 3735: raw-IPv6 domain URLs crash if IPv6-disabled

11 years agoBug 3732: Fix ConnOpener IPv6 awareness
Amos Jeffries [Mon, 28 Jan 2013 11:45:07 +0000 (04:45 -0700)] 
Bug 3732: Fix ConnOpener IPv6 awareness

When updating IPv6 support for split-stack one USE_IPV6 wrapper was
omitted conversion to the EnabledIpv6 stack auto-detect mechanism.
This resulted in IPv6 addresses being mis-converted on split-stack
systems or with IPv6 disabled in the kernel and --enable-ipv6 built.

The visible symptom is "assert(FALSE)" in Ip::Address::GetAddrInfo().

11 years agoInitialize mem_node fully
Amos Jeffries [Mon, 28 Jan 2013 11:41:04 +0000 (04:41 -0700)] 
Initialize mem_node fully

Experience in squid-2.7 shows that with MemPools use of malloc instead
of calloc mem_node requires full initialization in order to get accurate
memory accounting.

Also closes Coverity Scan defect issue 740573.

11 years agoBug 3736: Floating point exception due to divide by zero
Tianyin Xu [Mon, 28 Jan 2013 11:40:12 +0000 (04:40 -0700)] 
Bug 3736: Floating point exception due to divide by zero

11 years agoFix "address.GetPort() != 0" assertion for helpers on FreeBSD (at least).
Alex Rousskov [Mon, 28 Jan 2013 11:29:16 +0000 (04:29 -0700)] 
Fix "address.GetPort() != 0" assertion for helpers on FreeBSD (at least).

The order (or set of?) #include files used by src/ssl/helper.cc (and
probably by other helper source files) has changed recently, exposing a
defines.h dependency on sys/socket.h where that system header is
required to define AF_UNIX. With AF_UNIX incorrectly undefined,
IPC_STREAM was set to IPC_TCP_SOCKET instead of IPC_UNIX_STREAM, and
helpers that do not have a notion of a listening port, were trying to
create communication sockets using TCP streams, triggering a "must have
a port" assertion in comm_connect_addr() called from ipcCreate().

TODO: Moving IPC_* defines into an IPC-specific header file may be a
better solution then exposing all defines.h users to sys/socket.h.

11 years agoWCCP: Fix memory leak in mask assignment, improve debuggsing.
Amos Jeffries [Mon, 28 Jan 2013 11:25:34 +0000 (04:25 -0700)] 
WCCP: Fix memory leak in mask assignment, improve debuggsing.

* Release temporary weight array allocated on each HERE_I_AM packet sent
  by Squid. For mask assignment these were not released properly and may
  build up to a significant size of memory over time.

* Add debug traces to send() events to report failures sending packets

* Also, on HERE_I_AM event send() failure, reduce the timeout to 2sec
  for the retry in a crude attempt to prevent router state flapping.

* Silence compiler warnings on use of connect() to disconnect a socket.
  Inconsistent OS behaviour makes the result useless in this case.

 Detected by Coverity Scan. Issues 740329, 740330, 740331, 740332,
    740333, 740441.

11 years agoPolish quick_abort feature decision code
Amos Jeffries [Mon, 28 Jan 2013 11:23:27 +0000 (04:23 -0700)] 
Polish quick_abort feature decision code

Also, fixes a defect identified by Coverity Scan issues 740376, 740456

11 years agoFix memory leak in IP address unit test
Amos Jeffries [Mon, 28 Jan 2013 11:22:25 +0000 (04:22 -0700)] 
Fix memory leak in IP address unit test

Another failure to call FreeAddrInfo() after calling GetAddrInfo().

 Detected by Coverity Scan. Issue 740438.

11 years agoFix memory leaks in ICMP
Amos Jeffries [Mon, 28 Jan 2013 09:59:18 +0000 (02:59 -0700)] 
Fix memory leaks in ICMP

InitAddrInfo() and GetAddrInfo() both allocate addrinfo structs which
must be freed by FreeAddrInfo(). Several places in ICMP were not doing
that free step.

 Detected by Coverity Scan. Issues 740434, 740435, 740436, 740437.

11 years agoBug 3729: 32-bit overflow in parsing 64-bit configuration values
Tianyin Xu [Mon, 28 Jan 2013 09:58:16 +0000 (02:58 -0700)] 
Bug 3729: 32-bit overflow in parsing 64-bit configuration values

11 years agoFix various Disk I/O issues in all modules
Tomas Hozza [Mon, 28 Jan 2013 05:43:11 +0000 (22:43 -0700)] 
Fix various Disk I/O issues in all modules

* Uninitialized class members.

* Handle NULL potential after several dynamic_cast.

* Better error result handling from several system functions
  lseek(), fcntl() can report errors which need handling.

* diskd explicit NULL dereference on broken input.
  Extremely unlikely, but worth protecting against.

 Detected by Coverity Scan. Issues 740510, 740358, 740359,
  740511, 740317, 740360, 740513, 740318, 740514

11 years agoFix error in config parser which would mis-assign the sslcrlfile directive.
Francesco Chemolli [Mon, 28 Jan 2013 05:40:06 +0000 (22:40 -0700)] 
Fix error in config parser which would mis-assign the sslcrlfile directive.

Also, fix potentially crashing flaw in CPU affinity map display code.

  Detected by Coverity Scan, defects 740336 and 740337.

11 years agoPlugged memory leaks in digest authentication module
Francesco Chemolli [Mon, 28 Jan 2013 05:39:19 +0000 (22:39 -0700)] 
Plugged memory leaks in digest authentication module

  Detected by Coverity Scan. Issue 740431.

11 years agoBug 3728: Improve debug for cache_dir
Tianyin Xu [Mon, 28 Jan 2013 04:33:00 +0000 (21:33 -0700)] 
Bug 3728: Improve debug for cache_dir

11 years agoMake sure copied strings are properly terminated in snmplib and wccp2
Tomas Hozza [Mon, 28 Jan 2013 04:30:26 +0000 (21:30 -0700)] 
Make sure copied strings are properly terminated in snmplib and wccp2

11 years agoFix various issues in snmplib
Tomas Hozza [Mon, 28 Jan 2013 04:28:17 +0000 (21:28 -0700)] 
Fix various issues in snmplib

* Memory leaks in OID management

* NULL pointer dereference on OID tree creation

* Ensure buffer terminations on OID data copy

* Better file handle management

  Detected by Coverity Scan. Issues 740480, 740357, 740429,
    443111, 740479, 740500

11 years agoFix various issues in smblib
Tomas Hozza [Mon, 28 Jan 2013 04:27:32 +0000 (21:27 -0700)] 
Fix various issues in smblib

* Crash on NTLM handshakes without domain.

* Memory leak on several internal DC connection failures

* Potential buffer overruns on specially crafted tokens

  Detected by Coverity Scan. Issues 740356, 740406, 740428,
   740476, 740477, 740478

11 years agoBug 3678: external acl grace period causes acl lookup failures
Timo Teras [Fri, 25 Jan 2013 09:59:54 +0000 (02:59 -0700)] 
Bug 3678: external acl grace period causes acl lookup failures

11 years ago3.2.6 SQUID_3_2_6
Amos Jeffries [Wed, 9 Jan 2013 01:41:35 +0000 (18:41 -0700)] 
3.2.6

11 years agoBug 3731: TOS setsockopt() requires int value
Amos Jeffries [Wed, 9 Jan 2013 00:14:43 +0000 (17:14 -0700)] 
Bug 3731: TOS setsockopt() requires int value

FreeBSD is confirmed errors on 8-bit variable size. Other BSD are
documented in a way that implies they do as well, although not at this
stage confirmed to be failing.

Linux seems to be the only confirmed system working with 8-bit size sent
to setsockopt(). So we revert this to 'int' (32-bit or 64-bit) as was
working in Squid 3.1.

11 years agoAnother piece of SQUID-2012:1
Eygene Ryabinkin [Tue, 8 Jan 2013 22:40:18 +0000 (15:40 -0700)] 
Another piece of SQUID-2012:1

11 years agoAdditional pieces of SQUID-2012:1
Amos Jeffries [Tue, 1 Jan 2013 05:29:14 +0000 (22:29 -0700)] 
Additional pieces of SQUID-2012:1

11 years agoBug 3727: kerberos_ldap_group: explicitly assigning a variable to itself
Tianyin Xu [Sun, 30 Dec 2012 07:47:17 +0000 (00:47 -0700)] 
Bug 3727: kerberos_ldap_group: explicitly assigning a variable to itself

 Detected by LLVM compiler.

11 years agoBug 3650: Negotiate auth missing challenge token
Steve Hill [Thu, 27 Dec 2012 03:01:45 +0000 (20:01 -0700)] 
Bug 3650: Negotiate auth missing challenge token

11 years agoBug 3712: Rotating logs overwrites the previous log
Markus Rietzler [Thu, 27 Dec 2012 02:58:57 +0000 (19:58 -0700)] 
Bug 3712: Rotating logs overwrites the previous log

11 years ago3.2.5 SQUID_3_2_5
Amos Jeffries [Mon, 10 Dec 2012 09:52:41 +0000 (02:52 -0700)] 
3.2.5

11 years agoBug 3698: Add missing include to xstrerror.h
Amos Jeffries [Sun, 2 Dec 2012 21:25:28 +0000 (14:25 -0700)] 
Bug 3698: Add missing include to xstrerror.h

later versions were fixed as poart of trunk rev.12290 which added a lot
of errno.h includes. However all that is needed is this one to pull it
in through libcompat headers which cover all .cc.

xstrerror.h is the right place to add the include because it is the place
presenting a macro inlining the dependency.

11 years ago3.2.4 SQUID_3_2_4
Amos Jeffries [Sun, 2 Dec 2012 09:22:41 +0000 (02:22 -0700)] 
3.2.4

11 years agoBug 3688: Lots of Orphan Comm:Connections to ICAP server
Alexander Komyagin [Sun, 2 Dec 2012 08:17:17 +0000 (01:17 -0700)] 
Bug 3688: Lots of Orphan Comm:Connections to ICAP server

11 years agoRemove unnecessary xmemset()
Amos Jeffries [Sun, 2 Dec 2012 08:09:13 +0000 (01:09 -0700)] 
Remove unnecessary xmemset()

Was a simple wrapper around memset() to add debugs() traces. However
other profiling tools can trace memset far better.

11 years agoext_file_userip_acl: Remove duplicate variable definition
Amos Jeffries [Fri, 30 Nov 2012 23:58:20 +0000 (16:58 -0700)] 
ext_file_userip_acl: Remove duplicate variable definition

11 years agoFix accept_filter on Linux
Amos Jeffries [Fri, 30 Nov 2012 13:40:25 +0000 (06:40 -0700)] 
Fix accept_filter on Linux

accept_filter directive on Linux requires TCP_DEFER_ACCEPT which
in turn requires netinet/tcp.h. This was removed when splitting comm
into libcomm.la.

11 years agoTreat no-cache as must-revalidate in Authentication
Amos Jeffries [Fri, 30 Nov 2012 13:38:38 +0000 (06:38 -0700)] 
Treat no-cache as must-revalidate in Authentication

Wrapped as a violation because this operation is off-spec.

CC:no-cache was omitted from the HTTP spec apparently on grounds that
changing its caching effects on authentication would come as a surprise.
The actual operation is safe enough to use when parameterless no-cache
is treated strictly as an alias for must-revalidate (as done by Squid now).

Ref: http://lists.w3.org/Archives/Public/ietf-http-wg/2012OctDec/0387.html

11 years agoBug 3685: Squid hangs in ClassCBucket::update
Amos Jeffries [Fri, 30 Nov 2012 13:35:44 +0000 (06:35 -0700)] 
Bug 3685: Squid hangs in ClassCBucket::update

11 years agoFix several buffer termination bugs
Amos Jeffries [Fri, 30 Nov 2012 13:34:49 +0000 (06:34 -0700)] 
Fix several buffer termination bugs

* strcpy() replaced in several places with strncpy() to ensure destination
  buffers are not overflowed.

* strncpy() does not nul-terminate the destination when the string being
  copied in exactly fills the buffer. Ensure we have terminated strings
  where it may matter.

 Detected by Coverity Scan. Issues 740309, 740310, 740311, 740481, 740483

11 years agolibeui: Warn and fail nicely on socket errors looking up ARP record
Amos Jeffries [Fri, 30 Nov 2012 13:34:06 +0000 (06:34 -0700)] 
libeui: Warn and fail nicely on socket errors looking up ARP record

If something nasty happened (out of FD or similar) socket() may fail.
Report these events and continue with unknown EUI value.

 Detected by Coverity Scan. Issue 740393

11 years agolibrfcnb: memory leaks in session setup
Amos Jeffries [Fri, 30 Nov 2012 13:32:27 +0000 (06:32 -0700)] 
librfcnb: memory leaks in session setup

 Detected by Coverity Scan. Issue 740425.

11 years agoRemove MemPoolChunked::memPID
Amos Jeffries [Fri, 30 Nov 2012 13:31:52 +0000 (06:31 -0700)] 
Remove MemPoolChunked::memPID

This member variable appears to have been missed when MemPool was split
into generic framework and specific Chunked implementation.
 (rev:10513.1.1 aka trunk rev:10517)

The memPID and its maintenance code was moved into MemImplementingAllocator
but this definition left here un-initialized and shadowing the framework
member.

 Detected by Coverity Scan. Issue 740506.

11 years agonegotiate_kerberos_auth: better bounds checking
Amos Jeffries [Fri, 30 Nov 2012 13:31:18 +0000 (06:31 -0700)] 
negotiate_kerberos_auth: better bounds checking

* sysconf() may return -N values on some platforms or values larger than
  the hard-coded 1024 buffer size for hostname. Use sizeof() instead
  since the buffer is hardcoded anyway.

* also, use return instead of exit() on the test binary to reduce
  warnings from static analysis compilers.

 Detected by Coverity Scan. Issues 740392, 740484

11 years agontlm_smb_lm_auth: better bounds checking
Amos Jeffries [Fri, 30 Nov 2012 13:30:40 +0000 (06:30 -0700)] 
ntlm_smb_lm_auth: better bounds checking

Protect against overflow of domain and domain controlleler FQDN buffers
leading to missing nul-termination string errors.

 Detected by Coverity Scan. Issue 740475.

11 years agodigest_fiel_auth: add missing include errno.h
Amos Jeffries [Fri, 30 Nov 2012 13:25:33 +0000 (06:25 -0700)] 
digest_fiel_auth: add missing include errno.h

rev. squid-3.2-11710 adds use of xstrerror() which requires errno.h

11 years agoFix OpenSUSE glibc 2.17 compile issues
Andreas Jaeger [Fri, 30 Nov 2012 13:21:22 +0000 (06:21 -0700)] 
Fix OpenSUSE glibc 2.17 compile issues

11 years agoFixed incomplete MemBlobStats constructor
Francesco Chemolli [Fri, 30 Nov 2012 13:20:10 +0000 (06:20 -0700)] 
Fixed incomplete MemBlobStats constructor

11 years agosquidclient: Better error checking
Amos Jeffries [Fri, 30 Nov 2012 13:19:14 +0000 (06:19 -0700)] 
squidclient: Better error checking

* detect and report fstat() errors which could lead to invalid
  Content-Length being sent.

* remove some useless checks which were causing false positives by Coverity.

 Detected by Coverity Scan. Issues 740334, 740379

11 years agontlm_fake_auth: Fix nesting error
Amos Jeffries [Fri, 30 Nov 2012 13:18:30 +0000 (06:18 -0700)] 
ntlm_fake_auth: Fix nesting error

Broken macro wrapping leads to the fake authenticator sending bad
responses to Squid. This can ead to users being rejected by the fake
helper whose purpose is to accept everything.

 Detected by Coverity Scan. Issue 740394

11 years agobasic_smb_auth: Buffer overrun.
Amos Jeffries [Fri, 30 Nov 2012 11:04:55 +0000 (04:04 -0700)] 
basic_smb_auth: Buffer overrun.

A reply string expanding to >8KB after shell escaping can cause the helper
memory corruption or crash as output buffer is overrun.

 Detected by Coverity Scan. Issue 740411

11 years agolog_file_daemon: better error reporting
Amos Jeffries [Thu, 29 Nov 2012 11:20:58 +0000 (04:20 -0700)] 
log_file_daemon: better error reporting

Report rotation errors and log file removal errors instead of silently
ignoring them.

 Detected by Coverity Scan. Issue 740316

11 years agoVarious memory leaks in configuration parsing
Amos Jeffries [Thu, 29 Nov 2012 11:20:18 +0000 (04:20 -0700)] 
Various memory leaks in configuration parsing

This lot are all small issues derived from allocating new memory and
assigning to a pointer already pointing at previous allocation, or
passing xstrdup() output to a caller which does not directly hold the
passed memory.
 Both cases will disappear once we clean up the string handling in Squid
but for now these still need fixing to avoid leaking memory.

 Detected by Coverity Scan. Issues 740430, 740432, 740439.

11 years agoFix various assertion with side effects
Amos Jeffries [Thu, 29 Nov 2012 11:17:11 +0000 (04:17 -0700)] 
Fix various assertion with side effects

When compiled with high optimization and assert disabled these operations
would have disappeared. The side effects being:
* Disk I/O failure protection disabled. Allowing loops in diskd write.
* squidpurge error handling on command line parse gone. Causing segfault.
* squidpurge 'I am Alive' ticker feature cease working.

 Detected by Coverity Scan. Issues 740299, 740300, 740301, 740302, 740303

11 years agodigest_ldap_auth: Fix crash on empty password
Amos Jeffries [Thu, 29 Nov 2012 11:16:29 +0000 (04:16 -0700)] 
digest_ldap_auth: Fix crash on empty password

 Detected by Coverity Scan. Issue 740399

11 years agocachemgr.cgi: Memory Leaks and DoS Vulnerability
Amos Jeffries [Thu, 29 Nov 2012 11:15:32 +0000 (04:15 -0700)] 
cachemgr.cgi: Memory Leaks and DoS Vulnerability

* Ignore invalid Content-Length headers.

* Limit received POST requests to 4KB and discard the rest.

* Authentication credentials parser also leaks badly.

 Detected by Coverity Scan.
 Issues 740380, 740443, 740444, 740442, 740487, 740446, 740445

11 years agoFix TextException: gracefully handle exceptions with null text messages.
Francesco Chemolli [Mon, 26 Nov 2012 10:24:10 +0000 (03:24 -0700)] 
Fix TextException: gracefully handle exceptions with null text messages.

11 years agoext_file_userip_acl: Polish and missing file handling
Amos Jeffries [Mon, 26 Nov 2012 10:23:30 +0000 (03:23 -0700)] 
ext_file_userip_acl: Polish and missing file handling

* Display error when dictionary file is unaccessible instead of crashing.

* Polish several useless assignments out of the code.

 Detected by Coverity Scan. Issues 740402, 740403, 740589, 740590.

11 years agounlinkd: Compiler warning cleanups
Amos Jeffries [Mon, 26 Nov 2012 10:21:01 +0000 (03:21 -0700)] 
unlinkd: Compiler warning cleanups

Check the return value for open(/dev/null). Nothing we can do about it
since the daemon has already disconnected from cache.log but note that.

 Detected by Coverity Scan. Issue 740328

11 years agodigest_file_auth: Improved error handling
Amos Jeffries [Mon, 26 Nov 2012 08:35:49 +0000 (01:35 -0700)] 
digest_file_auth: Improved error handling

Adds missing error handling when pasword file fails to open for any
reason.

Skips records with missing username in password file.Displays an error
message instead of crashing.

 Detected by Coverity Scan. Issues 740400, 740401

11 years agodigest_edirectory_auth: improved error handling
Amos Jeffries [Mon, 26 Nov 2012 08:35:13 +0000 (01:35 -0700)] 
digest_edirectory_auth: improved error handling

Malicious response from LDAP server can cause squid helper to crash.

Missing realm value returned from LDAP without error/missing value being
indicated in the response can lead to strcmp() using a NULL pointer.
 Extremely unlikely to happen in practice, but worth fixing.

 Detected by Coverity Scan. Issue 740399

11 years agobasic_radius_auth: Fix several issues
Amos Jeffries [Mon, 26 Nov 2012 08:34:05 +0000 (01:34 -0700)] 
basic_radius_auth: Fix several issues

* abort on failed fcntl() non-blocking socket setup

* retry send() on failure. Up to retry attempt count.
  Display send() errors to cache.log.

* prevent buffer overflow on long command line arguments.

* make compiler buffer overflow checks happier with RADIUS packet
  creation code.

 Detected by Coverity Scan. Issues 740314, 740315, 740410, 740474, 743276

11 years agobasic_pam_auth: Fix NULL-dereference issues
Amos Jeffries [Mon, 26 Nov 2012 08:33:25 +0000 (01:33 -0700)] 
basic_pam_auth: Fix NULL-dereference issues

PAM session handles being used after setup failure left them NULL.

Also removes several useless checks of retval after it being explicitly
set to the value tested againt.

 Detected by Coverity Scan. Issue 740354

11 years agobasic_ncsa_auth: Fix NULL-dereference crash
Amos Jeffries [Mon, 26 Nov 2012 08:32:53 +0000 (01:32 -0700)] 
basic_ncsa_auth: Fix NULL-dereference crash

When reading corrupt or broken user passwd files with missing username
data this helper can crash.

 Detected by Coverity Scan. Issue 740398

11 years agobasic_msnt_auth: memory leaks
Amos Jeffries [Mon, 26 Nov 2012 08:32:02 +0000 (01:32 -0700)] 
basic_msnt_auth: memory leaks

 Detected by Coverity scan (free). Issues: 740415, 740416

11 years agoBug 3279: Polish: reference bugzilla record to prevent duplicate reports
Amos Jeffries [Mon, 26 Nov 2012 08:31:24 +0000 (01:31 -0700)] 
Bug 3279: Polish: reference bugzilla record to prevent duplicate reports

11 years agoBug 3329: Polish: reference bugzilla record in cache.log to prevent duplicates
Amos Jeffries [Mon, 26 Nov 2012 08:30:30 +0000 (01:30 -0700)] 
Bug 3329: Polish: reference bugzilla record in cache.log to prevent duplicates

11 years agoModify debugs() to automatically include file, line and function name for high-detail...
Francesco Chemolli [Mon, 26 Nov 2012 08:28:09 +0000 (01:28 -0700)] 
Modify debugs() to automatically include file, line and function name for high-detail cache log lines.

11 years agoBug 3405: ssl_crtd crashes failing to remove certificate
Christos Tsantilas [Mon, 26 Nov 2012 08:26:04 +0000 (01:26 -0700)] 
Bug 3405: ssl_crtd crashes failing to remove certificate

- Try to update the index file in all cases the database modified
  rows. Currently we are using the new operator.

- The find operator in database should not modify the database. Currently
  if an entry is expired, ssl_crtd removes the cert file but does not
  update the index file.

- Fix a small memory leak when remove entries from database: A row object
  removed from TXT_DB indexes but never released.

This patch:
* Use OPENSSL_malloc and OPENSSL_free to allocate/release memory for
  TXT_DB rows. OpenSSL SDK assumes that always allocated using these
  functions.

* Add code in Ssl::CertificateDb::Row destructor to correctly release
  a TXT_DB row.

* Add the sq_TXT_DB_delete and sq_TXT_DB_delete_row functions which
  removes a row from TXT_DB indexes.

This is a Measurement Factory project

11 years agoBug 3659: read_timeout problem with HTTPS
Jean-Philippe Menil [Sat, 10 Nov 2012 04:39:36 +0000 (21:39 -0700)] 
Bug 3659: read_timeout problem with HTTPS

11 years agoPolish: replace several assert(isOpen(fd))
Amos Jeffries [Sat, 10 Nov 2012 04:38:32 +0000 (21:38 -0700)] 
Polish: replace several assert(isOpen(fd))

Reduces by over half the number of asserts which can be confused as
cache.log bug reports just says "assertion isOpen(fd)" in comm.cc

11 years agoBug 3189: AIO thread race on pipe() initialization
Amos Jeffries [Sat, 10 Nov 2012 04:37:29 +0000 (21:37 -0700)] 
Bug 3189: AIO thread race on pipe() initialization

11 years agoPorted: urllogin ACL from squid 2.7
Amos Jeffries [Sat, 10 Nov 2012 04:33:25 +0000 (21:33 -0700)] 
Ported: urllogin ACL from squid 2.7

11 years agoBug 3677: Port un-pinning logic changes from 3.3
Amos Jeffries [Tue, 6 Nov 2012 12:45:17 +0000 (05:45 -0700)] 
Bug 3677: Port un-pinning logic changes from 3.3

Several design changes have been made to pinning in 3.3. One of them
added a safety check to proect close handler removal in the event that
the server connection was already closed.

This ports that protection from 3.3 and fixes at least one code path
leading to bug 3677 assertions.

11 years agoRefactored tools/purge conffile reading to c++-streams
Francesco Chemolli [Sun, 28 Oct 2012 09:58:15 +0000 (03:58 -0600)] 
Refactored tools/purge conffile reading to c++-streams

11 years agoext_lm_group_acl: Add missing rfc1738.h include
Amos Jeffries [Sun, 28 Oct 2012 09:57:13 +0000 (03:57 -0600)] 
ext_lm_group_acl: Add missing rfc1738.h include

11 years agoRemove 'Bungled' warning on missing component directives
Amos Jeffries [Sun, 28 Oct 2012 09:54:40 +0000 (03:54 -0600)] 
Remove 'Bungled' warning on missing component directives

* Make Squid display a ERROR notice and ignore squid.conf directives
  which belong to components disabled at build time instead of throwing
  up 'FATAL: Bungled' message and aborting.

* Polish the 'requires X' message text for better display of cases like
  'requires MS Windows' and 'requires Linux'

* Add 'requires X' message for --enable-auth, --enable-eui, and
  --enable-ssl-crtd which were missing.

* Add debug 'filename' for if-none and postscriptum logging

11 years agoFix missing predefines in PeerDigest.h
Amos Jeffries [Sun, 28 Oct 2012 09:47:38 +0000 (03:47 -0600)] 
Fix missing predefines in PeerDigest.h

11 years ago3.2.3 SQUID_3_2_3
Amos Jeffries [Sat, 20 Oct 2012 12:35:20 +0000 (06:35 -0600)] 
3.2.3

11 years agoRemove the refresh_pattern ignore-no-cache option
Amos Jeffries [Sat, 20 Oct 2012 12:32:21 +0000 (06:32 -0600)] 
Remove the refresh_pattern ignore-no-cache option

With the HTTP/1.1 Cache-Control:no-cache compliance upgrade this option became
obsolete. Its main use-case was to force caching of responses which contained this
control. Revalidation is now happening and no-cache objects are cached by default.

The one remaining effect of ignoring no-cache is to prevent no-cache from allowing
authenticated responses being cached. Which is the opposite of its usually expected
result and allowing that change of behaviour would be counter productive.

11 years agoHTTP/1.1: Cache-Control compliance upgrade
Amos Jeffries [Sat, 20 Oct 2012 10:07:11 +0000 (04:07 -0600)] 
HTTP/1.1: Cache-Control compliance upgrade

trunk rev 11361 converted Cache-Control header from using a single mask
bitmap (shared by request and response) to separate CC header objects in
the request response. This conversion contained several regressions like
the one bug 3670 reports.

This patch:
 * documents HttpStateData::cacheableReply() clarifying the overall
   method action and what each individual check it doing.
 * resolves several visible regressions, including bug 3670.
 * extends the caching to handle the "no-cache" controls as per HTTP/1.1
   (MAY store, but MUST revalidate before use).
 * extends the caching for several lesser known cases of "MAY store"
   exemptions handling authenticated transactions.
 * removes an old hack handling Pragme:no-cache (undefined in HTTP/1.1)

One side effect of now caching transactions utilizing "no-cache" is that
hacks around Pragma:no-cache are reduced to only having any effect when
Cache-Control is absent. Reducing their performance cost. And now require
--enable-http-violations is built in since HTTP/1.1 states that
response Pragma are not defined and thus SHOULD be ignored.