Protect against buffer overrun in DNS query generation
see SQUID-2013:2.
This bug has been present as long as the internal DNS component however
most code reaching this point is passing through URL validation first.
With Squid-3.2 Host header verification using DNS directly we may have
problems.
Marco Beck [Thu, 11 Aug 2011 16:29:57 +0000 (10:29 -0600)]
Regression fix: Replacing reply headers
Restores the functionality to replace reply headers as found in Squid 2.
header_replace worked for both request and reply headers back then.
The creation of request_header_access and reply_header_access altered
replace_headers to only work on requests. It should have received this
name split back then.
Amos Jeffries [Fri, 8 Oct 2010 03:42:54 +0000 (21:42 -0600)]
Author: Henrik Nordstrom <henrik@henriknordstrom.net>
Bug 3056: comm.cc "!fd_table[fd].closing()" assertion from helperServerFree when a helper crashes while processing requests
reshuffle helperServerFree so it first unregisters the failed helper
and starts new ones if needed before it calls the callbacks on any
pending requests. If not those ends up resheduling the request on
this same crashed and partially shut down helper.
Author: Alex Rousskov <rousskov@measurement-factory.com>
Check for NULL and empty strings before calling str*cmp().
These checks are necessary to ensure consistent comparison results (important
for sorting and searching) and to avoid segfaults on NULL buffers (because
termedBuf() may return NULL instead of the expected "0-terminated buffer").
Fixed header accounting to avoid the "Headers[id].stat.aliveCount" assertion.
We were incrementing the alive header field counter twice for each decrement,
which probably resulted in the alive counter wrapping back to zero, triggering
the assertion.
Amos Jeffries [Wed, 26 May 2010 04:52:58 +0000 (16:52 +1200)]
Author: Henrik Nordstrom <henrik@henriknordstrom.net>
Bug 2876: FD_SETSIZE override not working on all linux distributions
The glibc hack for overriding FD_SETSIZE seems to have broken down on some families
of Linux distribution, requiring one more header to be included before redefine.
Hopefully this does not break the FD_SETSIZE override on more systems than
it fixes.. if it does then some additional autoconffuu will be needed.
Amos Jeffries [Wed, 26 May 2010 04:43:22 +0000 (16:43 +1200)]
Bug 2899: Restore lost rfc1738_unescape() data type
Data type was converted to char from int during recent upgrades.
On unix systems char is unsigned making the safety checks fail on build.
This reverts the type back to a usable signed int, no logic changes.
Amos Jeffries [Wed, 10 Mar 2010 11:57:17 +0000 (00:57 +1300)]
Author: Henrik Nordstrom <henrik@henriknordstrom.net>
Bug 2367: Fix stale=true on digest requests with unknown nonce
The nonce staleness check only worked if the stale nonce had not yet
been garbage collected, often resulting in incorrect stale=false
responses and resulting auth popups when using digest auth.
Note: this fix is different from how it's done in squid-2 where fixHeader
is called on all schemes in such conditions but only the active one with
and auth_user_request. Not entirely sure why that is done, but commit
message says something about Negotiate authentication.
Amos Jeffries [Wed, 10 Mar 2010 11:07:17 +0000 (00:07 +1300)]
Author: Henrik Nordstrom <henrik@henriknordstrom.net>
Various other Digest parser fixes
* Correct debug message when failing to parse digest attributes
* Correct digest stale=false in POST workaround code
* Fix new digest parser shutdown code when digest auth not configured
* Sanity check of the username.
" cannot be allowed in usernames until the digest helper protocol
has been redone
Amos Jeffries [Sun, 31 Jan 2010 23:20:22 +0000 (12:20 +1300)]
Regression Fix: Make Squid abort on parse failures.
The addition of multi-file parsing and catching of thrown errors between
them caused any errors in sub-files to be non-fatal and allow Squid to
run as if everything was normal, even if parts of the config were not
being loaded.
Squid will now propigate the error exception out and exit with a count of
the errors found.
The main() safety wrapper from 3.1 has also been ported to catch some
unwanted crashes.
Amos Jeffries [Sun, 31 Jan 2010 23:02:45 +0000 (12:02 +1300)]
Account for mem_node overhead inside cache_mem
This makes squid include the overhead memory space when determining the
number of data pages available in cache_mem memory space. Forming a much
better limit on memory cache usage.
This does NOT solve any issues created by sizeof(mem_node) being unaligned
with the system malloc implementation page size. That still needs to be
resolved.
Amos Jeffries [Sat, 16 Jan 2010 04:44:46 +0000 (17:44 +1300)]
Add client_ip_max_connections
Given some incentive after deep consideration of the slowloris claims.
While I still do not believe Squid is vulnerable per-se and some people
have tested and found no such failures as claimed for the DoS attack.
We found we could provide better administrative controls. This is one such
that has been asked about many times and still did not exist. It operates
essentially the same as maxconn ACL, but does not require HTTP headers and
other request data to fully exist like ACLs do.
It is tested immediately after accept() and is request type agnostic, right
down to DNS TCP requests. So care is warranted in hierarchy situations or where
clients may be behind NAT.
Utilizes the client DB to monitor accepted TCP links. Operates prior to
everything so as to eliminate resource usage on the blocking case and
close the windows of opportunity for dribble-attacks etc.
Default (-1) is to keep the status-quo of no limits.
Amos Jeffries [Tue, 22 Dec 2009 01:52:19 +0000 (14:52 +1300)]
Bug 2395: FTP errors not displayed
* Fix PUT and other errors hanging
* Fix assertion "entry->store_status == STORE_PENDING" caused by FTP
* Several variable-shadowing cases resolved for the fix.
Amos Jeffries [Tue, 22 Dec 2009 01:17:26 +0000 (14:17 +1300)]
Bug 2830: clarify where NULL byte is in headers.
Debug printing used to naturally stop string output at the null byte.
This should show the first segment of headers up to the NULL and the
segment of headers after it. So that its clear to admin that there are
more headers _after_ the portion that used to be logged.
Amos Jeffries [Sun, 6 Dec 2009 00:30:50 +0000 (13:30 +1300)]
Author: Francesco Chemolli <kinkie@squid-cache.org>
Bug 2778: fix linking issues using SunCC
SunCC doesn't handle inline extern functions, and misses some duplicate
code detection features gcc has; as a result squid-specific operator new and
operator delete get defined multiple times and fail linking.
* Implemented a compiler-specific workaround by de-inlining the code.
* Improved Solaris OS detection logic.
Amos Jeffries [Sun, 4 Oct 2009 01:25:10 +0000 (14:25 +1300)]
Author: Alin Nastac <mrness@gentoo.org>
Cleanup: deprecate ugly hack for sys/capability.h
Needed once to prevent build clashes between libc and sys/capabilility.h
headers. As of libcap2 that is no longer the case and from 2.26 in fact
prevents a clean build.
Add detection for libcap to enable the hack only if actually needed.
Add --disable-caps option to disabke libcap and TPROXY2
Amos Jeffries [Fri, 2 Oct 2009 08:31:21 +0000 (21:31 +1300)]
Author: Henrik Nordstrom <henrik@henriknordstrom.net>
Split some asserts with side-effects
assert expressions should not have any noticeable sideffects or otherwise
be important for the program flow operation. If not unexpected results is
seen from compiling with -DNODEBUG