]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
9 years agoBoilerplate: update copyright blurbs on src/
Amos Jeffries [Sat, 13 Sep 2014 13:59:43 +0000 (01:59 +1200)] 
Boilerplate: update copyright blurbs on src/

9 years agoBoilerplate: update copyright blurbs on Squid helpers
Amos Jeffries [Sat, 13 Sep 2014 13:31:49 +0000 (01:31 +1200)] 
Boilerplate: update copyright blurbs on Squid helpers

9 years agoBoilerplate: update copyright blurbs for Squid tools
Amos Jeffries [Sat, 13 Sep 2014 13:20:21 +0000 (01:20 +1200)] 
Boilerplate: update copyright blurbs for Squid tools

9 years agoBoilerplate: copyright blurb updates for test-suite
Amos Jeffries [Fri, 12 Sep 2014 23:00:48 +0000 (11:00 +1200)] 
Boilerplate: copyright blurb updates for test-suite

9 years agoFix off by one in snmp subsystem
Sebastian Krahmer [Fri, 12 Sep 2014 22:39:05 +0000 (16:39 -0600)] 
Fix off by one in snmp subsystem

9 years agoSourceFormat Enforcement
Automatic source maintenance [Wed, 3 Sep 2014 00:15:15 +0000 (18:15 -0600)] 
SourceFormat Enforcement

9 years ago%<tt (total server time) is not computed in some cases
Christos Tsantilas [Tue, 2 Sep 2014 14:54:01 +0000 (17:54 +0300)] 
%<tt (total server time) is not computed in some cases

The total server time is not computed for CONNECT requests.
An other example case is when server-first bumping mode is used and squid
connects to SSL peer, but connection terminated before the SSL handshake
completes.

This is a Measurement Factory project

9 years agoBoilerplate: move 'AUTHOR: Guido Serassio' texts
Amos Jeffries [Tue, 2 Sep 2014 14:44:28 +0000 (07:44 -0700)] 
Boilerplate: move 'AUTHOR: Guido Serassio' texts

with permission.

Also, remove some joint authorship claims where all authors have given
permission for the move.

9 years agoSupport receiving PROXY protocol version 1 and 2.
Amos Jeffries [Tue, 2 Sep 2014 13:35:46 +0000 (06:35 -0700)] 
Support receiving PROXY protocol version 1 and 2.

PROXY protocol has been developed by Willy Tarreau of HAProxy for
communicating original src and dst IP:port details between proxies and
load balancers in a protocol-agnostic way.

stunnel, HAProxy and some other HTTP proxying software are already
enabled and by adding support to Squid we can effectively chain these
proxies without having to rely on X-Forwarded-For headers.

This patch adds http_port mode flag (require-proxy-header) to signal the
protocol is in use, parsing and processing logics for the PROXY protocol
headers on new connections, and the proxy_protocol_access control to
manage inbound connections.
 The indirect client security/trust model remains unchanged. As do all
HTTP related logics on the connection once PROXY protocol header has
been received.

Furture Work:
 * support sending PROXY protocol to cache_peers
 * support receiving PROXY protocol on https_port
 * rework the PROXY parse logics as a Parser-NG child parser.

9 years agoFix libsquid-parser.la duplications after trunk merge
Amos Jeffries [Tue, 2 Sep 2014 12:12:07 +0000 (05:12 -0700)] 
Fix libsquid-parser.la duplications after trunk merge

9 years agoRevert AsyncJob::Start() from clientNegotiateSSL()
Amos Jeffries [Tue, 2 Sep 2014 01:49:58 +0000 (18:49 -0700)] 
Revert AsyncJob::Start() from clientNegotiateSSL()

Peek-n-splice code updates made it wrong. The original code should work
now even with PROXY protocol, which is not supported on HTTPS ports
anyway.

9 years agoMerge from trunk
Amos Jeffries [Tue, 2 Sep 2014 01:08:58 +0000 (18:08 -0700)] 
Merge from trunk

9 years agoDocs: Add proxy-protocol.txt latest version
Amos Jeffries [Tue, 2 Sep 2014 00:57:38 +0000 (17:57 -0700)] 
Docs: Add proxy-protocol.txt latest version

9 years agoFixed build by removing the COPYING entry made stale by r13568.
Alex Rousskov [Fri, 29 Aug 2014 19:32:50 +0000 (13:32 -0600)] 
Fixed build by removing the COPYING entry made stale by r13568.

9 years agoBoilerplate: update authorship contributions by Markus Moeller
Amos Jeffries [Fri, 29 Aug 2014 15:12:04 +0000 (08:12 -0700)] 
Boilerplate: update authorship contributions by Markus Moeller

 With permission.

./helpers/negotiate_auth/kerberos/COPYRIGHT
- remove, since it duplicates the Squid top level COPYRIGHT file.

./lib/base64.c
- removing the inaccurate line "AUTHOR: Markus Moeller", since other
  authors (myself at least) have adjusted that code as well.

./src/peer_proxy_negotiate_auth.h
- removing the line: "AUTHOR: Markus Moeller (markus_moeller at
  compuserve.com)"

./src/peer_proxy_negotiate_auth.cc
- removing the "Hosted at" line as inaccurate, the file is hosted in
  Squid repository, launchpad and elsewhere.

- replacing the license blurb with Squid Software Foundation blurb
  (remains GPLv2+).

9 years agoBoilerplate: update copyright blurbs for Basic authentication helpers
Amos Jeffries [Fri, 29 Aug 2014 14:04:29 +0000 (07:04 -0700)] 
Boilerplate: update copyright blurbs for Basic authentication helpers

* added Squid Software Foundation blurbs

* updated CONTRIBUTORS with missing authors

* updated CREDITS with missing licenses

* removed duplicate GPL license in helpers/basic_auth/SMB/COPYING-2.0

* removed obsolete file helpers/basic_auth/MSNT/byteorder.h

9 years agoClose active pconns after their *_port goes away on reconfigure.
Christos Tsantilas [Fri, 29 Aug 2014 06:59:17 +0000 (09:59 +0300)] 
Close active pconns after their *_port goes away on reconfigure.

This change reduces what may be perceived as reconfigure memory leaks
related to *_port options. Before this change, a single persistent
connection could continue to receive new requests (and tie no longer
globally accessible PortCfg-related structures) for hours.

TODO: Close already idle pconns as well.

9 years agoSourceFormat Enforcement
Automatic source maintenance [Fri, 29 Aug 2014 00:14:34 +0000 (18:14 -0600)] 
SourceFormat Enforcement

9 years agoBoilerplate: update copyright blurbs on libmisc* libraries
Amos Jeffries [Thu, 28 Aug 2014 16:10:38 +0000 (09:10 -0700)] 
Boilerplate: update copyright blurbs on libmisc* libraries

* add Squid Software Foundation blurbs

* update CONTRIBUTORS with missing authors

* update CREDITS to match current reality

9 years agoBoilerplate: update copyright blurbs on lib/snmplib
Amos Jeffries [Thu, 28 Aug 2014 15:10:54 +0000 (08:10 -0700)] 
Boilerplate: update copyright blurbs on lib/snmplib

* Add Squid Software Foundation blurbs

* update CREDITS to meet Carnegie Mellon license requirements

9 years agoBoilerplate: update copyright blurb for lib/smblib
Amos Jeffries [Thu, 28 Aug 2014 14:44:55 +0000 (07:44 -0700)] 
Boilerplate: update copyright blurb for lib/smblib

* Add Squid Software Foundation blurbs

* update CONTRIBUTORS with missing authors (third-party)

* update CREDITS with missing lib/smblib details
 - also some missing lib/rfcnb details

9 years agoBoilerplate: update copyright blurbs on lib/librfcnb
Amos Jeffries [Thu, 28 Aug 2014 05:07:21 +0000 (22:07 -0700)] 
Boilerplate: update copyright blurbs on lib/librfcnb

* Add Squid Software Foundation blurb

* Update CONTRIBUTORS with missing authors

* Update CREDITS with missing license blurb

9 years agoBoilerplate: update copyright blurbs for libprofiler
Amos Jeffries [Thu, 28 Aug 2014 04:52:01 +0000 (21:52 -0700)] 
Boilerplate: update copyright blurbs for libprofiler

9 years agoBoilerplate: update copyright blurbs on libntlmauth
Amos Jeffries [Thu, 28 Aug 2014 04:45:04 +0000 (21:45 -0700)] 
Boilerplate: update copyright blurbs on libntlmauth

9 years agoSourceFormat Enforcement
Automatic source maintenance [Thu, 28 Aug 2014 00:14:08 +0000 (18:14 -0600)] 
SourceFormat Enforcement

9 years agoPrep for 3.4.7 and 3.3.13
Amos Jeffries [Wed, 27 Aug 2014 14:08:10 +0000 (07:08 -0700)] 
Prep for 3.4.7 and 3.3.13

9 years agoSSL Peek and Splice
Christos Tsantilas [Wed, 27 Aug 2014 08:05:25 +0000 (11:05 +0300)] 
SSL Peek and Splice

The goal of this patch is to make SSL bumping decision after the origin server
name is known.

Peek and Splice peeks at the SSL client Hello message and SNI info if any
(bumping step 1), sends identical or a similar Hello message to the SSL server
 and peeks at the SSL server Hello message (bumping step 2), and finally
decides to proceed with splicing or bumping the connection (bumping step 3).

After the step 1 bumping step completes the SNI information is available and
after the step 2 bumping step completes the server certificate is available.

The ssl_bump access list evaluated on every bumping step to select the bumping
mode to use. The new acl "at_step" can be used to match the current bumping
step.

In most cases:
 - if the user select "peek" bumping mode at step2 then at step3 can select
   one of the "splice" or "terminate" modes.
 - If the user select "stare" bumping mode at step2 then at step 3 can select
   one of the "bump" or "terminate" modes.

If the squid built with the SQUID_USE_OPENSSL_HELLO_OVERWRITE_HACK and the
client uses openSSL library similar to the library used by squid then bumping
is possible after "peek" bumping mode selection and "splice" after "stare"
bumping mode selection.

The bump, terminate and splice are final decisions.

Example configurations:

acl step1 at_step  SslBump1
acl step2 at_step  SslBump2
acl step3 at_step  SslBump3

ssl_bump peek step1 all
ssl_bump splice step2 BANKS
ssl_bump peek step2 all
ssl_bump terminate step3 BLACKLIST
ssl_bump splice step3 all

This is a Measurement Factory project

9 years agomerge from trunk
Christos Tsantilas [Wed, 27 Aug 2014 07:38:09 +0000 (10:38 +0300)] 
merge from trunk

9 years agoIgnore Range headers with unidentifiable byte-range values
Amos Jeffries [Tue, 26 Aug 2014 15:48:43 +0000 (08:48 -0700)] 
Ignore Range headers with unidentifiable byte-range values

If squid is unable to determine the byte value for ranges, treat the
header as invalid.

9 years agomerge from trunk
Christos Tsantilas [Tue, 26 Aug 2014 09:01:27 +0000 (12:01 +0300)] 
merge from trunk

9 years agoFixes and polishing in response to Amos' squid-dev review dated 2014/08/19
Christos Tsantilas [Tue, 26 Aug 2014 08:21:27 +0000 (11:21 +0300)] 
Fixes and polishing in response to Amos' squid-dev review dated 2014/08/19

- Polishing changes
- Move src/acl/AtBumpStep*.[cc,h] files to src/acl/AtStep*.[cc,h]
- Convert Ssl::Bio::sslFeatures::serverName,
  Ssl::Bio::sslFeatures::HelloMesssage and Ssl::ServerBio::helloMsg members
  to SBuf

9 years agoBoilerplate: update copyright blurbs on lib/libTrie
Amos Jeffries [Tue, 26 Aug 2014 04:11:40 +0000 (21:11 -0700)] 
Boilerplate: update copyright blurbs on lib/libTrie

* add Squid Software Foundation blurb

* merged AUTHORS file content to CONTRIBUTORS.

* removed duplicate COPYING file. Squid main COPYING is newer and the
  library is no longer a standalone object.

* remvoed empty NEWS, README, Changelog files

* removed obsolete INSTALL file.
  - It documents the previously removed libTrie/configure.ac script.

9 years agoBoilerplate: update acinclude/ and configure.ac copyrights
Amos Jeffries [Tue, 26 Aug 2014 02:39:30 +0000 (19:39 -0700)] 
Boilerplate: update acinclude/ and configure.ac copyrights

* update CONTRIBUTORS with missing contributors

* update CREDITS with missing copyright licenses
 - remove outdated Treehouse Networks license on rfc3596.h rfc3596.cc
 - shuffle some entries for easier reading. Alphabetical by first source
   file path.

* split AX_WITH_PROG() macro into its own source file to clarify the
  license scope. It is provided as a standalone file by the author(s).

9 years agoBoilerplate: update authorship claims
Amos Jeffries [Tue, 26 Aug 2014 01:58:27 +0000 (18:58 -0700)] 
Boilerplate: update authorship claims

* Robert Collins actually gave permission to update a long time back.

* Duane Wessels permission to update now granted.

* UCSD authorship claims being left in place with CREDITS entry.

9 years agoBoilerplate: update copyright licenses on include/ sources
Amos Jeffries [Mon, 25 Aug 2014 15:47:04 +0000 (08:47 -0700)] 
Boilerplate: update copyright licenses on include/ sources

* add Squid Software Foundation blurb

* update CONTRIBUTORS with missing authors

* update CREDITS with missing license and copyright statements

 It looks a bit messy, but Carnegie Mellon Univeristy license requires
 that several very similar but unique copyright and license blurbs be
 documented unabreviated.

9 years agoBoilerplate: update copyright on compat/ library sources
Amos Jeffries [Mon, 25 Aug 2014 14:08:02 +0000 (07:08 -0700)] 
Boilerplate: update copyright on compat/ library sources

* add Squid Software Foundation boilerplate

* update CONTRIBUTORS with authors not already mentioned.

* update CREDITS with missing licenses.

9 years agoBoilerplate: make script quieter when re-scanning files
Amos Jeffries [Mon, 25 Aug 2014 14:01:56 +0000 (07:01 -0700)] 
Boilerplate: make script quieter when re-scanning files

When the copyright blurb is up to date we do not need to display the
entire file. Add a subfunction to only display the message, not file.

Also, note more claimants we need to contact about authorship claims.

9 years agoRelease Notes: add notice explaining copyright changes
Amos Jeffries [Mon, 25 Aug 2014 12:08:20 +0000 (05:08 -0700)] 
Release Notes: add notice explaining copyright changes

9 years agoBoilerplate copyright/license adjustment preparation
The Squid Software Foundation [Mon, 25 Aug 2014 11:25:54 +0000 (04:25 -0700)] 
Boilerplate copyright/license adjustment preparation

Squid-3 is now being administered by the Squid Software Foundation,
a non-profit organisation created for the purpose of providing
governance and representation for the Squid Project and community
of contributors.
  http://www.squid-cache.org/Foundation/

As such the Squid source code collection is being prefixed with a
new copyright blurb:

 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
 *
 * Squid software is distributed under GPLv2+ license and includes
 * contributions from numerous individuals and organizations.
 * Please see the COPYING and CONTRIBUTORS files for details.

Existing copyright claims on specific source code files are being
preserved in-situ following this collection blurb.

With some exceptions where existing copyright owners have explicitly
given permission for their specific claim statements to be moved to
the CONTRIBUTORS file and assist removal of the inconsistent and
now often incorrect Harvest and Squid Project blurb(s).

This patch publishes the script and boilerplate text used to perform
this change of copyright marking for public review.

Also, adds some administrative polishing in preparation for the
blurb adjustments.

  This is a Squid Software Foundation project.

9 years agoCleanup: remove SQUID_NO_STRING_BUFFER_PROTECT and SQUID_UNIT_TEST macros
Amos Jeffries [Mon, 25 Aug 2014 04:53:57 +0000 (21:53 -0700)] 
Cleanup: remove SQUID_NO_STRING_BUFFER_PROTECT and SQUID_UNIT_TEST macros

These macros were used solely to prevent cppunit and operating system
includes from generating build errors and warnings via Squid protection
from unsafe use of sprintf, strdup and other allocator and string
functions.

The protection against these functions has long ago been move to
source-maintenance script instead of runtime checking. Making these
macros obsolete.

9 years agoRemove Robert Collins and UCLA from claimsOkayToMove
Amos Jeffries [Mon, 25 Aug 2014 04:22:47 +0000 (21:22 -0700)] 
Remove Robert Collins and UCLA from claimsOkayToMove

We are still awaiting on confirmed approval to move these. They can be
added later and sources re-scanned when that arrives.

9 years agoUpdate Squid Software Foundation blurb dates
Amos Jeffries [Mon, 25 Aug 2014 04:20:56 +0000 (21:20 -0700)] 
Update Squid Software Foundation blurb dates

9 years agoCleanup: remove goto from Vary: header failure recovery
Amos Jeffries [Sat, 23 Aug 2014 12:04:16 +0000 (05:04 -0700)] 
Cleanup: remove goto from Vary: header failure recovery

9 years agoCleanup: remove goto from logformat token parser
Amos Jeffries [Sat, 23 Aug 2014 11:17:32 +0000 (04:17 -0700)] 
Cleanup: remove goto from logformat token parser

9 years agoCleanup: remove goto from clientProcessRequest()
Amos Jeffries [Sat, 23 Aug 2014 11:05:40 +0000 (04:05 -0700)] 
Cleanup: remove goto from clientProcessRequest()

The code path can be better statically analysed without goto statements.

Bonus side effect is that several cases of checking for cleanup code can
be removed entirely.

9 years agoSync with trunk rev.13542
Amos Jeffries [Sat, 23 Aug 2014 10:39:15 +0000 (03:39 -0700)] 
Sync with trunk rev.13542

9 years agoFix 'Could not find krb5-config in path' on OS without krb5
Amos Jeffries [Fri, 22 Aug 2014 14:13:55 +0000 (07:13 -0700)] 
Fix 'Could not find krb5-config in path' on OS without krb5

9 years agoPortability: disable krb5-config use when cross-compiling
Amos Jeffries [Fri, 22 Aug 2014 12:48:40 +0000 (05:48 -0700)] 
Portability: disable krb5-config use when cross-compiling

krb5-config detection does not support cross-compiling or multiple krb5
library installations properly.

pkg-config is supported by recent releases of the popular krb5 libraries
and supports cross-compile properly and complicated build environments
much better. Trust its results when cross-compiling.

9 years agoSourceFormat Enforcement
Automatic source maintenance [Fri, 22 Aug 2014 00:16:29 +0000 (18:16 -0600)] 
SourceFormat Enforcement

9 years agoDocs: update release notes and configure --help after Kerberos update
Amos Jeffries [Thu, 21 Aug 2014 18:11:23 +0000 (11:11 -0700)] 
Docs: update release notes and configure --help after Kerberos update

Add release notes for the ./configure option changes in rev.13538.

Also, adjust ./configure --help display text to match the option
behaviour:
 * --with is default action, so --without gets documented.
 * --without does not accept path, and --with-foo=PATH is available on
   all library options. So remove repeated text.

9 years agoKerberos ./configure updates and LDAP group helper membership
Markus Moeller [Thu, 21 Aug 2014 17:36:49 +0000 (10:36 -0700)] 
Kerberos ./configure updates and LDAP group helper membership

Rewrite the configure.ac and cleans up some code in the kerberos auth
and kerberos ldap helper.

Additionally the kerberos ldap helper checks now for AD primary group
membership too.

9 years agoDo not leak fake SSL certificate context cache when reconfigure
Alex Rousskov [Thu, 21 Aug 2014 00:29:33 +0000 (18:29 -0600)] 
Do not leak fake SSL certificate context cache when reconfigure
changes port addresses.

We believe that deleting a cached LocalContextStorage object does not actually
affect connections that use the corresponding SSL_CTX and certificate because
any SSL object using those things increments their sharing counter and
deleting LocalContextStorage only decrements that counter. The [cached]
SSL_CTX object is not destroyed by SSL_CTX_free until that sharing counter
reaches zero.

9 years agoSourceFormat Enforcement
Automatic source maintenance [Wed, 20 Aug 2014 00:14:39 +0000 (18:14 -0600)] 
SourceFormat Enforcement

9 years agoDo not assert on native FTP ERR_TOO_BIG. Do not check for ERR_TOO_BIG twice.
Alex Rousskov [Tue, 19 Aug 2014 18:09:50 +0000 (12:09 -0600)] 
Do not assert on native FTP ERR_TOO_BIG. Do not check for ERR_TOO_BIG twice.

The assertion occurred because both the FTP request parser and the generic
ConnStateData::checkHeaderLimits() code would try to write their own error
message to the user. Reworked all error reporting code in the FTP parser to
avoid writing early responses (that were bypassing the overall transaction
flow with various negative side effects such as lack of logging).

Removed ConnStateData::checkHeaderLimits(): We already have protocol-specific
checks for huge HTTP and FTP requests. There is no point in duplicating them.
Centralizing them sounds like a good idea, but a general checkHeaderLimits()
cannot produce protocol-specific errors messages that we need, so it hurts
more than it helps. Moreover, checkHeaderLimits() was handling errors
differently than protocol parsing code, making the code more complex overall.

All that remains from the checkHeaderLimits() code now is a single Must(),
checking that the protocol parsers did what they were supposed to do: Return
NULL to request more data after checking any applicable limits. If parsers do
not (a Squid bug!), the ConnStateData job gets killed (and connection gets
closed) as the last resort.

Added clientReplyContext::setReplyToReply() and
StoreEntry::storeErrorResponse() to handle storing of a response to an FTP
command parsing error. The old code was using ErrorState to store parsing
errors, but ErrorState is still HTTP-specific and cannot relay the right FTP
codes/reasons to the user. The setReplyToReply() sounds silly but it matches
the existing setReplyTo*() naming scheme well.

Make sure parsed native FTP command tokens are not even close to the String
buffer limit. These checks are not a firm guarantee, but are better than
nothing until we replace String.

Handle ClientSocketContext registration centrally because all parsers need it.

Call quitAfterError() on fatal native FTP errors. Probably not necessary due
to fssError handling code that closes the FTP control connection, but adds
helpful debugging and brings us closer to the HTTP error handling code.

Described ConnStateData::clientParseRequests().

9 years agoMerge from trunk rev.13534
Amos Jeffries [Tue, 19 Aug 2014 09:38:19 +0000 (02:38 -0700)] 
Merge from trunk rev.13534

9 years agoUse memcpy instead of cast for PROXY/2.0 field reading
Amos Jeffries [Tue, 19 Aug 2014 09:34:48 +0000 (02:34 -0700)] 
Use memcpy instead of cast for PROXY/2.0 field reading

ARM processors require 16-bit alignment, which we cannot guarantee on
the raw I/O buffer octets. memcpy() resolves that.

9 years agoPortability: remove short macro MB
Amos Jeffries [Mon, 18 Aug 2014 13:35:08 +0000 (06:35 -0700)] 
Portability: remove short macro MB

Very short macros have an increased liklihood of clashing with system
definitions of other symbols. In this case with a typedef in MinGW.

As the MB macro was limited to use in MemPool.* simply inline its
definition.

9 years agoauthor: Alex Rousskov <rousskov@measurement-factory.com>
Christos Tsantilas [Thu, 14 Aug 2014 08:54:49 +0000 (11:54 +0300)] 
author: Alex Rousskov <rousskov@measurement-factory.com>
Use v3 for fake certificate if we add _any_ certificate extension.

We used to force v3 version only when adding the subjectAltName extension.
That broke sites that did not have subjectAltName but used other mimicked x509
extensions, when accessed through Firefox 31 (at least):
https://bugzilla.mozilla.org/show_bug.cgi?id=1045973

9 years agoRearrange PROXY/1.0 parser
Amos Jeffries [Wed, 13 Aug 2014 14:35:32 +0000 (07:35 -0700)] 
Rearrange PROXY/1.0 parser

Add a first pass to confirm LF line terminator and wait for more bytes if
missing.

9 years agoPolish Peek and Splice
Christos Tsantilas [Wed, 13 Aug 2014 11:14:51 +0000 (14:14 +0300)] 
Polish Peek and Splice

 - Fix debugs ( Remove HERE macro, other minor changes)
 - Formating changes

9 years agoFix build errors after trunk merge
Amos Jeffries [Wed, 13 Aug 2014 10:01:59 +0000 (03:01 -0700)] 
Fix build errors after trunk merge

9 years agoMerge from trunk rev.13532
Amos Jeffries [Tue, 12 Aug 2014 15:57:20 +0000 (08:57 -0700)] 
Merge from trunk rev.13532

9 years agoFix unwrapped adaptation code in rev.13528
Amos Jeffries [Tue, 12 Aug 2014 13:06:21 +0000 (06:06 -0700)] 
Fix unwrapped adaptation code in rev.13528

9 years agoPerformance optimizations and polish
Amos Jeffries [Tue, 12 Aug 2014 05:24:05 +0000 (22:24 -0700)] 
Performance optimizations and polish

9 years agoSourceFormat Enforcement
Automatic source maintenance [Tue, 12 Aug 2014 00:14:56 +0000 (18:14 -0600)] 
SourceFormat Enforcement

9 years agoDocs: audit updates
Amos Jeffries [Mon, 11 Aug 2014 17:39:56 +0000 (10:39 -0700)] 
Docs: audit updates

9 years agoDocs: Revert follow_x_forwarded_for default description
Amos Jeffries [Mon, 11 Aug 2014 17:31:44 +0000 (10:31 -0700)] 
Docs: Revert follow_x_forwarded_for default description

9 years agoFixed reporting of malformed -n values on the command line.
Alex Rousskov [Mon, 11 Aug 2014 17:29:47 +0000 (11:29 -0600)] 
Fixed reporting of malformed -n values on the command line.

Test case: $ squid -n ' '
FATAL: Expected alphanumeric service name for the -n option but got: squid

9 years agoActually disable TPROXY spoofing when PROXY protocol is used
Amos Jeffries [Mon, 11 Aug 2014 17:28:59 +0000 (10:28 -0700)] 
Actually disable TPROXY spoofing when PROXY protocol is used

Also, hide the TPROXY disable warning when TPROXY not used.

9 years agoFixed Parser::Tokenizer::prefix() to return false on all empty prefixes.
Alex Rousskov [Mon, 11 Aug 2014 17:14:15 +0000 (11:14 -0600)] 
Fixed Parser::Tokenizer::prefix() to return false on all empty prefixes.

The code was returning true and sometimes even setting the returnedToken
to a non-empty string when no permitted tokenChars were found.

Added unit test cases to catch similar bugs in the future.

9 years agorun formatter
Christos Tsantilas [Mon, 11 Aug 2014 16:50:47 +0000 (19:50 +0300)] 
run formatter

9 years agopolish peek-and-splice
Christos Tsantilas [Mon, 11 Aug 2014 16:46:52 +0000 (19:46 +0300)] 
polish peek-and-splice

 - Remove any references to "bumpErr" bumping mode. It is not implemented
 - Changes to allow make without openssl, "make dist" and "make distcheck"
 - Fix peek-and-splice documentation: The bumping modes are SslBump1, SslBump2 a
nd SslBump3
 - Other minor changes

9 years agoInitial native FTP Relay support.
Alex Rousskov [Mon, 11 Aug 2014 16:09:06 +0000 (10:09 -0600)] 
Initial native FTP Relay support.

* Added ftp_port directive telling Squid to relay native FTP commands.
* Active and passive FTP support on the user-facing side;
  require passive connections to come from the control connection src IP.
* IPv6 support (EPSV and, on the user-facing side, EPRT).
* Intelligent adaptation of relayed FTP FEAT responses.
* Relaying of multi-line FTP control responses using various formats.
* Support relaying of FTP MLSD and MLST commands (RFC 3659).
* Several Microsoft FTP server compatibility features.
* ICAP/eCAP support (at individual FTP command/response level).
* Optional "current FTP directory" tracking (cannot be 100% reliable due to
  symbolic links and such, but is helpful in some common use cases).
* FTP origin control connection is pinned to the FTP user connection.
* No caching support -- no reliable Request URIs for that (see above).
* Significant FTP code restructuring on the server-facing side.
* Initial steps towards HTTP code restructuring on the client-facing side.

See merged revisions commit log for details.

9 years agoFixes and polishing in response to Amos' squid-dev review dated 2014/08/10.
Alex Rousskov [Sun, 10 Aug 2014 23:18:33 +0000 (17:18 -0600)] 
Fixes and polishing in response to Amos' squid-dev review dated 2014/08/10.

Fixed handling of FTP commands terminated with LF instead of CRLF (regression
introduced during migration to Tokenizer in r12812).

Many polishing touches.

9 years agoChanges in response to Amos' squid-dev review dated 2014/08/08.
Alex Rousskov [Sun, 10 Aug 2014 02:30:47 +0000 (20:30 -0600)] 
Changes in response to Amos' squid-dev review dated 2014/08/08.

See inner commit messages for details.

9 years agoPolishing in response to Amos' squid-dev review dated 2014/08/08.
Alex Rousskov [Sun, 10 Aug 2014 02:28:33 +0000 (20:28 -0600)] 
Polishing in response to Amos' squid-dev review dated 2014/08/08.

The PASS value masking code in HttpHeader::packInto() is currently unused
because Squid does not (and cannot) use errorpages for native FTP errors.

It is [still] possible to configure ftp_port with transport=HTTP but it is
not clear what the exact effects of that configuration are, if any.

The ftp_port ftp-track-dirs option no longer accepts on|off values. Off is
still the default. Turn on using a valueless "ftp-track-dirs" option.

Other minor polishing touches.

9 years agoCentralized and documented FTP protocol "version" (1.1) definition.
Alex Rousskov [Sat, 9 Aug 2014 00:35:28 +0000 (18:35 -0600)] 
Centralized and documented FTP protocol "version" (1.1) definition.

Moved AnyP::PortCfg::setTransport() to the cache_cf.cc parsing code where it
currently belongs. AnyP code should not have protocol-specific pieces as it is
code shared among (or used by) many (ideally, all transfer) protocols.

TODO: Convert Http::ProtocolVersion from class into a function.

9 years agoFix bugs and polish peek-and-splice
Christos Tsantilas [Fri, 8 Aug 2014 16:05:07 +0000 (19:05 +0300)] 
Fix bugs and polish peek-and-splice

This patch:
  - Add test in configure script to check if OpenSSL hacks can be supported.
    These tests enable the SQUID_USE_OPENSSL_HELLO_OVERWRITE_HACK in autoconf.h
  - Fixes peek-and splice related documentation , the step1, step2, step3 names
    now used instead of the SslBump[1,2,3] as bumping steps
  - Many fixes in bio subsystem:
     * investigate the Ssl::Bio::sslFeatures::applyToSSL method to configure
       and SSL object the features included in sslFeatures object
     * rename Ssl::ClientBio::headerState to Ssl::ClientBio::helloState
     * rename Ssl::ClientBio::headerSize to Ssl::ClientBio::helloSize
     * investigate the Ssl::ClientBio::HelloReadState enum to describe
       the ssl hello message read state
     * Ssl::ServerBio::write should return the size of the data the openSSL
       ask from us to write to server, else it abort SSL connection with error
     * Do not overwrite openSSL SSL object with client hello on Peek mode if
       we can not support web client SSL features. This is causes problems
       and openSSL may abort the connection with error.
       The adjustSSL function does not need the "force" parameter any more.
     * If SQUID_USE_OPENSSL_HELLO_OVERWRITE_HACK is not defined adjustSSL
       return always false.
     * document bio related classes
  - TunnelStateData::logTag_ptr:
      * try to set TunnelStateData::logTag_ptr when peek and splice mode is used
      * the TunnelStateData::logTag_ptr is not initialized in constructure
      * Do not use TunnelStateData::logTag_ptr if it is not defined for a reason
  - Try to set delay pools settings inside switchToTunnel when peek-and-splice
    mode is used
  - Remove unsused code inside switchToTunnel method (tunnel.cc file)
  - Other minor changes

9 years agoBug 4093: source-maintenance.sh bad perl -i option
Alex Rousskov [Fri, 8 Aug 2014 11:52:58 +0000 (05:52 -0600)] 
Bug 4093: source-maintenance.sh bad perl -i option

9 years agoSourceFormat Enforcement
Alex Rousskov [Fri, 8 Aug 2014 03:07:03 +0000 (21:07 -0600)] 
SourceFormat Enforcement

9 years agoFixed HttpHdr::Private/NoCache(v) implementations and optimized their API.
Alex Rousskov [Thu, 7 Aug 2014 22:33:48 +0000 (16:33 -0600)] 
Fixed HttpHdr::Private/NoCache(v) implementations and optimized their API.

These calls now avoid assertions and extra trailing commas when called with
empty names. The API now allows calling with a String() object, but still
needs more polishing work.

Moved common code from Ftp::Server::setReply and Ftp::Relay::createHttpReply()
into Ftp::HttpReplyWrapper().

Also removed the last non-job callbak from Ftp::Client, polished and synced
new FTP comments with the modern client/server/gateway/relay terminology, as
well as minimized changes compared to trunk.

9 years agoConverted some of the new FTP code to use SBuf and Tokenizer
Alex Rousskov [Thu, 7 Aug 2014 17:31:05 +0000 (11:31 -0600)] 
Converted some of the new FTP code to use SBuf and Tokenizer
instead of MemBuf, String, and c-string manipulations.

9 years agoTokenizer fixes and API improvements.
Alex Rousskov [Thu, 7 Aug 2014 17:26:03 +0000 (11:26 -0600)] 
Tokenizer fixes and API improvements.

Taught Tokenizer to keep track of the number of parsed bytes. Many callers
need to know that because they need to adjust/consume I/O offsets/buffers.

Adjusted unused Parser::Tokenizer::token() to not treat NUL delimiter
specially. Besides the fact that not all grammars can treat NUL that way, the
special NUL treatment resulted in some token() calls returning true for empty
tokens, which was confusing parsers. Callers that do not require trailing
delimiters, should use prefix() instead. This change is based on experience
writing Tokenizer-based FTP parser, although the final parser code uses
prefix() instead of token(), for unrelated reasons.

Split Parser::Tokenizer::skip(set) into skipOne() and skipAll(). All other
skip() methods skip exactly one thing (either a given character or a given
token) but the old skip(set) method was skipping multiple things. That
confused callers. We now force the caller to make a choice.

Fixed Parser::Tokenizer::skip(char) to avoid out of bound access.

9 years agoAdded CharacterSet::complement() to create "all except those in that set" sets
Alex Rousskov [Thu, 7 Aug 2014 17:20:27 +0000 (11:20 -0600)] 
Added CharacterSet::complement() to create "all except those in that set" sets
handy for parsing (e.g., "get all characters until the end of line").

Added CharacterSet::rename() to label sets. Handy in const declarations that
use expressions. For example: const CharacterSet AB = (A+B).renamed("AB").

9 years agoDo not allow SBuf::toLower/toUpper() return a value.
Alex Rousskov [Thu, 7 Aug 2014 17:13:26 +0000 (11:13 -0600)] 
Do not allow SBuf::toLower/toUpper() return a value.

Some callers think toLower() method changes the string and some think it
returns a changed value without changing the string. Without unportable hacks
like __attribute__((warn_unused_result)), some of the callers will guess wrong
and not know about it. It is easier/safer to change the object itself and
return nothing.

Provided ToUpper/ToLower() functions (not methods!) that preserve their
paramter and return a new object for callers that need the old functionality.
These functions are a good candidate for __attribute__ hacks.

9 years agomerge from trunk r13526
Christos Tsantilas [Wed, 6 Aug 2014 10:26:14 +0000 (13:26 +0300)] 
merge from trunk r13526

9 years agoPolished for the official review, addressing several TODOs.
Alex Rousskov [Tue, 5 Aug 2014 22:44:23 +0000 (16:44 -0600)] 
Polished for the official review, addressing several TODOs.

Use 1.1 version for FTP ports because FTP commands are sent on a
"persistent by default" connection, just like HTTP/1.1.

Cleaned up Ftp::CtrlChannel, Ftp::DataChannel, and Ftp::Client object
construction and destruction.

Do not insist on USER command when intercepting FTP. Interception support
may still not work for other reasons, but USER does not seem to be required
since Squid gets request destination from the intercepted connection info.

9 years agoMerge from trunk rev.13526
Amos Jeffries [Tue, 5 Aug 2014 15:24:33 +0000 (08:24 -0700)] 
Merge from trunk rev.13526

9 years agoUpdated configuration options
Amos Jeffries [Tue, 5 Aug 2014 14:39:35 +0000 (07:39 -0700)] 
Updated configuration options

* Replace proxy-surrogate fag with require-proxy-header

* Revert follow_x_forwarded_for linkage with PROXY protocol.
  Add proxy_protocol_access directive for PROXY ACLs instead.

* set fast default for proxy_protocol_access when none configured.

9 years agoPeek and Splice: %ssl::<cert_subject and %ssl::<cert_issuer formating codes to e
Christos Tsantilas [Tue, 5 Aug 2014 14:27:34 +0000 (17:27 +0300)] 
Peek and Splice: %ssl::<cert_subject and %ssl::<cert_issuer formating codes to e
xternal_acl

This patch investigates the %ssl::<cert_subject and %ssl::<cert_issuer
formating codes to external_acl helpers.
 * The %ssl::<cert_subject formating code prints the server certificate DN
 * The %ssl::<cert_issuer formating code prints the server certificate issuer DN

Both formating codes are available after the ssl bumped connection is
established.
When Peek and Splice mode is selected these formating codes are available on
peek or stare mode, after the step2 is comleted and server certificate is
received.

9 years agopeek-and-splice: Fix stare mode
Christos Tsantilas [Tue, 5 Aug 2014 10:41:26 +0000 (13:41 +0300)] 
peek-and-splice: Fix stare mode

- For peek mode we need to always forward client hello message
- For stare mode we must forward client hello message only if we can mimic
  all of the client SSL features, else we should sent a new SSL hello message.

9 years agoDone moving FTP code around. Polished moved code to match new locations.
Alex Rousskov [Tue, 5 Aug 2014 00:17:16 +0000 (18:17 -0600)] 
Done moving FTP code around. Polished moved code to match new locations.

src/clients/FtpNative is now src/clients/FtpRelay. It was awkward to use a
non-noun "Native" as a class name, and the class was already described as
"relaying FTP".

9 years agoMajor source layout change: Moved FTP code into servers/, clients/, and ftp/.
Alex Rousskov [Mon, 4 Aug 2014 21:44:31 +0000 (15:44 -0600)] 
Major source layout change: Moved FTP code into servers/, clients/, and ftp/.

  src/servers/FtpServer.*   # new FTP server, relaying FTP
  src/servers/HttpServer.*  # old ConnStateData parts conflicting w/ FtpServer
  src/clients/FtpClient.*   # code shared by old and new FTP clients
  src/clients/FtpGateway.*  # old FTP client, translating back to HTTP
  src/clients/FtpNative.*   # new FTP client, relaying FTP
  src/ftp/*                 # FTP stuff shared by clients and servers

This change attempts to preserve code in moved files to the extent possible:
Only copied or added code was polished. Future changes will polish moved code.

Unfortunately, bzr does not track code changes across file splits, so the code
moved from ConnStateData (client_side.cc) into HttpServer and FtpServer
classes appears as removed and added in bzr diff. If you want to see the
branch log for the FtpServer or HttpServer code added in this revision, look
in the previous branch revision of client_side.cc.

9 years agoFixed (missing DOC_END) and polished ftp_port documentation.
Alex Rousskov [Mon, 4 Aug 2014 21:23:25 +0000 (15:23 -0600)] 
Fixed (missing DOC_END) and polished ftp_port documentation.

9 years agoDocs: update release notes after rev.13524
Amos Jeffries [Sat, 2 Aug 2014 14:03:21 +0000 (07:03 -0700)] 
Docs: update release notes after rev.13524

9 years agoDocs: cleanup obsolete directive listings
Amos Jeffries [Sat, 2 Aug 2014 13:45:47 +0000 (06:45 -0700)] 
Docs: cleanup obsolete directive listings

9 years agoRemove hierarchy_stoplist in favour of always_direct
Amos Jeffries [Sat, 2 Aug 2014 13:01:28 +0000 (06:01 -0700)] 
Remove hierarchy_stoplist in favour of always_direct

This directive was deprecated 2 years (and versions) ago. It can be
replaced with:
  acl stoplist url_regex cgi-bin|\?
  always_direct allow stoplist

The major difference between the two configurations is that the old
hierarchy_stoplist was applied after never_direct and always_direct is
applied before it. Both override the never_direct result, so this is not
a problem.

9 years agoPeek and Splice: Bug fixes
Christos Tsantilas [Fri, 1 Aug 2014 16:03:37 +0000 (19:03 +0300)] 
Peek and Splice: Bug fixes

 - Initialize Ssl::ServerBio::bumpMode_ member in constructor
 - While we are checking ssl_bump access list the Stare mode is never selected

9 years agoFix reconfiguration leaks: objects tied to http_port part1
Christos Tsantilas [Thu, 31 Jul 2014 14:02:20 +0000 (17:02 +0300)] 
Fix reconfiguration leaks: objects tied to http_port part1

This patch cleans up forgotten(?) clientca and crlfile PortCfg members.

Note:
   PortCfg objects are still leaking so this change alone is not enough

9 years agoDocs: correct Proxy-Support code comment
Amos Jeffries [Thu, 31 Jul 2014 08:54:46 +0000 (01:54 -0700)] 
Docs: correct Proxy-Support code comment