]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
12 years agoMerged from trunk
Amos Jeffries [Tue, 27 Nov 2012 21:31:35 +0000 (10:31 +1300)] 
Merged from trunk

12 years agoAudit Review updates
Amos Jeffries [Tue, 27 Nov 2012 21:19:46 +0000 (10:19 +1300)] 
Audit Review updates

* guarantee that note values output by the HelperReply parser are ""
  nil-terminated string and not undefined String.
* rename HelperReply::responseKeys to 'notes'
* rename Notes::findByName() to find()
* add Note::firstValue() to locate first value provided for a given key
  and present it as a char* terminated string
* various documentation updates

12 years agoTreat no-cache and must-revalidate in Authentication
Amos Jeffries [Tue, 27 Nov 2012 10:57:12 +0000 (23:57 +1300)] 
Treat no-cache and must-revalidate in Authentication

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

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

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

12 years agoMake it possible to match empty header field values using req_header and rep_header.
Alex Rousskov [Mon, 26 Nov 2012 18:54:43 +0000 (11:54 -0700)] 
Make it possible to match empty header field values using req_header and rep_header.

Warning: Some req_header and rep_header ACLs that were [accidentally] not
matching empty headers (e.g., "^$" or ".*") will now start matching them.

A new HttpHeader::getByNameIfPresent() method is added to be able to detect
presence of empty header fields while ACLHTTPHeaderData::match() is adjusted
to convert undefined String values into empty c-strings ("") for
ACLRegexData::match() to work.

Prior to these changes, when trying to match an empty header value with a
regex like "^$", ACLHTTPHeaderData::match() would return false because:

  * HttpHeader::getStrOrList() and getByName() return an undefined String.
  * String::termedBuf() returns NULL for undefined Strings; and
  * ACLRegexData::match() always fails on NULL c-strings.

12 years agoBug 3685: Squid hangs in ClassCBucket::update
Amos Jeffries [Mon, 26 Nov 2012 11:13:08 +0000 (04:13 -0700)] 
Bug 3685: Squid hangs in ClassCBucket::update

12 years agoFix helper reply length detection
Amos Jeffries [Sat, 24 Nov 2012 14:30:02 +0000 (03:30 +1300)] 
Fix helper reply length detection

Stateless helper reply handler was incrementing 't' position before
passing the details of response length to HelperReply parser.

Stateful helper reply handler was pointing at position of \n insteaf of
position of \r when \r\n received.

Both of these cause the response length parameter sent to the reply
parser to be longer than the actual response characters length. Breaking
parse on responses with just result code followed by \n since the string
comparison EOL is now tested against input length 2/3/4.

12 years agoMerged from trunk
Amos Jeffries [Fri, 23 Nov 2012 12:53:57 +0000 (01:53 +1300)] 
Merged from trunk

12 years agolibeui: Warn and fail nicely on socket errors looking up ARP record
Amos Jeffries [Wed, 21 Nov 2012 11:18:46 +0000 (04:18 -0700)] 
libeui: Warn and fail nicely on socket errors looking up ARP record

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

 Detected by Coverity Scan. Issue 740393

12 years agoFix ESIInclude constructor after rev.12482
Amos Jeffries [Tue, 20 Nov 2012 11:03:08 +0000 (00:03 +1300)] 
Fix ESIInclude constructor after rev.12482

12 years agoSourceFormat Enforcement
Automatic source maintenance [Tue, 20 Nov 2012 01:13:20 +0000 (18:13 -0700)] 
SourceFormat Enforcement

12 years agoFix mixup of NULL and false in rev.12482
Amos Jeffries [Mon, 19 Nov 2012 13:05:45 +0000 (06:05 -0700)] 
Fix mixup of NULL and false in rev.12482

12 years agolibesi: Various fixes
Amos Jeffries [Mon, 19 Nov 2012 11:29:31 +0000 (04:29 -0700)] 
libesi: Various fixes

* Mostly uninitialized class member variables

* One missing error check in ESI parser (740408)

* One potential NULL from dynamic cast fixed (740372)

* Several useless/dead code checks

 Detected by Coverity Scan. Issues 740545, 740408, 740546, 740372, 740547,
  740548, 740549, 740550, 740551, 740345, 740346, 740552, 740553, 740554,
  740555, 740556, 740557.

12 years agoRelease Notes: update manager ACL and MGR_INDEX documentation
Amos Jeffries [Mon, 19 Nov 2012 05:40:01 +0000 (22:40 -0700)] 
Release Notes: update manager ACL and MGR_INDEX documentation

12 years agoSourceFormat Enforcement
Automatic source maintenance [Mon, 19 Nov 2012 01:22:14 +0000 (18:22 -0700)] 
SourceFormat Enforcement

12 years agolibrfcnb: memory leaks in session setup
Amos Jeffries [Sun, 18 Nov 2012 11:15:24 +0000 (04:15 -0700)] 
librfcnb: memory leaks in session setup

 Detected by Coverity Scan. Issue 740425.

12 years agoTypo in rev.12477
Amos Jeffries [Sun, 18 Nov 2012 11:15:03 +0000 (04:15 -0700)] 
Typo in rev.12477

12 years agoFix several buffer termination bugs
Amos Jeffries [Sun, 18 Nov 2012 10:37:19 +0000 (03:37 -0700)] 
Fix several buffer termination bugs

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

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

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

12 years agoRemove MemPoolChunked::memPID
Amos Jeffries [Sun, 18 Nov 2012 10:02:38 +0000 (03:02 -0700)] 
Remove MemPoolChunked::memPID

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

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

 Detected by Coverity Scan. Issue 740506.

12 years agontlm_smb_lm_auth: better bounds checking
Amos Jeffries [Sun, 18 Nov 2012 07:12:58 +0000 (00:12 -0700)] 
ntlm_smb_lm_auth: better bounds checking

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

 Detected by Coverity Scan. Issue 740475.

12 years agonegotiate_kerberos_auth: better bounds checking
Amos Jeffries [Sun, 18 Nov 2012 07:06:26 +0000 (00:06 -0700)] 
negotiate_kerberos_auth: better bounds checking

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

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

 Detected by Coverity Scan. Issues 740392, 740484

12 years agoFix OpenSUSE glibc 2.17 compile issues
Andreas Jaeger [Sun, 18 Nov 2012 05:23:40 +0000 (22:23 -0700)] 
Fix OpenSUSE glibc 2.17 compile issues

12 years agolog_file_daemon: better error reporting
Amos Jeffries [Sun, 18 Nov 2012 04:44:13 +0000 (21:44 -0700)] 
log_file_daemon: better error reporting

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

 Detected by Coverity Scan. Issue 740316

12 years agoext_kerberos_ldap_group_acl: more memory leaks and NULL check cleanups
Amos Jeffries [Sun, 18 Nov 2012 04:13:21 +0000 (21:13 -0700)] 
ext_kerberos_ldap_group_acl: more memory leaks and NULL check cleanups

* remove some more useless NULL checks before xfree()

* add 'up' temporary allocation to the create_gd() cleanup

* document why gpbuf was added and is used for.

 Detected by Coverity Scan. Issues 740420, 740448, 740449

12 years agoSourceFormat Enforcement
Automatic source maintenance [Sun, 18 Nov 2012 01:13:10 +0000 (18:13 -0700)] 
SourceFormat Enforcement

12 years agoVarious memory leaks in configuration parsing
Amos Jeffries [Sat, 17 Nov 2012 12:58:59 +0000 (05:58 -0700)] 
Various memory leaks in configuration parsing

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

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

12 years agoext_kerberos_ldap_group: Memory Leaks
Amos Jeffries [Sat, 17 Nov 2012 12:31:44 +0000 (05:31 -0700)] 
ext_kerberos_ldap_group: Memory Leaks

* Allocate sufficient memory to nul-terminate the cleaned input buffer
  on worst-case input obfuscation level.

* Free temporary parsing buffers, and parsed group structures when parse
  aborts on failure.

* Remove several useless if() conditionals for simpler code flow:
 - Squid xfree() handles NULL pointers.
 - Squid safe_free() handles NULL pointers and assigns NULL after freeing
 - assigning x->next from local NULL pointer is okay.

 Detected by Coverity Scan. Issues 743377, 743378, 740412, 740417, 740418
   740419, 740420, 740421, 740448, 740458, 740342, 740422, 740449, 740450
   740423, 740424.

12 years agoSourceFormat Enforcement
Automatic source maintenance [Sat, 17 Nov 2012 01:13:26 +0000 (18:13 -0700)] 
SourceFormat Enforcement

12 years agoVarious Kerberos helper updates
Markus Moeller [Fri, 16 Nov 2012 09:41:22 +0000 (02:41 -0700)] 
Various Kerberos helper updates

* Use rfc1738 escapes for negotiate_kerberos logging and kerberos_ldap_group.

* Include the option for kerberos_ldap_group to read group information from
  stdin (squid config file list) instead of a command line argument.

12 years agosquidclient: Better error checking
Amos Jeffries [Fri, 16 Nov 2012 07:05:53 +0000 (00:05 -0700)] 
squidclient: Better error checking

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

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

 Detected by Coverity Scan. Issues 740334, 740379

12 years agoFix various assertion with side effects
Amos Jeffries [Fri, 16 Nov 2012 06:45:56 +0000 (23:45 -0700)] 
Fix various assertion with side effects

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

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

12 years agocachemgr.cgi: another memory leak
Amos Jeffries [Fri, 16 Nov 2012 05:17:59 +0000 (22:17 -0700)] 
cachemgr.cgi: another memory leak

 Detected by Coverity Scan. Issue 740445

12 years agobasic_radius_auth: nul-terminate strings
Amos Jeffries [Fri, 16 Nov 2012 04:35:29 +0000 (21:35 -0700)] 
basic_radius_auth: nul-terminate strings

Alterations in rev.12444 to the command line paramcopying overlooked the
absence of nul-termination by strncpy(). Ensure the strings are terminated.

 Detected by Coverity Scan. Issue 743276

12 years agocachemgr.cgi: Memory leaks
Amos Jeffries [Fri, 16 Nov 2012 04:17:36 +0000 (21:17 -0700)] 
cachemgr.cgi: Memory leaks

Authentication credentials parser also leaks badly. This was missed in the
fixes for trunk rev.12457.

 Detected by Coverity Scan. Issue 740442

12 years agodigest_ldap_auth: Fix crash on empty password
Amos Jeffries [Fri, 16 Nov 2012 04:08:22 +0000 (21:08 -0700)] 
digest_ldap_auth: Fix crash on empty password

 Detected by Coverity Scan. Issue 740399

12 years agoCorrect out-of-bounds array access in basic_ncsa_auth helper
Francesco Chemolli [Thu, 15 Nov 2012 22:26:23 +0000 (23:26 +0100)] 
Correct out-of-bounds array access in basic_ncsa_auth helper

12 years agoFixed incomplete MemBlobStats constructor
Francesco Chemolli [Thu, 15 Nov 2012 22:12:03 +0000 (23:12 +0100)] 
Fixed incomplete MemBlobStats constructor

12 years agocachemgr.cgi: Memory Leaks and DoS Vulnerability
Amos Jeffries [Thu, 15 Nov 2012 10:05:13 +0000 (03:05 -0700)] 
cachemgr.cgi: Memory Leaks and DoS Vulnerability

* Ignore invalid Content-Length headers.

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

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

12 years agosquidpurge: Remove useless code
Amos Jeffries [Thu, 15 Nov 2012 09:14:52 +0000 (02:14 -0700)] 
squidpurge: Remove useless code

 Detected by Coverity Scan. Issue 740353

12 years agontlm_fake_auth: Fix nesting error
Amos Jeffries [Thu, 15 Nov 2012 09:00:29 +0000 (02:00 -0700)] 
ntlm_fake_auth: Fix nesting error

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

 Detected by Coverity Scan. Issue 740394

12 years agoType in squid-3-12447
Amos Jeffries [Thu, 15 Nov 2012 08:32:53 +0000 (01:32 -0700)] 
Type in squid-3-12447

12 years agolibacl: polish and code fixes
Amos Jeffries [Thu, 15 Nov 2012 07:35:32 +0000 (00:35 -0700)] 
libacl: polish and code fixes

* removed several blocks of dead code and useless conditional checks

* Improved handling of garbage config definitios for ACL random, max_conn

* Initialized several uninitialized class members in ACL base class.

 Detected by Coverity Scan.
 Issues 740528, 740343, 740529, 740362, 434117, 740593, 740407.
 Possibly also resolves issue 740486.

12 years agoBug fix in TextException: gracefully handle exceptions with null text messages.
Francesco Chemolli [Wed, 14 Nov 2012 18:17:09 +0000 (19:17 +0100)] 
Bug fix in TextException: gracefully handle exceptions with null text messages.

12 years agoext_time_quota_acl: Polish and handle bad input better
Amos Jeffries [Wed, 14 Nov 2012 06:50:52 +0000 (23:50 -0700)] 
ext_time_quota_acl: Polish and handle bad input better

* Send BH response code when username field is missing or empty on the
  input line received from Squid (or manually typed)

* Display error message on broken config file lines and skip instead of
  crashing.

* Polish out some unused assignments.

 Detected by Coverity Scan. Issues 740404, 740405, 740591

12 years agoext_file_userip_acl: Polish and missing file handling
Amos Jeffries [Wed, 14 Nov 2012 06:15:15 +0000 (23:15 -0700)] 
ext_file_userip_acl: Polish and missing file handling

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

* Polish several useless assignments out of the code.

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

12 years agoext_edirectory_userip_acl: Polish: Remove dead code
Amos Jeffries [Wed, 14 Nov 2012 05:34:55 +0000 (22:34 -0700)] 
ext_edirectory_userip_acl: Polish: Remove dead code

* filter variable being NULL results in error condition returned before
  the filter is used. No need to test and use a hard-coded backup filter.

* ber variable is freed in the master loop and is not skipped. The loop
  only exists when ent is NULL. Neither needs to be freed.

 Detected by Coverity Scan. Issues 740339, 740340, 740341

12 years agounlinkd: Compiler warning cleanups
Amos Jeffries [Wed, 14 Nov 2012 02:30:30 +0000 (19:30 -0700)] 
unlinkd: Compiler warning cleanups

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

 Detected by Coverity Scan. Issue 740328

12 years agodigest_file_auth: Improved error handling
Amos Jeffries [Wed, 14 Nov 2012 01:50:16 +0000 (18:50 -0700)] 
digest_file_auth: Improved error handling

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

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

 Detected by Coverity Scan. Issues 740400, 740401

12 years agodigest_edirectory_auth: improved error handling
Amos Jeffries [Wed, 14 Nov 2012 01:33:49 +0000 (18:33 -0700)] 
digest_edirectory_auth: improved error handling

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

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

 Detected by Coverity Scan. Issue 740399

12 years agobasic_smb_auth: Buffer overrun.
Amos Jeffries [Wed, 14 Nov 2012 01:10:42 +0000 (18:10 -0700)] 
basic_smb_auth: Buffer overrun.

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

 Detected by Coverity Scan. Issue 740411

12 years agobasic_radius_auth: Fix several issues
Amos Jeffries [Wed, 14 Nov 2012 00:51:40 +0000 (17:51 -0700)] 
basic_radius_auth: Fix several issues

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

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

* prevent buffer overflow on long command line arguments.

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

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

12 years agobasic_pam_auth: Fix NULL-dereference issues
Amos Jeffries [Tue, 13 Nov 2012 23:41:16 +0000 (16:41 -0700)] 
basic_pam_auth: Fix NULL-dereference issues

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

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

  Detected by Coverity Scan. Issue 740354

12 years agobasic_ncsa_auth: Fix NULL-dereference crash
Amos Jeffries [Tue, 13 Nov 2012 23:15:57 +0000 (16:15 -0700)] 
basic_ncsa_auth: Fix NULL-dereference crash

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

 Detected by Coverity Scan. Issue 740398

12 years agobasic_msnt_auth: minor memory leaks
Amos Jeffries [Tue, 13 Nov 2012 11:51:19 +0000 (04:51 -0700)] 
basic_msnt_auth: minor memory leaks

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

12 years agoChanged HERE macro to be a true nop, clarified documentation, and marked is as deprec...
Francesco Chemolli [Mon, 12 Nov 2012 13:11:36 +0000 (14:11 +0100)] 
Changed HERE macro to be a true nop, clarified documentation, and marked is as deprecated.
Fixed syntax bug in comm.cc unearthed by the macro-to-function change.

12 years agoBug 3279: Polish: reference bugzilla record to prevent duplicate reports
Amos Jeffries [Mon, 12 Nov 2012 02:25:12 +0000 (19:25 -0700)] 
Bug 3279: Polish: reference bugzilla record to prevent duplicate reports

12 years agoBug 3329: Polish: reference the bugzilla number in cache.log to prevent duplicates
Amos Jeffries [Mon, 12 Nov 2012 02:21:18 +0000 (19:21 -0700)] 
Bug 3329: Polish: reference the bugzilla number in cache.log to prevent duplicates

12 years agoAudit result changes
Amos Jeffries [Sun, 11 Nov 2012 05:10:59 +0000 (18:10 +1300)] 
Audit result changes

12 years agoFixed issue introduced by debugs() change
Francesco Chemolli [Sat, 10 Nov 2012 21:00:41 +0000 (22:00 +0100)] 
Fixed issue introduced by debugs() change

12 years agoModify debugs() to automatically include file, line and function name for high-detail...
Francesco Chemolli [Sat, 10 Nov 2012 18:13:37 +0000 (19:13 +0100)] 
Modify debugs() to automatically include file, line and function name for high-detail cache log lines.

12 years agoPolish away some omitted changes
Amos Jeffries [Sat, 10 Nov 2012 11:03:49 +0000 (00:03 +1300)] 
Polish away some omitted changes

12 years agoMerged from trunk
Amos Jeffries [Sat, 10 Nov 2012 10:37:56 +0000 (23:37 +1300)] 
Merged from trunk

12 years agoAdd squid.conf documentation for helpers
Amos Jeffries [Sat, 10 Nov 2012 10:36:11 +0000 (23:36 +1300)] 
Add squid.conf documentation for helpers

12 years agoFix URL-decode logics consistency
Amos Jeffries [Sat, 10 Nov 2012 06:40:21 +0000 (19:40 +1300)] 
Fix URL-decode logics consistency

* always perform URL-decode on only token form of values
  (\-escaping always removed on all values prior to URL-decode)

* document change in URL-encoding for external_acl_type config

* deprecate external_acl type quote= and protocol= options

* remove unneeded 'urlQuoting' parameter from HelperReply parser

12 years agoSafer use of strwordtok()
Amos Jeffries [Sat, 10 Nov 2012 06:03:28 +0000 (19:03 +1300)] 
Safer use of strwordtok()

* It does not allocate. Drop a bad free()

* It may return NULL. Check for that before URL-decodeing,
  and also handle TT result mandatory token field better.

Caught in audit by Alex Rousskov.

12 years agoFix missing include in fqdncache.cc
Amos Jeffries [Sat, 10 Nov 2012 05:23:45 +0000 (18:23 +1300)] 
Fix missing include in fqdncache.cc

12 years agoSourceFormat Enforcement
Automatic source maintenance [Sat, 10 Nov 2012 01:13:27 +0000 (18:13 -0700)] 
SourceFormat Enforcement

12 years agoMultiple certificate_db/ssl_crtd fixes
Christos Tsantilas [Fri, 9 Nov 2012 15:08:10 +0000 (17:08 +0200)] 
Multiple certificate_db/ssl_crtd fixes

- Try to update the index file in all cases the database modified
- The find operator in database should not modify the database. Currently
  if an entry is expired, ssl_crtd removes the cert file but does not
  update the index file.
  rows. Currently we are using the new operator.
- Fix a small memory leak when remove entries from database: A row object
  removed from TXT_DB indexes but never released. This patch:
     * Use OPENSSL_malloc and OPENSSL_free to allocate/release memory for
       TXT_DB rows. OpenSSL SDK assumes that always allocated using these
       functions.
     * Add code in Ssl::CertificateDb::Row destructor to correctly release
       a TXT_DB row.
     * Add the sq_TXT_DB_delete and sq_TXT_DB_delete_row functions which
       removes a row from TXT_DB indexes.

This is a Measurement Factory project

12 years agoUpgrade Digest authentication to use key=value parameters
Amos Jeffries [Fri, 9 Nov 2012 04:23:08 +0000 (17:23 +1300)] 
Upgrade Digest authentication to use key=value parameters

* Update the Digest auth code in Squid to process the HelperReply key-pair
  notes list for data
+ output upgrade WARNING messages when old format responses are identified
+ handle TT result code (as an error with critical level ERROR message)
+ handle BH result code (as an error)

* Adds a ha1="" key to Digest auth response protocol to pass the HA1.

* Upgrade the Digest helpers to use OK/ERR/BH result codes and key=value
  parameters.

12 years agoMerged from trunk
Amos Jeffries [Thu, 8 Nov 2012 10:49:58 +0000 (23:49 +1300)] 
Merged from trunk

12 years agoAdd default constructor for HelperReply()
Amos Jeffries [Thu, 8 Nov 2012 08:49:33 +0000 (21:49 +1300)] 
Add default constructor for HelperReply()

Simplifies the nil-response code a little and allows hard-coded helper
error cases HelperReply objects to be explicitly initialized instead of
parsed.

12 years agoFix broken ssl_crtd helper interface
Christos Tsantilas [Wed, 7 Nov 2012 19:26:45 +0000 (21:26 +0200)] 
Fix broken ssl_crtd helper interface

With the patch r12422 which added support for OK/ERR/BH  helper response codes,
the ssl_crtd interface become broken. The ConnStateData::sslCrtdHandleReply
ssl_crtd reply handler, expects a response code included at the beggining of
the returned message. This is not true after the changes.

This patch add a parameter in Ssl::CrtdMessage constructor to define a message
as "ssl_crtd reply" or "ssl_crtd request" message. For ssl_crtd reply messages
the message parser does not expect helper response code.

This is a Measurement Factory project

12 years agoUse Notes objects for key=pair handling in HelperReply
Amos Jeffries [Wed, 7 Nov 2012 13:13:47 +0000 (02:13 +1300)] 
Use Notes objects for key=pair handling in HelperReply

* NTLM/Negotiate auth are expeted to return OK/ERR/BH/TT codes and key=pair.
  The old result lines are still received, but converted to the new format
  silently.

* new key accepted:
 'token=' for passing NTLM and Negotiate auth tokens

* some undocumented old tags accepted by external_acl_type are now ignored:
 'error=' replaced by 'message='
 'passwd=' replaced by 'password='
 'login=' replaced by 'user='
These were replaced some time ago and never formally documented.

12 years agoPolish: improve const correctness on Squid vector<> implementation
Amos Jeffries [Wed, 7 Nov 2012 01:43:16 +0000 (14:43 +1300)] 
Polish: improve const correctness on Squid vector<> implementation

This update allows == and != operators to be used with const_iterator
and removes the need for many implicit conversions safely.

12 years agoUpdate Notes API to support key=pair additions and lookup
Amos Jeffries [Tue, 6 Nov 2012 22:32:56 +0000 (11:32 +1300)] 
Update Notes API to support key=pair additions and lookup

* Adds a Notes::const_iterator definition to match Notes::iterator

* Adds a Notes::findByName(note-name) method to locate notes given their
  textual key / name string.

* Adds a Notes::add(key, value) method to insert key and value as a
  single operation. No more need for callers to be using Note::Pointer
  or be aware of the Note:: API just to insert the value.

TODO:

* add "key=value" syntax parser to Notes. The current parse() method
  onlyl accepts MiME header syntax (line- and whitespace- oriented).

* add ostream operator to dump the notes list content to a stream.

12 years agoBug 3659: read_timeout problem with HTTPS
Jean-Philippe Menil [Tue, 6 Nov 2012 05:01:03 +0000 (22:01 -0700)] 
Bug 3659: read_timeout problem with HTTPS

12 years agoMerged from trunk
Amos Jeffries [Sun, 4 Nov 2012 12:27:49 +0000 (01:27 +1300)] 
Merged from trunk

12 years agoCleanup: remove dead testNull unit test
Amos Jeffries [Fri, 2 Nov 2012 23:54:44 +0000 (17:54 -0600)] 
Cleanup: remove dead testNull unit test

12 years agoAdd SEND_BH macro to helper API definitions
Amos Jeffries [Fri, 2 Nov 2012 11:20:14 +0000 (05:20 -0600)] 
Add SEND_BH macro to helper API definitions

12 years agoSourceFormat Enforcement
Automatic source maintenance [Fri, 2 Nov 2012 00:13:41 +0000 (18:13 -0600)] 
SourceFormat Enforcement

12 years agoPortability: Move testRefCount to src/
Amos Jeffries [Thu, 1 Nov 2012 10:31:28 +0000 (23:31 +1300)] 
Portability: Move testRefCount to src/

It seems the automake dependencies on stub_*.o are still not working well
and ICC requires several stubs in order to link libbase.la.

This also adds new stubs for MemBuf.h and cbdata.h APIs.

12 years agoPolish: replace several assert(isOpen(fd))
Amos Jeffries [Tue, 30 Oct 2012 21:43:53 +0000 (10:43 +1300)] 
Polish: replace several assert(isOpen(fd))

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

12 years agoFix HelperReply(const HelperReply&) is private
Amos Jeffries [Tue, 30 Oct 2012 09:16:33 +0000 (22:16 +1300)] 
Fix HelperReply(const HelperReply&) is private

GCC 4.1 and possibly others use copy-constructor when an instance is
created in a function parameter list using copy by reference.
We must create such objects as loal variables and pass to the function
for best efficiency.

12 years agoFix HelperReply(const HelperReply&) is private
Amos Jeffries [Tue, 30 Oct 2012 00:36:45 +0000 (18:36 -0600)] 
Fix HelperReply(const HelperReply&) is private

12 years agoSourceFormat Enforcement
Automatic source maintenance [Tue, 30 Oct 2012 00:13:18 +0000 (18:13 -0600)] 
SourceFormat Enforcement

12 years agoSupport OK/ERR/BH response codes from any helper
Amos Jeffries [Mon, 29 Oct 2012 23:12:04 +0000 (12:12 +1300)] 
Support OK/ERR/BH response codes from any helper

Updates the helper reponse callback API from using char* buffer to a
HelperReply object storing teh response code, a blob buffer, and
pointer to the responding helper 'server' (if stateful).

* the helper I/O read handler is updated to parse the result code off
the start of the helper response as is currently done for channel-ID.
The callback handlers are altered to use the HelperReply::status instead
of parsing it off themselves individually.

* the remaining I/O read buffer is stored in a MemBuf and callbacks are
updated to use it via the method other().

* the responding helper-server is stored into the HelperReply object and
stateful helper callbacks are combined into the same API as stateless.
The callback handlers are updated to use HelperReply::lastserver instead
of function parameter.

After this patch the helper response format is:
  [channel-ID] SP [result] [ [SP] blob] <terminator>

'SP' being one octet \0x20 character.

The behavour changes expected from this is that all helpers are now able
to send OK/ERR/BH states. Although the handlers for some helpers will
deal with the new states as unknown response. None of the bundled
helpers have yet been altered to make use of this changed potential.

TODO:
* implement key=value parser for the blob area of the format, and update
handlers to use the HelperReply API to retrieve them.
* upgrade helpers to make use of new response format

12 years agoFix spelling and compile issues in CommIO
Amos Jeffries [Mon, 29 Oct 2012 22:46:06 +0000 (11:46 +1300)] 
Fix spelling and compile issues in CommIO

12 years agoFix broken include in urllogin ACL
Amos Jeffries [Mon, 29 Oct 2012 13:01:01 +0000 (07:01 -0600)] 
Fix broken include in urllogin ACL

12 years agoPolish: update the RefCount API a bt and split Lock out
Amos Jeffries [Mon, 29 Oct 2012 04:59:58 +0000 (22:59 -0600)] 
Polish: update the RefCount API a bt and split Lock out

* Shuffle RefCount.h and its unit-tests into src/base/

* Reworks struct Refcountable_  into class LockableObject in its own header
 + changing the reference counter accessors to a lock()/unlock() names
 + some minor symbol updates of code directly utilizing the RefCountable_
   members

With this we can begin the process of replacing our multiple different
implementations of the reference-counting pattern using LockableObject.

No code changes have been made. Just symbol polishing.

TODO: update the unit-tests for refcounting to use CPPUnit

12 years agoBug 3189: AIO thread race on pipe() initialization
Amos Jeffries [Mon, 29 Oct 2012 02:17:18 +0000 (20:17 -0600)] 
Bug 3189: AIO thread race on pipe() initialization

12 years agoPorted: urllogin ACL from squid 2.7
Amos Jeffries [Mon, 29 Oct 2012 01:31:29 +0000 (19:31 -0600)] 
Ported: urllogin ACL from squid 2.7

12 years agoFix ecap after Http::MethodType change
Francesco Chemolli [Sat, 27 Oct 2012 13:04:38 +0000 (15:04 +0200)] 
Fix ecap after Http::MethodType change

12 years agoSourceFormat Enforcement
Automatic source maintenance [Sat, 27 Oct 2012 00:13:19 +0000 (18:13 -0600)] 
SourceFormat Enforcement

12 years agonote option
Christos Tsantilas [Fri, 26 Oct 2012 19:43:58 +0000 (22:43 +0300)] 
note option

Add forgotten Notes.cc and Notes.h file

12 years agonote option
Christos Tsantilas [Fri, 26 Oct 2012 19:42:31 +0000 (22:42 +0300)] 
note option

This patch adds note option to squid.conf. It is similar to
adaptation_meta but is applied after all adaptation and before logging.
Values of key/value pair notes can be logged using %{key}note macros.

    note key value acl ...
    logformat myFormat ... %{key}note ...

This option may be initially used to log custom information about the master
transaction. For example, an admin may configure Squid to log which "user group"
the transaction belongs to, where "user group" will be determined based on a
set of ACLs and not [just] authentication information.

From user point of view, adaptation_header sets/implies meta (i.e.,
setting adaptation_meta is sufficient to be able to log it using
%note) but the note option itself (if any) is evaluated later,
so it has no effect on ICAP headers.

This is a Measurement Factory project

12 years agoFixed mistakenly reverted test
Francesco Chemolli [Fri, 26 Oct 2012 16:42:05 +0000 (18:42 +0200)] 
Fixed mistakenly reverted test

12 years agoRefactored tools/purge conffile reading to c++-streams
Francesco Chemolli [Fri, 26 Oct 2012 15:29:42 +0000 (17:29 +0200)] 
Refactored tools/purge conffile reading to c++-streams

12 years agoPolish: Http::MethodType upgrade
Amos Jeffries [Fri, 26 Oct 2012 11:36:45 +0000 (05:36 -0600)] 
Polish: Http::MethodType upgrade

Convert the METHOD_* enum into a class with accessors to determine
method string/image, idempotency, safety (as per RFC 2616 terminology).

* creates the initial http/ directory and http/libsquid-http.la
  library as per SourceLayout needs
  - libsquid-http is chosen to prevent symbols mistakes with libhttp
    which may exist on some systems under the libhttp or http/libhttp name.

enum changes:

* migrates _method_t to Http::MethodType and makes it a enum with
  auto-generated strings array provided by the new library.

* the enum list is extended to contain all methods in the HTTPbis WG
  new method registry
  - documentation now references that registry and HTTPbis draft
    document listing methods

HttpRequest class changes:

* cacheable() changed to maybeCacheable() accessor
  - to reflect that it determines NON-cacheability with certainty, but
    when returns TRUE it can still be overridden by Http Reply details
    and/or local environment details.
  - updated to cache the complex calculation result.

HttpRequestMethod class changes:

* The new isIdempotent() and isHttpSafe() accessors are altered
  slightly from the original code to match the RFCs. The existing code
  produces incorrect true/false values on some methods.

* new accessor shouldInvalidate() which produces true if the request
  method alone is enough to determine an RFC SHOULD invalidate condition.
  - purgesOthers() accessor is still present with the old behaviour, but
    for better caching we should convert the code to using
    shouldInvalidate()

* new accessors respMaybeCacheable() which produces true if the
  request method alone is enough to determine an RFC MAY cache condition.
  - replaces isCacheable() accessor which did not produce any certainty
    as implied by the name, and was producing incorrect assessments anyway
    for some methods.
  - it is more of a test whether *Squid* is known to be able to cache
    the response to this method, than whether the RFC permit it.
  - There are several cases where it should produce true according to
    the RFCs but isCacheable() was doing false due to bugs or missing
    feature support. These cases are now documented with reasons and things
    to test or fix before they can be made to return true.

* the remainders of obsolete extension_methods directive code is dropped

Global httpCachable(method) function dropped - replaced by
HttpRequest::maybeCacheable() accessor which does better cacheability
checks.

... and there are a lot of METHOD_FOO -> Http::METHOD_FOO symbol-only
changes fluffing out the patch size.

12 years agoext_lm_group_acl: Add missing rfc1738.h include
Amos Jeffries [Fri, 26 Oct 2012 02:21:21 +0000 (20:21 -0600)] 
ext_lm_group_acl: Add missing rfc1738.h include

12 years agoRemove Bungled warning on missing component directives
Amos Jeffries [Tue, 23 Oct 2012 06:39:34 +0000 (19:39 +1300)] 
Remove Bungled warning on missing component directives

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

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

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

12 years agoFix missing predefines in PeerDigest.h
Amos Jeffries [Mon, 22 Oct 2012 11:50:58 +0000 (00:50 +1300)] 
Fix missing predefines in PeerDigest.h