]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
10 years agoRefactor Ipc::Mem::PageStack using std::atomic
Amos Jeffries [Tue, 2 Jun 2015 08:21:08 +0000 (01:21 -0700)] 
Refactor Ipc::Mem::PageStack using std::atomic

10 years agoFix eCAP issues after rev.14093
Amos Jeffries [Fri, 29 May 2015 10:16:18 +0000 (03:16 -0700)] 
Fix eCAP issues after rev.14093

10 years agoPrep for 3.5.5
Amos Jeffries [Thu, 28 May 2015 10:38:56 +0000 (03:38 -0700)] 
Prep for 3.5.5

10 years agoSourceFormat Enforcement
Source Maintenance [Tue, 26 May 2015 18:12:08 +0000 (18:12 +0000)] 
SourceFormat Enforcement

10 years agoReplace Packer object API with Packable API
Amos Jeffries [Tue, 26 May 2015 17:25:04 +0000 (10:25 -0700)] 
Replace Packer object API with Packable API

Majority of thost patch is symbol renaming to unify the
class method names to the Packable API names.

There is effectively no logical change in this patch
despite appearances because it replaces the Packer object
which provides methods which are just wrappers pointing
to static functions which are in turn wrappers pointing
to storage buffer object methods. With direct calls to
those storage object methods (renamed).

We can now interchangebly use MemBuf or StoreEntry objects
with the packInto(Packable *) functions. Or any other
object which inherits and implements the Packable API.

We also gain 0.1% in performance (+2 RPS) by avoiding the
layers of wrapper funcions and Packer object allocate /
deallocate cycles.

10 years agoCleanu: Remove dead Packer API
Amos Jeffries [Tue, 26 May 2015 09:18:13 +0000 (02:18 -0700)] 
Cleanu: Remove dead Packer API

Also includes some Packable API polishing. No logical changes.

10 years agoUse StoreEntry Packable API directly without class Packer wrapper
Amos Jeffries [Mon, 25 May 2015 14:02:29 +0000 (07:02 -0700)] 
Use StoreEntry Packable API directly without class Packer wrapper

10 years agoC++11: migrate auto_ptr to unique_ptr
Amos Jeffries [Sat, 23 May 2015 20:17:16 +0000 (13:17 -0700)] 
C++11: migrate auto_ptr to unique_ptr

Improving the backward compatibility workaround for older compilers.

This is required for GCC 5.x which does not include any auto_ptr support
or compatibility at all.

10 years agoPortability: Define nullptr if not provided
Amos Jeffries [Sat, 23 May 2015 12:24:21 +0000 (05:24 -0700)] 
Portability: Define nullptr if not provided

For use building with non-C++11 compilers, or broken stdlib definitions.
In the absence of nullptr we define it to be a synonym for NULL.

Also, removethe old hack defining NULL in terms of nullptr. It has never
worked properly and C++11 compilers define NULL explicitly.

10 years agoCleanup: remove unnecessary if-conditions
Amos Jeffries [Sat, 23 May 2015 05:10:00 +0000 (22:10 -0700)] 
Cleanup: remove unnecessary if-conditions

krb5 credentials objects were being checked fro NULL before freeing in
several cases where they should not be. Use assert() instead to enforce
the expected behaviour.

 Detected by Coverity Scan. Issue 1250265

10 years agoCleanup: duplicate includes in icap/Xaction.h
Amos Jeffries [Sat, 23 May 2015 03:16:46 +0000 (20:16 -0700)] 
Cleanup: duplicate includes in icap/Xaction.h

10 years agoFix segmentation fault inside Adaptation::Icap::Xaction::swanSong
Christos Tsantilas [Fri, 22 May 2015 17:21:48 +0000 (20:21 +0300)] 
Fix segmentation fault inside Adaptation::Icap::Xaction::swanSong

The Adaptation::Icap::Xaction::swanSong may try to use an invalid
Icap::Xaction::cs object (Comm::ConnOpener object) if the  Comm::ConnOpener
is already gone (because its job finished) but the  Xaction::noteCommConnected
method is not called yet.

This patch makes the Adaptation::Icap::Xaction::cs object a CbcPointer instead
of a raw pointer and checks if the Xaction::cs object is still valid before
using it.

This is a Measurement Factory project

10 years agoPortability: Define C++11 uniform distributions if missing
Amos Jeffries [Fri, 22 May 2015 15:43:19 +0000 (08:43 -0700)] 
Portability: Define C++11 uniform distributions if missing

Older compilers standard libraries may not contain the uniform
distribution templates now used. But we may be able to use the TR1
distributions instead.

10 years agoC++11: compiler support is now mandatory
Amos Jeffries [Fri, 22 May 2015 13:59:49 +0000 (06:59 -0700)] 
C++11: compiler support is now mandatory

We are now using too many C++11 features to go without proper support in
the compiler. Present ./configure time errors if support for -std=c++11
is missing.

10 years agoCrypto-NG: update random number generators
Amos Jeffries [Fri, 22 May 2015 13:33:01 +0000 (06:33 -0700)] 
Crypto-NG: update random number generators

C++11 brings with it a set of reasonable quality random number
generators and tools to retrieve values for various ranges and types.

Use those C++11 STL <random> features to replace the use of the
varyingly broken, weak or non-standard functions: rand(), random(),
lrand48(), and drand48().

In the process we gain much faster and higher 'quality' randomness in
the auth nonces and event queue scheduling. And more "even" spread for
the ACL random feature.

10 years agoMerged from trunk rev.14084
Amos Jeffries [Fri, 22 May 2015 09:59:09 +0000 (02:59 -0700)] 
Merged from trunk rev.14084

10 years agoReplacement of sslversion=N by tls-min-version=1.N
Amos Jeffries [Fri, 22 May 2015 09:42:55 +0000 (02:42 -0700)] 
Replacement of sslversion=N by tls-min-version=1.N

Overall the default behaviour is changed from enumerating the protocols
wanted. To enumerating and eliminating the unwanted.

* sslversion= / version= parameter is removed from documentation.

* sslversion= code logics is converted from setting the SSL_*_method()
  function to setting the ssloptions= masking parameters.

Yes this will open a hole for future libraries use of TLSv1.3. However
that is kind of desirable and if it becomes a problem the
ssloptions=NO_TLSv1_3 should be made available.

* The SSL_*_method() logic is all converted to using the flexible
  TLS_*_Method() API when available (OpenSSL 1.1.0) otherwise the
  equivalent SSLv23_*_method() API is used.

That API follows the latest specification behaviour: to send a protocol
frame type that any recipient should be able to parse (library decides
which), while only negotiating the protocol type permitted.

* A new option tls-min-version=1.N is added to server connection
  directives. It controls *only* the TLS version range.

 - http(s)_port directives are not (yet) implemented using
   Security::PeerOptions. For now they are left with options= masking to
   select protocol support.

 - bug in http(s)_port directives version= parameter is fixed. The new
   backward compatibility code accepts version=4|5|6 where the existing
   code did not despite documentation saying it did.

 - SSLv3 is left at the library default unless ssloptions=NO_SSLv3 is used.

* ssloptions= is left alone so anyone can still set the library options
  masks to control SSLv3 enable/disable or specific TLS versions higher
  than the configured minimum.

10 years agoSourceFormat Enforcement
Source Maintenance [Wed, 20 May 2015 12:12:11 +0000 (12:12 +0000)] 
SourceFormat Enforcement

10 years agoFix "Not enough space to hold server hello message" error message
Christos Tsantilas [Wed, 20 May 2015 11:00:11 +0000 (14:00 +0300)] 
Fix "Not enough space to hold server hello message" error message

This patch merges the Ssl::ClientBio and Ssl::ServerBio read buffering code
to the Ssl::Bio::readAndBuffer method and uses the MemBuf::potentialSpaceSize
instead of MemBuf::spaceSize to check space size for SSL hello messages buffer,
to take in account available space after a possible buffer grow.

This is a Measurement Factory project

10 years agoBug 4132: regression in short_icon_urls with global_internal_static on
Andre Albsmeier [Tue, 19 May 2015 07:51:31 +0000 (00:51 -0700)] 
Bug 4132: regression in short_icon_urls with global_internal_static on

10 years agoFix build errors in rev.14057 and rev.14058
Amos Jeffries [Mon, 18 May 2015 15:51:14 +0000 (08:51 -0700)] 
Fix build errors in rev.14057 and rev.14058

10 years agoPrevent unused ssl_crtd helpers being run
Amos Jeffries [Mon, 18 May 2015 12:50:03 +0000 (05:50 -0700)] 
Prevent unused ssl_crtd helpers being run

The conditions for when to start ssl_crtd helpers was ignoring the
generate-host-certificates=off option. Meaning most ssl-bump installs
were running them needlessly.

10 years agoDocs: fix debug output on https_port context failure
Amos Jeffries [Mon, 18 May 2015 12:49:05 +0000 (05:49 -0700)] 
Docs: fix debug output on https_port context failure

10 years agoFix various uninitialized class members
Amos Jeffries [Sat, 16 May 2015 08:41:00 +0000 (01:41 -0700)] 
Fix various uninitialized class members

 Detected by Coverity Scan. Issues 129715412971531294554,
  126824112682401268239126823812657221264389,
  1151595, 740579, 740574, 740562, 740561, 740560, 740559,
  740558, 740542, 740541, 740540, 740525

10 years agoCleanup: Refactor IcmpConfig
Amos Jeffries [Fri, 15 May 2015 12:50:09 +0000 (05:50 -0700)] 
Cleanup: Refactor IcmpConfig

Pull the IcmpConfig object out of the global SquidConfig structure and
updates it to processing its own parse logics. Bringing it inline with
the per-component configuration design in SourceLayout and HotConf projects.

This allows us to use SBuf for storing the pinger program details and
avoid valgrind complaints about some malloc.

It will also allow lazy re-starting of the helper to be implemented later.

10 years agoSourceFormat Enforcement
Source Maintenance [Fri, 15 May 2015 06:12:06 +0000 (06:12 +0000)] 
SourceFormat Enforcement

10 years agoHTTP/2: RFC 7540
Amos Jeffries [Fri, 15 May 2015 00:38:20 +0000 (17:38 -0700)] 
HTTP/2: RFC 7540

10 years agoFix typo in rev.14073
Amos Jeffries [Thu, 14 May 2015 23:56:40 +0000 (16:56 -0700)] 
Fix typo in rev.14073

10 years agoFix several uninitizliaed members variables
Amos Jeffries [Thu, 14 May 2015 21:47:16 +0000 (14:47 -0700)] 
Fix several uninitizliaed members variables

 Detected by Coverity Scan. Issues 1297154 and 1297152.

10 years agosystemd: add man(8) reference to .service file
Amos Jeffries [Thu, 14 May 2015 10:34:43 +0000 (03:34 -0700)] 
systemd: add man(8) reference to .service file

10 years agoFix incorrect use of errno in various libcomm.la places
Alex Dowad [Thu, 14 May 2015 10:24:29 +0000 (03:24 -0700)] 
Fix incorrect use of errno in various libcomm.la places

Fix problems with 'errno' in TcpAcceptor::Listen, Comm::HandleRead, and
Comm::HandleWrite. 'errno' is only valid after a standard library function
returns an error. Also, we must avoid calling out to other functions before
recording the value of 'errno', since they might overwrite it.

10 years agoSourceFormat Enforcement
Source Maintenance [Wed, 13 May 2015 12:12:10 +0000 (12:12 +0000)] 
SourceFormat Enforcement

10 years agoBug 4236: SSL negotiation error of 'success'
Nathan Hoad [Wed, 13 May 2015 12:00:37 +0000 (05:00 -0700)] 
Bug 4236: SSL negotiation error of 'success'

10 years agoFix signal.h usage to resolve compiler warning
Alex Dowad [Mon, 11 May 2015 15:31:57 +0000 (08:31 -0700)] 
Fix signal.h usage to resolve compiler warning

When included, musl libc's sys/signal.h issues a compiler warning
stating that signal.h should be used directly instead. If gcc is
treating all warnings as errors, this breaks the build.

glibc's sys/signal.h does not contain any definitions; all it does
is include signal.h (indirectly). So directly including signal.h
doesn't break anything with glibc.

10 years agoBug 3930: assertion 'connIsUsable(http->getConn())'
Amos Jeffries [Mon, 11 May 2015 10:44:23 +0000 (03:44 -0700)] 
Bug 3930: assertion 'connIsUsable(http->getConn())'

10 years agoFix missing external ACL helper notes
Nathan Hoad [Fri, 8 May 2015 19:28:16 +0000 (12:28 -0700)] 
Fix missing external ACL helper notes

external ACL helper notes are only added onto the HTTP request that
kicked off the external ACL lookup, and not cached ACL responses.
This means if you set notes from an external ACL that are used for
some processing in other ACLs, or post-processing on logs, things
may be missed.

10 years agocomm_connect_addr on failures returns Comm:OK
Christos Tsantilas [Fri, 8 May 2015 19:16:22 +0000 (12:16 -0700)] 
comm_connect_addr on failures returns Comm:OK

The comm_connect_addr on connect failures sets the xerrno to 0
and returns Comm::OK. This is causes problems on ConnOpener
class users which believes the connection is established and
it is ready for use.

 This is a Measurement Factory project

10 years agoCleanup: Rename Ssl::method() to Ssl::clientMethod() to say what it produces
Amos Jeffries [Fri, 8 May 2015 11:18:30 +0000 (04:18 -0700)] 
Cleanup: Rename Ssl::method() to Ssl::clientMethod() to say what it produces

10 years agoDocs: shuffle SMP specific options to the top of squid.conf
Amos Jeffries [Fri, 8 May 2015 08:11:53 +0000 (01:11 -0700)] 
Docs: shuffle SMP specific options to the top of squid.conf

The workers directive is required to be used before several other
directives. It makes little sense to documents it after the controls
which depend on it.

Make a new config section to contain the SMP specific options.

10 years agoCacheMgr: display 'client_db off' instead of 0 clients accessing cache
Amos Jeffries [Fri, 8 May 2015 07:13:35 +0000 (00:13 -0700)] 
CacheMgr: display 'client_db off' instead of 0 clients accessing cache

... to clarify why there is no record of even the mgr request happening.
The cleint_db mechanism needs to be enabled and measuring traffci for
any useful client counter value to exist.

10 years agoMerge from trunk rev.14061
Amos Jeffries [Thu, 7 May 2015 16:29:15 +0000 (09:29 -0700)] 
Merge from trunk rev.14061

10 years agoFix "Secure ICAP" patch, revno.14055, to allow compile with openSSL disabled
Christos Tsantilas [Wed, 6 May 2015 14:58:01 +0000 (17:58 +0300)] 
Fix "Secure ICAP" patch, revno.14055, to allow compile with openSSL disabled

10 years agoSourceFormat Enforcement
Source Maintenance [Tue, 5 May 2015 18:12:06 +0000 (18:12 +0000)] 
SourceFormat Enforcement

10 years agoSquid Assertion Read.cc:205: "params.data == data"
Christos Tsantilas [Tue, 5 May 2015 17:40:36 +0000 (20:40 +0300)] 
Squid Assertion Read.cc:205: "params.data == data"

Inside IdleConnList::findUseable the IdleConnList::removeAt call can delete
"this" IdleConnList object. The IdleConnList::clearHandlers called imediatelly
after the removeAt method, will try to use the invalid "this" object in
a comm_read_cancel function call, causing this assertion or other similar.

This patch fixes the IdleConnList::findUseable, IdleConnList::pop and
IdleConnList::findAndClose methods to call IdleConnList::clearHandlers before
the IdleConnList::removeAt is called.

This is a Measurement Factory project

10 years agoSquid Assertion errorpage.cc:600: "entry->isEmpty()"
Christos Tsantilas [Tue, 5 May 2015 15:59:56 +0000 (18:59 +0300)] 
Squid Assertion errorpage.cc:600: "entry->isEmpty()"

While squid shuting down, aborted transactions, for which body data already
downloaded, can cause this bug.

This is a Measurement Factory project

10 years agoSquid Assertion MemBuf.cc:380: "new_cap > (size_t) capacity"
Christos Tsantilas [Tue, 5 May 2015 15:38:39 +0000 (18:38 +0300)] 
Squid Assertion MemBuf.cc:380: "new_cap > (size_t) capacity"

The maximum buffer size for holding Server and Client SSL hello messages is only
16k which is not enough hold a Hello message which includes some extensions and
1-2 or more Certificates.
This patch increases the maximum size to 65535 and also adds some checks to
avoid squid crashes in the case the hello messages buffer overflows.

This is a Measurement Factory project

10 years agoSourceFormat Enforcement
Source Maintenance [Tue, 5 May 2015 12:12:14 +0000 (12:12 +0000)] 
SourceFormat Enforcement

10 years agoSecure ICAP
Christos Tsantilas [Tue, 5 May 2015 09:09:27 +0000 (12:09 +0300)] 
Secure ICAP

This patch adds support for ICAP services that require SSL/TLS transport
connections. The same options used for the cache_peer directive are used for
the icap_service directive, with similar certificate validation logic.

To mark an ICAP service as "secure", use an "icaps://" service URI scheme when
listing your service via an icap_service directive. The industry is using a
"Secure ICAP" term, and Squid follows that convention, but "icaps" seems more
appropriate for a _scheme_ name.

Squid uses port 11344 for Secure ICAP by default, following another popular
proxy convention. The old 1344 default for plain ICAP ports has not changed.

Technical Details
==================

This patch:
  - Splits Ssl::PeerConnector class into Ssl::PeerConnector parent and two kids:
    Ssl::BlindPeerConnector, a basic SSL connector for cache_peers, and
    Ssl::PeekingPeerConnector, a peek-and-splice SSL connector for HTTP servers.

  - Adds a third Ssl::IcapPeerConnector kid to connect to Secure ICAP servers.

  - Fixes ErrorState class to avoid crashes on nil ErrorState::request member.
    (Ssl::IcapPeerConnector may generate an ErrorState with a nil request).

  - Modifies the ACL peername to use the Secure ICAP server name as value while
    connecting to an ICAP server. This is useful to make SSL certificate
    policies based on ICAP server name. However, this change is undocumented
    until we decide whether a dedicated ACL would be better.

This is a Measurement Factory project.

10 years agoMake pod2man an optional dependency
Amos Jeffries [Sun, 3 May 2015 07:46:48 +0000 (00:46 -0700)] 
Make pod2man an optional dependency

Documentation files can be built on a best-effort basis. This allows
Squid more helpers to be built without pod2man and sub-dependencies.

configure.ac already checks for pod2man existence and sets appropriate
automake conditionals.

10 years agoPrep for 3.5.4, 3.4.13, 3.3.14, 3.2.14
Amos Jeffries [Fri, 1 May 2015 07:35:40 +0000 (00:35 -0700)] 
Prep for 3.5.4, 3.4.13, 3.3.14, 3.2.14

10 years agoFix X509 server certificate domain matching
Amos Jeffries [Fri, 1 May 2015 06:31:01 +0000 (23:31 -0700)] 
Fix X509 server certificate domain matching

The X509 certificate domain fields may contain non-ASCII encodings.
Ensure the domain match algorithm is only passed UTF-8 ASCII-compatible
strings.

10 years agoBug 3775: Disable HTTP/1.1 pipeline feature for pinned connections
Christos Tsantilas [Fri, 1 May 2015 06:25:14 +0000 (23:25 -0700)] 
Bug 3775: Disable HTTP/1.1 pipeline feature for pinned connections

10 years agoCleanup: Display correct error code in debugging output for IoCallback::finish
Alex Dowad [Wed, 29 Apr 2015 11:26:53 +0000 (04:26 -0700)] 
Cleanup: Display correct error code in debugging output for IoCallback::finish

It seems clear that the debugging log message in IoCallback::finish
was intended to display the arguments passed to the method.

10 years agoCleanup: Fix spelling error in debug message in parseHttpRequest()
Alex Dowad [Wed, 29 Apr 2015 11:24:02 +0000 (04:24 -0700)] 
Cleanup: Fix spelling error in debug message in parseHttpRequest()

10 years agoCleanup: Add whitespace to make debug message in writeComplete() more readable
Alex Dowad [Wed, 29 Apr 2015 11:22:58 +0000 (04:22 -0700)] 
Cleanup: Add whitespace to make debug message in writeComplete() more readable

10 years agoDocs: READ_HANDLER and WRITE_HANDLER error handling requirements
Alex Dowad [Wed, 29 Apr 2015 11:06:52 +0000 (04:06 -0700)] 
Docs: READ_HANDLER and WRITE_HANDLER error handling requirements

All existing READ_HANDLER functions return < 0 on error, so we can test that.
None of them overwrite errno before returning.

10 years agopconn_lifetime robustness fixes
Christos Tsantilas [Tue, 28 Apr 2015 09:55:08 +0000 (12:55 +0300)] 
pconn_lifetime robustness fixes

This patch changes pconn_lifetime (r13780) to abort only really idle
persistent connections (when they timeout). It removes some "extra" features
(added to pconn_lifetime during the feature review) because they break things
when aggressive timeouts is combined with picky clients. Specifically,

1. Squid closed connections with partially received requests when they
   reached pconn_lifetime limit. We should only close _idle_ connections.

2. When connecting to Squid without sending anything for longer than
   pconn_lifetime, the connection hangs if the request is sent after the
   waiting period.

3. The connection also hangs if the initial request is starting to be
   transmitted but then there is a longer pause before the request is
   completed.

Most of the above problems are easy to trigger only when using very aggressive
pconn_lifetime settings that the feature was not designed for, but they still
can be considered bugs from admins point of view. Fixes:

* Do not stop reading a partially received request when we are timing out,
  to avoid aborting that request.

* Do not set keepalive flag based on the pconn_lifetime timeout. We cannot
  predict whether some new request data is going to be read (and reset the
  idle timeout clock) before our Connection:close response is sent back.

HTTP clients are supposed to recover from such races, but some apparently
do not, especially if it is their first request on the connection.

This is a Measurement Factory project.

10 years agoAdd vsnprintf() protection for vargs
Amos Jeffries [Mon, 27 Apr 2015 14:39:04 +0000 (07:39 -0700)] 
Add vsnprintf() protection for vargs

10 years agoMake StoreEntry provide Packable interface
Amos Jeffries [Mon, 27 Apr 2015 14:20:17 +0000 (07:20 -0700)] 
Make StoreEntry provide Packable interface

Preparation for removal of C-style storeAppendPrintf()
functions and Packer wrapper class.

10 years agoUpdate libsquidssl.la MemBuf use
Amos Jeffries [Mon, 27 Apr 2015 11:16:32 +0000 (04:16 -0700)] 
Update libsquidssl.la MemBuf use

10 years agoFix printf format for size_t and mb_size_t
Amos Jeffries [Mon, 27 Apr 2015 11:15:44 +0000 (04:15 -0700)] 
Fix printf format for size_t and mb_size_t

10 years agoRename Packable::Printf as Packable::appendf
Amos Jeffries [Mon, 27 Apr 2015 09:52:02 +0000 (02:52 -0700)] 
Rename Packable::Printf as Packable::appendf

It performs append semantics not replace semantics, and this also paves
the way for SBuf integration.

10 years agoMemBuf implements Packable interface
Amos Jeffries [Mon, 27 Apr 2015 05:31:56 +0000 (22:31 -0700)] 
MemBuf implements Packable interface

... detatch it from Packer wrapper class

10 years agoRename MemBuf::vPrintf to MemBuf::vappendf
Amos Jeffries [Mon, 27 Apr 2015 04:06:26 +0000 (21:06 -0700)] 
Rename MemBuf::vPrintf to MemBuf::vappendf

... inline with the Packable API method name

10 years agoUpdate Packable API to implement vappendf() method
Amos Jeffries [Mon, 27 Apr 2015 01:50:41 +0000 (18:50 -0700)] 
Update Packable API to implement vappendf() method

The backend classes actually implement the vappendf()
base function receiving va_list args object.

The Printf() implementations are all duplicate code. So
provide that function in terms of a virtual vappendf().

vappendf() is incidentally the name used by SBuf API for
this operation and avoids the global vprintf() libc
definition.

10 years agoConvert packing methods from Packer* to Packable* objects
Amos Jeffries [Sun, 26 Apr 2015 16:41:06 +0000 (09:41 -0700)] 
Convert packing methods from Packer* to Packable* objects

Packaging code can now receive any object that implements the Packable
interface instead of requiring the Packer trampoline object. For now it
is still the only object implementing Packable.

10 years agoCreate Packable interface class
Amos Jeffries [Sun, 26 Apr 2015 15:20:11 +0000 (08:20 -0700)] 
Create Packable interface class

Packer class model used C-style function pointers and a standalone
object to perform C-style trampoline for function/method calls.

C++ virtual methods offer to inline all that directly in the data store
objects and enforces type safety on the child object methods instead of
forcing manual type casting on developers.

Re-implement Packer as a wrapper class providing the Packable interface
for backward compatibility with Packer* code. Future code should inherit
objects directly from Packable and implement the interface.

10 years agoShuffle packerPrintf() to be Packer::Printf method
Amos Jeffries [Sun, 26 Apr 2015 14:05:28 +0000 (07:05 -0700)] 
Shuffle packerPrintf() to be Packer::Printf method

10 years agoShuffle packerAppend() to Packer::append() method
Amos Jeffries [Sun, 26 Apr 2015 12:48:26 +0000 (05:48 -0700)] 
Shuffle packerAppend() to Packer::append() method

10 years agoMake packerClean() the destructor actions for Packer class
Amos Jeffries [Sun, 26 Apr 2015 11:25:26 +0000 (04:25 -0700)] 
Make packerClean() the destructor actions for Packer class

10 years agoSourceFormat Enforcement
Source Maintenance [Sat, 25 Apr 2015 18:12:10 +0000 (18:12 +0000)] 
SourceFormat Enforcement

10 years agoBug 4234: comm_connect_addr uses errno incorrectly
Alex Dowad [Sat, 25 Apr 2015 17:21:26 +0000 (10:21 -0700)] 
Bug 4234: comm_connect_addr uses errno incorrectly

comm_connect_addr() uses errno to determine whether library calls like connect()
are successful. Its callers also use errno for extra information on the cause
of any problem. However, after calling library functions like connect(),
comm_connect_addr() calls other library functions which can overwrite errno.

As the errno manpage explains, "a function that succeeds is allowed to change
errno". So even when nothing is wrong, comm_connect_addr() may return an error
flag if libc sets errno. And when something *is* wrong, incorrect error information
may be returned to the caller because errno was overwritten with a different code.

Correct this by using our own error code variable which is set only when a library
call fails. To avoid breaking callers, set errno before returning.

10 years agoFix 'access_log none' to prevent following logs being used
Amos Jeffries [Fri, 24 Apr 2015 04:15:29 +0000 (21:15 -0700)] 
Fix 'access_log none' to prevent following logs being used

The documented behaviour of "access_log none" for preventing logging
using log lines following the directive has not been working in
Squid-3 for some time.

Since the 'none' type does not have a log module associated the entire
switch logic where its abort is checked for was being skipped.

10 years agoFix for patch rev.14034: The ssl_free_SBuf is a free function for ssl_ex_index_server...
Christos Tsantilas [Thu, 23 Apr 2015 16:05:48 +0000 (19:05 +0300)] 
Fix for patch rev.14034: The ssl_free_SBuf is a free function for ssl_ex_index_server, not for ssl_ctx_ex_index_dont_verify_domain

10 years agoDocs: Update CONTRIBUTORS
Source Maintenance [Thu, 23 Apr 2015 14:40:32 +0000 (14:40 +0000)] 
Docs: Update CONTRIBUTORS

10 years agoDocs: clarify Squid masking of TOS ECN bits
Source Maintenance [Thu, 23 Apr 2015 03:31:40 +0000 (03:31 +0000)] 
Docs: clarify Squid masking of TOS ECN bits

10 years agoSourceFormat Enforcement
Source Maintenance [Thu, 23 Apr 2015 00:12:11 +0000 (00:12 +0000)] 
SourceFormat Enforcement

10 years agoFix SSL_get_peer_certificate memory leak
Christos Tsantilas [Wed, 22 Apr 2015 19:45:30 +0000 (22:45 +0300)] 
Fix SSL_get_peer_certificate memory leak

The SSL_get_peer_certificate openSSL function increases the lock for X509
object it returns so X509 object retrieved using this function must be
released with X509_free after use.
This patch uses the Ssl::X509_Pointer TidyPointer to release X509 object
retrieved with the SSL_get_peer_certificate function inside the
Ssl::PeerConnector::handleNegotiateError method

This is a Measurement Factory project

10 years agorevert rev.14035
Christos Tsantilas [Wed, 22 Apr 2015 19:41:13 +0000 (22:41 +0300)] 
revert rev.14035

10 years agoThe %err_detail formating code print wrong error information
Christos Tsantilas [Wed, 22 Apr 2015 19:36:24 +0000 (22:36 +0300)] 
The %err_detail formating code print wrong error information

The bug added with the r13732 patch.

10 years agoFix SSL_get_peer_certificate memory leak
Christos Tsantilas [Wed, 22 Apr 2015 19:25:36 +0000 (22:25 +0300)] 
Fix SSL_get_peer_certificate memory leak

The SSL_get_peer_certificate openSSL function increases the lock for X509
object it returns so X509 object retrieved using this function must be
released with X509_free after use.
This patch uses the Ssl::X509_Pointer TidyPointer to release X509 object
retrieved with the SSL_get_peer_certificate function inside the
Ssl::PeerConnector::handleNegotiateError method

This is a Measurement Factory project

10 years agoUnexpected SQUID_X509_V_ERR_DOMAIN_MISMATCH errors while accessing sites with valid...
Christos Tsantilas [Wed, 22 Apr 2015 19:23:08 +0000 (22:23 +0300)] 
Unexpected SQUID_X509_V_ERR_DOMAIN_MISMATCH errors while accessing sites with valid certificates

A "const char *" pointer retrieved using the SBuf::c_str() method may attached
to an SSL object using the SSL_set_ex_data method as server name used to
validate server certificates. This pointer may become invalid, causing
the SQUID_X509_V_ERR_DOMAIN_MISMATCH errors.

This patch changes the type of the ssl_ex_index_server index used with the
SSL_set_ex_data function to be an SBuf object.

This is a Measurement Factory project

10 years agoPortability: Add hacks to define C++11 explicit N-bit type limits
Amos Jeffries [Wed, 22 Apr 2015 13:32:56 +0000 (06:32 -0700)] 
Portability: Add hacks to define C++11 explicit N-bit type limits

Add cstdint and stdint.h to libcompat headers and ensure that type limits
used by Squid are always available. Mostly this involves shuffling
existing hacks into the compat headers but the UINT32_* limits are new.

10 years agoRevert rev.14029
Amos Jeffries [Wed, 22 Apr 2015 11:06:20 +0000 (04:06 -0700)] 
Revert rev.14029

10 years agoC++11: retain support for older compilers after rev.14028
Amos Jeffries [Wed, 22 Apr 2015 04:42:04 +0000 (21:42 -0700)] 
C++11: retain support for older compilers after rev.14028

10 years agoEpoll: initialize kdpfd and epoll_event in all cases
Amos Jeffries [Tue, 21 Apr 2015 14:20:23 +0000 (07:20 -0700)] 
Epoll: initialize kdpfd and epoll_event in all cases

10 years agoCBDATA: use class Lock for reference counting
Amos Jeffries [Tue, 21 Apr 2015 14:16:56 +0000 (07:16 -0700)] 
CBDATA: use class Lock for reference counting

10 years agoEnsure class Lock counter remains within bounds
Amos Jeffries [Tue, 21 Apr 2015 14:14:49 +0000 (07:14 -0700)] 
Ensure class Lock counter remains within bounds

10 years agoBug 4231 pt2: comm_open_uds does not provide description for newly opened FD
Amos Jeffries [Tue, 21 Apr 2015 13:41:25 +0000 (06:41 -0700)] 
Bug 4231 pt2: comm_open_uds does not provide description for newly opened FD

Thanks to Alex Dowad for identifying the problem.

10 years agoBug 4231 pt1: fd_open() not correctly handling empty descriptions
Alex Dowad [Tue, 21 Apr 2015 13:40:29 +0000 (06:40 -0700)] 
Bug 4231 pt1: fd_open() not correctly handling empty descriptions

10 years agoSourceFormat Enforcement
Source Maintenance [Tue, 21 Apr 2015 06:12:14 +0000 (06:12 +0000)] 
SourceFormat Enforcement

10 years agoAdd Kerberos support for MAC OS X 10.x
Markus Moeller [Tue, 21 Apr 2015 04:50:22 +0000 (21:50 -0700)] 
Add Kerberos support for MAC OS X 10.x

10 years agoReverted r14022 due to some regressions
Francesco Chemolli [Fri, 17 Apr 2015 15:12:09 +0000 (17:12 +0200)] 
Reverted r14022 due to some regressions

10 years agoDetect and use libc++, needed for clang c++11 support
Francesco Chemolli [Fri, 17 Apr 2015 07:15:52 +0000 (09:15 +0200)] 
Detect and use libc++, needed for clang c++11 support

10 years agoNegotiate Kerberos authentication request size exceeds output buffer size.
Christos Tsantilas [Thu, 16 Apr 2015 13:18:44 +0000 (16:18 +0300)] 
Negotiate Kerberos authentication request size exceeds output buffer size.

Despite the "must match" comment, MAX_AUTHTOKEN_LEN in
auth/UserRequest.h got out of sync with similar constants in Negotiate helpers.
A 32KB buffer cannot fit some helper requests (e.g., those carrying Privilege
Account Certificate information in the client's Kerberos ticket). Each truncated
request blocks the negotiate helper channel, eventually causing helper queue
overflow and possibly killing Squid.

This patch increases MAX_AUTHTOKEN_LEN in UserRequest.h to 65535 which
is also the maximum used by the negotiate helpers. The patch also adds checks
to avoid sending truncated requests, treating them as helper errors instead.

This is a Measurement Factory project.

10 years agoDo not increment an iterator invalidated by std::map::erase().
Alex Rousskov [Thu, 16 Apr 2015 04:10:51 +0000 (22:10 -0600)] 
Do not increment an iterator invalidated by std::map::erase().

10 years agoFix initializer missed in rev.14018
Amos Jeffries [Wed, 15 Apr 2015 14:07:51 +0000 (07:07 -0700)] 
Fix initializer missed in rev.14018

10 years agoUse std::map instead of hash.h for tracking CBDATA memory
Amos Jeffries [Wed, 15 Apr 2015 13:36:55 +0000 (06:36 -0700)] 
Use std::map instead of hash.h for tracking CBDATA memory

One more step towards removing the custom hash implementation.

This also resolves some crashes introduced by the custom hash bucket
system to the cbdata cachemgr reports and valgrind tracking.

Also removes the HASHED_CBDATA macro in favour of WITH_VALGRIND.

10 years agoFix require-proxy-header preventing HTTPS proxying and ssl-bump
Yuhua Wu [Wed, 15 Apr 2015 10:26:30 +0000 (03:26 -0700)] 
Fix require-proxy-header preventing HTTPS proxying and ssl-bump

When requir-proxy-header was used, the request->flags.interceptTproxy is
wrongly set to 1.

Since request->flags.interceptTproxy is 1, the 200 status code for CONNECT
call is not sent which breaks both HTTPS proxying and SSL-bump.

10 years agoFix typo in rev.14015
Amos Jeffries [Mon, 13 Apr 2015 14:11:16 +0000 (07:11 -0700)] 
Fix typo in rev.14015