]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
8 years agoMerged from trunk rev.14183
Amos Jeffries [Tue, 28 Jul 2015 12:11:37 +0000 (05:11 -0700)] 
Merged from trunk rev.14183

8 years agomerge coverity-fixes: implement LookupTable
Francesco Chemolli [Tue, 28 Jul 2015 08:12:02 +0000 (10:12 +0200)] 
merge coverity-fixes: implement LookupTable

8 years agoMerged from trunk
Francesco Chemolli [Tue, 28 Jul 2015 08:09:21 +0000 (10:09 +0200)] 
Merged from trunk

8 years agoHandle exceptions during squid.conf parse
Amos Jeffries [Tue, 28 Jul 2015 01:58:00 +0000 (18:58 -0700)] 
Handle exceptions during squid.conf parse

Increasingly code used inside squid.conf parsing is capable of throwing
exceptions to signal errors. Catch any unexpected exceptions that reach
the config parse initiator(s) and report as a FATAL event before self
destructing.

 Detected by Coverity Scan. Issue 1231352

8 years agoC++11: Remove GnuRegex and all -lregex related code
Amos Jeffries [Mon, 27 Jul 2015 21:27:10 +0000 (14:27 -0700)] 
C++11: Remove GnuRegex and all -lregex related code

Squid is now exclusively using the STL std::regex API provided on all
operating systems in a portable manner.

We no longer have any need of detecting if the system is providing a
libregex, or user has configured one, or if it actually works, or how
to call it, or use the GnuRegex code as a backup when one of those
complex details goes wrong.

8 years agoConvert mime.conf regex matching to std::regex
Amos Jeffries [Mon, 27 Jul 2015 20:30:22 +0000 (13:30 -0700)] 
Convert mime.conf regex matching to std::regex

8 years agoConvert cachemgr parameter parser to std::regex
Amos Jeffries [Mon, 27 Jul 2015 20:25:57 +0000 (13:25 -0700)] 
Convert cachemgr parameter parser to std::regex

8 years agoPolish docs for ACLRegexData
Amos Jeffries [Mon, 27 Jul 2015 20:09:57 +0000 (13:09 -0700)] 
Polish docs for ACLRegexData

8 years agopurge: convert metadata matching to std::regex
Amos Jeffries [Mon, 27 Jul 2015 20:05:09 +0000 (13:05 -0700)] 
purge: convert metadata matching to std::regex

* converting the REList class to inline methods.
 - constructor now throws as a side effect of rexp member construction.

NOTE: uses std::regex_match for matching, which will only succeed if the
  pattern(s) given are designed to match the entire URL TLV data field.
  If this causes problems, move to regex_search which does not require
  prefix or suffix to match.

8 years agoConvert FtpGateway directory parser to std::regex
Amos Jeffries [Mon, 27 Jul 2015 19:49:35 +0000 (12:49 -0700)] 
Convert FtpGateway directory parser to std::regex

8 years agopurge: Convert squid.conf parser to std::regex
Amos Jeffries [Mon, 27 Jul 2015 19:48:37 +0000 (12:48 -0700)] 
purge: Convert squid.conf parser to std::regex

8 years agoRename lookup table in auth/digest/Config.cc
Francesco Chemolli [Mon, 27 Jul 2015 16:31:57 +0000 (18:31 +0200)] 
Rename lookup table in auth/digest/Config.cc

8 years agoImplement LookupTable unit tests, documentation, copyright blurb
Francesco Chemolli [Mon, 27 Jul 2015 16:25:09 +0000 (18:25 +0200)] 
Implement LookupTable unit tests, documentation, copyright blurb

8 years agoRefactor refresh_pattern to using class RegexPattern
Amos Jeffries [Mon, 27 Jul 2015 16:03:11 +0000 (09:03 -0700)] 
Refactor refresh_pattern to using class RegexPattern

* re-use class RegexPattern to store refresh_pattern regex field and
  related case sensitivity flag.

* convert class RefreshPattern to MEMPROXY_CLASS.
  Required to ensure corret RegexPattern construction.

* add c_str() method to RegexPattern and hide unencoded pattern member.
  optimization to avoid ugly 'R->pattern.pattern' code and guarantee
  const correctness.

8 years agodigest_edirectory_auth: refactor berEncodeLoginData for improved readability
Francesco Chemolli [Mon, 27 Jul 2015 15:42:35 +0000 (17:42 +0200)] 
digest_edirectory_auth: refactor berEncodeLoginData for improved readability

8 years agoMigrate to generic LookupTable, document it and clean it up
Francesco Chemolli [Mon, 27 Jul 2015 14:53:51 +0000 (16:53 +0200)] 
Migrate to generic LookupTable, document it and clean it up

8 years agoConvert RegexPattern to std::regex
Amos Jeffries [Mon, 27 Jul 2015 14:13:45 +0000 (07:13 -0700)] 
Convert RegexPattern to std::regex

8 years agoMerged from trunk
Francesco Chemolli [Mon, 27 Jul 2015 13:40:19 +0000 (15:40 +0200)] 
Merged from trunk

8 years agoReplace RegexList wth std::list<RegexPattern>
Amos Jeffries [Mon, 27 Jul 2015 12:51:43 +0000 (05:51 -0700)] 
Replace RegexList wth std::list<RegexPattern>

8 years agoAdd basic regex config unit tests
Amos Jeffries [Mon, 27 Jul 2015 12:50:53 +0000 (05:50 -0700)] 
Add basic regex config unit tests

8 years agoImplement base/LookupTable as proposed by Amos
Francesco Chemolli [Mon, 27 Jul 2015 09:30:32 +0000 (11:30 +0200)] 
Implement base/LookupTable as proposed by Amos

8 years agoShuffle RegexList.* to base/libbase RegexPattern.*
Amos Jeffries [Mon, 27 Jul 2015 05:21:06 +0000 (22:21 -0700)] 
Shuffle RegexList.* to base/libbase RegexPattern.*

Split the core regex pattern data fields out into a class RegexPattern
for as a container node use in std::list or other constructions.

Leave the custom linked-list operations under the name RegexList. As a
child wrapper class for now so that old API members are still available.

8 years agoImplemented review change requests to edir_ldapext
Francesco Chemolli [Sun, 26 Jul 2015 20:24:16 +0000 (22:24 +0200)] 
Implemented review change requests to edir_ldapext

8 years agoReplace aclDestroyRegexList() with RegexList delete operator
Amos Jeffries [Sun, 26 Jul 2015 18:34:36 +0000 (11:34 -0700)] 
Replace aclDestroyRegexList() with RegexList delete operator

8 years agoFix ICAP transactions that read a lot of data
Alex Rousskov [Sun, 26 Jul 2015 18:26:52 +0000 (12:26 -0600)] 
Fix ICAP transactions that read a lot of data
by ensuring the read buffer has space [unless it is really full].

Trunk r13995 (Parser-NG: Convert the ICAP read buffer to an SBuf)
broke ICAP transactions that read a lot of data because the new
SBuf::consume() method often does not free buffer space, unlike the
old MemBuf::consume(). Affected transactions failed with mayReadMore()
exceptions because their readBuf.spaceSize() was zero while they
needed to read more data.

Any append,parse,consume;append,parse,consume;... user of SBuf cannot
rely on SBuf::spaceSize() to be meaningful because even consuming the
entire SBuf contents may leave spaceSize() at zero! Instead such code
has to use SBuf::length() to keep buffer from growing too big and
SBuf::rawSpace(1) to ensure some space is available for reading when
the buffer is not too big.

8 years agoConvert RegexList to a MEMPROXY_CLASS
Amos Jeffries [Sun, 26 Jul 2015 18:21:19 +0000 (11:21 -0700)] 
Convert RegexList to a MEMPROXY_CLASS

8 years agoWhen SBuf chop()s away everything, always clear the buffer.
Alex Rousskov [Sun, 26 Jul 2015 18:16:34 +0000 (12:16 -0600)] 
When SBuf chop()s away everything, always clear the buffer.

The old code was trying to make the clearance decision without
normalizing parameters first and missed most cases as the result.

In theory, clear()ing SBuf during chop() is just an optimization
that should have no effect on correct code functionality.

8 years agoMerged from trunk
Francesco Chemolli [Sun, 26 Jul 2015 16:17:52 +0000 (18:17 +0200)] 
Merged from trunk

8 years agoSourceLayout: shuffle DiskIO modules into libdiskio library
Amos Jeffries [Sun, 26 Jul 2015 06:45:25 +0000 (23:45 -0700)] 
SourceLayout: shuffle DiskIO modules into libdiskio library

8 years agoCleanup: avoid mentioning compiler directives in configure output
Amos Jeffries [Sun, 26 Jul 2015 00:57:35 +0000 (17:57 -0700)] 
Cleanup: avoid mentioning compiler directives in configure output

In particular -march=native. It confuses some downstream build tools
to encounter the option in its full name form.

8 years agoFix --disable-disk-io behaviour
Amos Jeffries [Sat, 25 Jul 2015 22:09:50 +0000 (15:09 -0700)] 
Fix --disable-disk-io behaviour

auto-enable for DiskIO modules has been done before the AM_CONDITIONAL
are defined. The checks need to test for explicit "yes" values since
disabled modules will have value "" rather than "no" or "auto" like
other components.

8 years agoCleanup: refactor to remove various dead code
Amos Jeffries [Sat, 25 Jul 2015 14:19:36 +0000 (07:19 -0700)] 
Cleanup: refactor to remove various dead code

... detected by or confusing Coverity Scan.

These have been marked False Positive / Intentional earlier.
But long term the best fix is to simply clean out the dead code.

8 years agosmblib: fix buffer over-read
Amos Jeffries [Sat, 25 Jul 2015 12:53:16 +0000 (05:53 -0700)] 
smblib: fix buffer over-read

When parsing SMB LanManager packets with invalid protocol ID and the
default set of Squid supported protocols. It may access memory outside
the buffer storing protocol names.

smblib is only used by already deprecated helpers which are deprecated
due to far more significant NTLM protocol issues. It will also only
result in packets being rejected later with invalid protocol names. So
this is a minor bug rather than a vulnerability.

 Detected by Coverity Scan. Issue 1256165

8 years agoCleanup: remove some obsolete TODOs
Amos Jeffries [Sat, 25 Jul 2015 12:03:27 +0000 (05:03 -0700)] 
Cleanup: remove some obsolete TODOs

8 years agoBug 4251: incorrect instance name for memory segments in /dev/shm
Jose Luis Godoy [Fri, 24 Jul 2015 13:24:01 +0000 (06:24 -0700)] 
Bug 4251: incorrect instance name for memory segments in /dev/shm

8 years agoReworked initializers in HttpDigestFieldAttrs
Francesco Chemolli [Thu, 23 Jul 2015 20:04:46 +0000 (22:04 +0200)] 
Reworked initializers in HttpDigestFieldAttrs

8 years agoImplement std::map-based auth/digest lookup table, part 2 (remove old code)
Francesco Chemolli [Thu, 23 Jul 2015 19:05:42 +0000 (21:05 +0200)] 
Implement std::map-based auth/digest lookup table, part 2 (remove old code)

8 years agoImplement std::map-based auth/digest lookup table, part 1 of 2 (add code)
Francesco Chemolli [Thu, 23 Jul 2015 15:12:49 +0000 (17:12 +0200)] 
Implement std::map-based auth/digest lookup table, part 1 of 2 (add code)

8 years agoRework edir_ldapexxt berEncodeLoginData for improved readability (CID 1294555)
Francesco Chemolli [Thu, 23 Jul 2015 12:20:00 +0000 (14:20 +0200)] 
Rework edir_ldapexxt berEncodeLoginData for improved readability (CID 1294555)

8 years agoMerged from trunk
Francesco Chemolli [Thu, 23 Jul 2015 07:29:41 +0000 (09:29 +0200)] 
Merged from trunk

8 years agoRework Rock::SwapDir::getOptionTree (CID 1312104)
Francesco Chemolli [Wed, 22 Jul 2015 16:43:48 +0000 (18:43 +0200)] 
Rework Rock::SwapDir::getOptionTree (CID 1312104)

8 years agoSourceFormat Enforcement
Source Maintenance [Wed, 22 Jul 2015 00:12:08 +0000 (00:12 +0000)] 
SourceFormat Enforcement

8 years agoMerge Coverity Fixes
Francesco Chemolli [Tue, 21 Jul 2015 19:43:43 +0000 (21:43 +0200)] 
Merge Coverity Fixes

8 years agoMerged from trunk
Francesco Chemolli [Tue, 21 Jul 2015 14:57:09 +0000 (16:57 +0200)] 
Merged from trunk

8 years agoMerged from trunk rev.14169
Amos Jeffries [Tue, 21 Jul 2015 13:56:20 +0000 (06:56 -0700)] 
Merged from trunk rev.14169

8 years agoRevert rev.14165 and rev.14167
Amos Jeffries [Tue, 21 Jul 2015 13:50:24 +0000 (06:50 -0700)] 
Revert rev.14165 and rev.14167

Too much instability added to trunk by these. DiskIO needs a
full refactoring and more testing before its ready to merge.

We will have to live with libIpcIo problems until then.

8 years agoSourceMaintenance updates
Amos Jeffries [Tue, 21 Jul 2015 13:20:11 +0000 (06:20 -0700)] 
SourceMaintenance updates

8 years agoLate-declare variable in ntlm_smb_lm_auth.cc (CID 1256169)
Francesco Chemolli [Tue, 21 Jul 2015 12:53:18 +0000 (14:53 +0200)] 
Late-declare variable in ntlm_smb_lm_auth.cc (CID 1256169)

8 years agoAdded comment on log_file_daemon error reporting
Francesco Chemolli [Tue, 21 Jul 2015 12:42:27 +0000 (14:42 +0200)] 
Added comment on log_file_daemon error reporting

8 years agoRemove direct references to DiskIO/* files from unit tests
Amos Jeffries [Tue, 21 Jul 2015 12:11:06 +0000 (05:11 -0700)] 
Remove direct references to DiskIO/* files from unit tests

8 years agoAdd stub for libdiskio.la
Amos Jeffries [Tue, 21 Jul 2015 12:10:42 +0000 (05:10 -0700)] 
Add stub for libdiskio.la

8 years agoRemove DiskIO/time.cc on file cleaning
Amos Jeffries [Tue, 21 Jul 2015 12:07:46 +0000 (05:07 -0700)] 
Remove DiskIO/time.cc on file cleaning

8 years agoSourceFormat Enforcement
Source Maintenance [Tue, 21 Jul 2015 00:12:11 +0000 (00:12 +0000)] 
SourceFormat Enforcement

8 years agoSourceLayout: build Disk I/O modules as convenience libraries
Amos Jeffries [Mon, 20 Jul 2015 22:37:14 +0000 (15:37 -0700)] 
SourceLayout: build Disk I/O modules as convenience libraries

8 years agoRevert and improve fix for FtpClient.cc
Francesco Chemolli [Mon, 20 Jul 2015 20:39:02 +0000 (22:39 +0200)] 
Revert and improve fix for FtpClient.cc

8 years agoSupport %un (any available user name) format code for external ACLs.
Amos Jeffries [Mon, 20 Jul 2015 18:09:23 +0000 (11:09 -0700)] 
Support %un (any available user name) format code for external ACLs.

The same %un code, with the same meaning is already supported in access.log.
In an external ACL request, it expands to the first available user name
from the following list of information sources:

  - authenticated user name, like %ul or %LOGIN
  - user name supplied by an external ACL to Squid via the "user=..."
    key=value pair, like %ue or %EXT_USER
  - SSL client name, like %us
  - ident user name, like %ui

Based on Amos Jeffries 2011 patch and "arronax28" design:
http://www.squid-cache.org/mail-archive/squid-dev/201112/0080.html
with TODO completion by Measurement Factory

8 years agoAvoid possible leak in Rock::SwapDir::getOptionTree() (CID 740433)
Francesco Chemolli [Mon, 20 Jul 2015 13:48:30 +0000 (15:48 +0200)] 
Avoid possible leak in Rock::SwapDir::getOptionTree() (CID 740433)

8 years agoCheck return code from setsockopt (CID 1231350)
Francesco Chemolli [Mon, 20 Jul 2015 10:19:04 +0000 (12:19 +0200)] 
Check return code from setsockopt (CID 1231350)

8 years agoCheck success of logfile rotations in debug.cc (CID 740321)
Francesco Chemolli [Mon, 20 Jul 2015 09:44:12 +0000 (11:44 +0200)] 
Check success of logfile rotations in debug.cc (CID 740321)

8 years agoSourceLayout: add DiskIO/libdiskio.la convenience library
Amos Jeffries [Sun, 19 Jul 2015 20:09:17 +0000 (13:09 -0700)] 
SourceLayout: add DiskIO/libdiskio.la convenience library

8 years agoSourceFormat Enforcement
Source Maintenance [Sun, 19 Jul 2015 18:12:10 +0000 (18:12 +0000)] 
SourceFormat Enforcement

8 years agoImprove handling of client connections on shutdown
Amos Jeffries [Sun, 19 Jul 2015 13:41:08 +0000 (06:41 -0700)] 
Improve handling of client connections on shutdown

When Squid which are processing a lot of traffic, using persistent
client connections, or dealing with long duration requests are shutdown
they can exit with a lot of connections still open. The
shutdown_lifetime directive exists to allow time for existing
transactions to complete, but this is not always possible and has no
effect on idle connections.

The result is a large dump of aborted FD entries being logged as the TCP
sockets get abruptly reset. Potentially active transactions cache
objects being "corrupted" in the process.

Makes ConnStateData and its children implement Runner API callbacks
to receive signals about Squid shutdown. Which allows their close()
handlers to be run properly and make use of AsyncCalls API. Idle client
connections are closed immediately on the startShutdown() signal, so
their closure CPU cycles happens during the shutdown grace period.

An extra 0-delay event step is added to SignalEngine shutdown sequence
with a new Runner registry hook 'endingShutdown' is added to signal that
the shutdown_lifetime grace period is over for closure of active
transactions. All network FD sockets should be considered unusable for
read()/write() at that point since close handlers may have already been
scheduled by other Runners. AsyncCall's may still be scheduled to
release resources.

Also adds a DeregisterRunner() API action to remove Runners dynamically
from the registered set.

The Squid shutdown sequence is now:

* shutdown signal received:
 - listening sockets closed
 - idle client connections closed

* shutdown grace period ends:
 - remaining client connections closed

* shutdown finishes:
 - main signal and Async loop halted
 - all memory free'd

Server connections which are PINNED or in active use during the
endingShutdown execution will be closed cleanly as a side-effect of the
client closures. Otherwise there is no change (yet) to server connections
or other FD sockets behaviour on shutdown.

8 years agoCleanup: replace urlCanonical() with HttpRequest::effectiveReuqestUri()
Amos Jeffries [Sun, 19 Jul 2015 13:23:01 +0000 (06:23 -0700)] 
Cleanup: replace urlCanonical() with HttpRequest::effectiveReuqestUri()

We have previously been using the term "canonical URL" in Squid to mean
absolute-URI, but not in all cases and may sometimes mean authority-form.
RFC 7230 introduces a new term "Effective Request URI" which directly
matches our desired usage.

* make urlCanonical() global function a method of class HttpRequest
  since it depends on request method for its particular form syntax

* remove the now unnecessary canonical member and HttpRequest::SetHost()

* convert HttpRequest::storeId(), Ftp::UrlWith2f(), and ps_state::url()
  to SBuf usage to avoid performance regressions in their use.

* replace many uses of xstrdup() with xstrndup() for performance where
  the copy cannot be avoided entirely.

* avoid using urlParse() to do a simple URL data-copy in ICAP handling

* update stub_HttpRequest.cc to match full class HttpRequest API

8 years agoTLS: Allow tls-min-version=1.3 configuration
Amos Jeffries [Sun, 19 Jul 2015 08:33:29 +0000 (01:33 -0700)] 
TLS: Allow tls-min-version=1.3 configuration

Bounds limiting was restricting configuration to <1.2 since those are
the currently available TLS versions. But 1.3 is upcoming and may be
used within the lifetime of this Squid version.

 Detected by Coverity Scan. Issue 1311636

8 years agoMerge fixes for some issues reported by Coverity
Francesco Chemolli [Fri, 17 Jul 2015 09:30:47 +0000 (11:30 +0200)] 
Merge fixes for some issues reported by Coverity

8 years agoSourceFormat Enforcement
Source Maintenance [Thu, 16 Jul 2015 18:12:10 +0000 (18:12 +0000)] 
SourceFormat Enforcement

8 years agoBug 1961 partial: refactor 'canonical' URI creation
Amos Jeffries [Thu, 16 Jul 2015 14:55:27 +0000 (07:55 -0700)] 
Bug 1961 partial: refactor 'canonical' URI creation

... using class URL and member absolute() to produce absolute-form URI
in accordance with RFC 3986 and 7230.

8 years agoViolate RFC 2396 and 3986 URI handling requirements.
Amos Jeffries [Thu, 16 Jul 2015 05:09:30 +0000 (22:09 -0700)] 
Violate RFC 2396 and 3986 URI handling requirements.

For the past 17 years RFC 2396 has specified explicit
characters which are disallowed in any form of URI due
to their use in potential or real malware attacks
against network servers.

10 years ago RFC 3986 updated this by allowing some
previously disallowed characters, and moving to a model
of explicitly listing all characters allowed in each
segment of a URI with explicit %-encoding requirement
for all other characters.

Squid has recently been updated to parse that RFC 3986
syntax closely, with minimal tolerance for garbage as
outlined explicitly in RFC 7230.

However, various major corporations are still building
popular tools that violate the RFC 3986 Security
Considerations surrounding safe encoding of characters
in URI they transmit as HTTP request URLs.

This patch allows Squid with --enable-http-violations
(on by default) and configured for lenient parsing (on
by default) to accept a subset of characters which are
expressly forbidden but actively used un-encoded.

Malware attacks utilizing these characters to perform
URL-injection are mitigated by treating the client
request as an HTTP "0.9" protocol message. Such
messages are not permitted to use nonidempotent HTTP
methods which affect server state, and most Mime
headers from the client are ignored.

8 years agoFix HTTPS ports not initialized properly after rev.14148
Amos Jeffries [Wed, 15 Jul 2015 16:09:06 +0000 (09:09 -0700)] 
Fix HTTPS ports not initialized properly after rev.14148

8 years agoAUFS: Raise I/O queue congestion limits
Amos Jeffries [Wed, 15 Jul 2015 14:23:29 +0000 (07:23 -0700)] 
AUFS: Raise I/O queue congestion limits

... from 8 to 8196 before initial congestion message appears.

Modern networks can be quite busy and even amateur installations have a
much higher I/O throughput than Squid was originally designed for. This
often results in a series of "Queue congestion" warnings appearing on
startup before Squid learns what the local environment requires.

The new limit helps to cater for this and reduce teh frequency of
unnecessary warnings. They may still occur, so debug output is also
updated to show what the queue length has grown to with each warning.

Also updating the congestion counter from 32-bit to 64-bit unsigned
since the new limit already consumes half the available growth bits in
32-bit integer.

8 years agoCleanup: Replace SSL_CTX* with Security::ContextPointer
Amos Jeffries [Mon, 13 Jul 2015 16:04:07 +0000 (09:04 -0700)] 
Cleanup: Replace SSL_CTX* with Security::ContextPointer

... or 'auto' keyword in all locations outside src/ssl/

8 years agoCrypto-NG: add SessionPointer type to libsecurity API
Amos Jeffries [Mon, 13 Jul 2015 15:21:26 +0000 (08:21 -0700)] 
Crypto-NG: add SessionPointer type to libsecurity API

This type represents the appropriate TLS connection state session
pointer for whichever crypto library is linked against.

Also replaces all uses of SSL* outside of src/ssl/ with the new Pointer
or 'auto'.

8 years agoSourceFormat Enforcement
Source Maintenance [Mon, 13 Jul 2015 12:12:09 +0000 (12:12 +0000)] 
SourceFormat Enforcement

8 years agoCleanup: Shuffle Squid result codes (aka log tags) into class LogTags
Amos Jeffries [Mon, 13 Jul 2015 10:48:31 +0000 (03:48 -0700)] 
Cleanup: Shuffle Squid result codes (aka log tags) into class LogTags

This begins the migration of result codes from enumeration to a
set of flags whih can combine into much more flexible logging of
transation activity than hard-coded labels enumerating every
individual code path.

The existing ABORTED and TIMEDOUT state flags are also moved into
the new class as an example of how such flags would operate.

8 years agoFix error-testing condition in log_file_daemon.cc (CID 1256161)
Francesco Chemolli [Sun, 12 Jul 2015 18:01:57 +0000 (20:01 +0200)] 
Fix error-testing condition in log_file_daemon.cc (CID 1256161)

An error condition check would assume that ferror(3) returns negative values if error bit is set.
According to documentation, the only guarantee is that it returns nonzero in case of error.

8 years agoComment out dead code in FtpClient.cc (CID 1231357)
Francesco Chemolli [Sun, 12 Jul 2015 17:43:26 +0000 (19:43 +0200)] 
Comment out dead code in FtpClient.cc (CID 1231357)

8 years agoSave errno to prevent debugs from clobbering it
Francesco Chemolli [Sun, 12 Jul 2015 17:42:49 +0000 (19:42 +0200)] 
Save errno to prevent debugs from clobbering it

8 years agoRevert last revision as the topic is being discussed in a different development thread
Francesco Chemolli [Sun, 12 Jul 2015 16:41:38 +0000 (18:41 +0200)] 
Revert last revision as the topic is being discussed in a different development thread

8 years agoMerge from trunk
Amos Jeffries [Sun, 12 Jul 2015 10:07:01 +0000 (03:07 -0700)] 
Merge from trunk

8 years agoShuffle _TIMEOUT and _ABORTED flags into class LogTags
Amos Jeffries [Sun, 12 Jul 2015 10:04:45 +0000 (03:04 -0700)] 
Shuffle _TIMEOUT and _ABORTED flags into class LogTags

8 years agoCleanup: Remove SSL parse_flags() function unused since rev.14148
Amos Jeffries [Sun, 12 Jul 2015 08:28:03 +0000 (01:28 -0700)] 
Cleanup: Remove SSL parse_flags() function unused since rev.14148

8 years agoSourceFormat Enforcement
Source Maintenance [Fri, 10 Jul 2015 18:12:10 +0000 (18:12 +0000)] 
SourceFormat Enforcement

8 years agoMerge suggestions from Amos' review
Francesco Chemolli [Fri, 10 Jul 2015 13:27:02 +0000 (15:27 +0200)] 
Merge suggestions from Amos' review

8 years agoFix src/DiskIO/AIO/AIODiskIOStrategy.cc
Francesco Chemolli [Fri, 10 Jul 2015 13:04:18 +0000 (15:04 +0200)] 
Fix src/DiskIO/AIO/AIODiskIOStrategy.cc

8 years agoCrypto-NG: Use Security::PeerOptions for listening port TLS settings
Amos Jeffries [Fri, 10 Jul 2015 13:03:18 +0000 (06:03 -0700)] 
Crypto-NG: Use Security::PeerOptions for listening port TLS settings

The bulk of this patch is symbol shuffling to de-duplicate the TLS
settings storage and parsing code.

* Shuffle relevant AnyP::PortCfg settings into a Security::PeerOptions
  member object.
 - removes a lot of duplicate config parsing code.

* Remove the now obsolete and unused Ssl::OpenSSLtoSquidSSLVersion()

The actual logic changes are relatively small:

* Shuffle flags= and options= parsing code from Ssl:: to
  Security::PeerOptions and update to use Tokenizer,
 - fixes performance regression using c_str() on the stored SBuf,
 - fixes performance issue with xstrdup() for option tokens,
 - removes several calls to c-string manipulation.

* Add cachemgr 'config' report dumper of Security::PeerOptions for use
  by all directives using it to dump tls-* parameter names. The old
  parameter names are still accepted, and deprecation will follow in a
  separate patch.
 - fixes bug where cache_peer was not dumping out its SSL/TLS config
  settings at all.

* Change the tls_outgoing_options default value from "disable" to setting
  TLS/1.0 minimum version.
  - fixes squid.conf parsing error on default value "disable".

* Fix tls-min-version=1.N handling not to alter stored options= config
  string. Now updates the binary representation in parsedOptions directly.

* Expose the TLS context creation and configuration to non-OpenSSL builds.
 - fixes bug where context creation by OpenSSL failed silently.

8 years agoRevert tls_outgoing_options default 'options=NO_SSLv3'
Amos Jeffries [Fri, 10 Jul 2015 12:59:48 +0000 (05:59 -0700)] 
Revert tls_outgoing_options default 'options=NO_SSLv3'

8 years agoImplement default constructor for Ipc::ReadWriteLock (CID 1153961)
Francesco Chemolli [Fri, 10 Jul 2015 09:55:05 +0000 (11:55 +0200)] 
Implement default constructor for Ipc::ReadWriteLock (CID 1153961)

8 years agoSourceFormat Enforcement
Source Maintenance [Thu, 9 Jul 2015 18:12:08 +0000 (18:12 +0000)] 
SourceFormat Enforcement

8 years agoMerged from trunk
Francesco Chemolli [Thu, 9 Jul 2015 15:15:02 +0000 (17:15 +0200)] 
Merged from trunk

8 years agoAvoid SSL certificate db corruption with empty index.txt as a symptom.
Christos Tsantilas [Thu, 9 Jul 2015 14:02:07 +0000 (17:02 +0300)] 
Avoid SSL certificate db corruption with empty index.txt as a symptom.

* Detect cases where the size file is corrupted or has a clearly wrong
  value. Automatically rebuild the database in such cases.

* Teach ssl_crtd to keep running if it is unable to store the generated
  certificate in the database. Return the generated certificate to Squid
  and log an error message in such cases.

Background:

There are cases where ssl_crtd may corrupt its certificate database.
The known cases manifest themselves with an empty db index file.  When
that happens, ssl_crtd helpers quit, SSL bumping does not work any more,
and the certificate DB has to be deleted and re-initialized.

We do not know exactly what causes corruption in deployments, but one
known trigger that is easy to reproduce in a lab is the block size
change in the ssl_crtd configuration. That change has the following
side-effects:

1. When ssl_crtd removes certificates, it computes their size using a
   different block size than the one used to store the certificates.
   This is may result in negative database sizes.

2. Signed/unsigned conversion results in a huge number near LONG_MAX,
   which is then written to the "size" file.

3. The ssl_crtd helper remoces all certificates from database trying to make
   space for new certificates.

4. The ssl_crtd helper refuses to store new certificates because the
   database size (as described by the "size" file) still exceeds the
   configured limit.

5. The ssl_crtd helper exits because it cannot store a new certificates
   to the database. No helper response is sent to Squid in this case.

Most likely, there are other corruption triggers -- the database
management code is of an overall poor quality. This change resolves some
of the underlying problems in hope to address at least some of the
unknown triggers as well as the known one.

This is a Measurement Factory project.

8 years agoCheck invariant in DiskdFile::writeDone (CID 980998)
Francesco Chemolli [Thu, 9 Jul 2015 13:55:56 +0000 (15:55 +0200)] 
Check invariant in DiskdFile::writeDone (CID 980998)

8 years agoCheck invariant in DiskdFile::readDone (CID 980997)
Francesco Chemolli [Thu, 9 Jul 2015 13:50:22 +0000 (15:50 +0200)] 
Check invariant in DiskdFile::readDone (CID 980997)

8 years agoErrors served using invalid certificates when dealing with SSL server errors.
Christos Tsantilas [Thu, 9 Jul 2015 13:12:10 +0000 (16:12 +0300)] 
Errors served using invalid certificates when dealing with SSL server errors.

When bumping Squid needs to send an Squid-generated error "page" over a
secure connection, Squid needs to generate a certificate for that connection.
Prior to these changes, several scenarios could lead to Squid generating
a certificate that clients could not validate. In those cases, the user would
get a cryptic and misleading browser error instead of a Squid-generated
error page with useful details about the problem.

For example, is a server certificate that is rejected by the certificate
validation helper. Squid no longer uses CN from that certificate to generate
a fake certificate.

Another example is a user accessing an origin server using one of its
"alternative names" and getting a Squid-generated certificate containing just
the server common name (CN).

These changes make sure that certificate for error pages is generated using
SNI (when peeking or staring, if available) or CONNECT host name (including
server-first bumping mode). We now update the ConnStateData::sslCommonName
field (used as CN field for generated certificates) only _after_ the server
certificate is successfully validated.

This is a Measurement Factory project.

8 years agoRemove useless variable in AIODiskIOStrategy::callback() (CID 740585)
Francesco Chemolli [Thu, 9 Jul 2015 10:02:45 +0000 (12:02 +0200)] 
Remove useless variable in AIODiskIOStrategy::callback() (CID 740585)

8 years agoAdd default constructor for StoreRebuildData (CID 740560)
Francesco Chemolli [Thu, 9 Jul 2015 10:00:01 +0000 (12:00 +0200)] 
Add default constructor for StoreRebuildData (CID 740560)

8 years agoProvide default constructor for SharedMemory in DiskdIOStrategy.h (CID 740512)
Francesco Chemolli [Thu, 9 Jul 2015 09:51:56 +0000 (11:51 +0200)] 
Provide default constructor for SharedMemory in DiskdIOStrategy.h (CID 740512)

8 years agoc++-ize unlinkd
Francesco Chemolli [Thu, 9 Jul 2015 09:20:31 +0000 (11:20 +0200)] 
c++-ize unlinkd

8 years agomake dump_peer_options clearer (and address CID 740350)
Francesco Chemolli [Thu, 9 Jul 2015 09:20:27 +0000 (11:20 +0200)] 
make dump_peer_options clearer (and address CID 740350)

8 years agoFix Coverity defect 740327: unchecked library return value in ipc.cc
Francesco Chemolli [Thu, 9 Jul 2015 08:37:36 +0000 (10:37 +0200)] 
Fix Coverity defect 740327: unchecked library return value in ipc.cc

8 years agoFix Coverity defect 740321: unchecked library return value in debug.cc
Francesco Chemolli [Thu, 9 Jul 2015 08:28:20 +0000 (10:28 +0200)] 
Fix Coverity defect 740321: unchecked library return value in debug.cc