]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
12 years agoReport more detail about disk errors, especially the disker ID and db path.
Alex Rousskov [Mon, 21 Jan 2013 23:04:45 +0000 (16:04 -0700)] 
Report more detail about disk errors, especially the disker ID and db path.

On partial writes, try to write the leftovers a few times before giving up.
The caller is unlikely to employ a different strategy, and we can do that
faster. Current callers simply give up and declare an error. Partial disk
writes seem to be typical on overflowing disks, but there may be other
conditions we have not observed in the lab yet.

12 years agoPolished names, debugging, comments, whitespaces, style.
Alex Rousskov [Sun, 20 Jan 2013 18:54:42 +0000 (11:54 -0700)] 
Polished names, debugging, comments, whitespaces, style.

12 years agoDo not allow broken IpcIo-based cache_dir to be selected for swap out.
Alex Rousskov [Sun, 20 Jan 2013 17:31:50 +0000 (10:31 -0700)] 
Do not allow broken IpcIo-based cache_dir to be selected for swap out.

I/O code refuses to read or write when file error is set, but canRead()
and canWrite() ignored that fact, allowing broken files to be selected for
writing (at least). SwapDir::createStoreIO() would then return nil, leading
to missed swapout opportunities (if other cache_dirs could write) and wasted
CPU cycles.

12 years agoMem-cache entries exceeding one shared memory page in size, using
Alex Rousskov [Sun, 20 Jan 2013 02:07:24 +0000 (19:07 -0700)] 
Mem-cache entries exceeding one shared memory page in size, using
Ipc::StoreMap that now supports multi-slice entries. For the memory cache,
each slice corresponds to a shared memory page. Added a shared memory stack of
free slices. Many aspects of the implementation are similar to Rock Store.

Do not mem-cache entries that are already mem-cached at the time of keep()
call. This change is unrelated to multi-slice caching, but may provide a
noticeable performance boost.

12 years agoInitialize freeSlots before the map in case we decide to free something
Alex Rousskov [Sun, 20 Jan 2013 01:58:16 +0000 (18:58 -0700)] 
Initialize freeSlots before the map in case we decide to free something
during initialization (e.g., after reading something from the db file
in sync mode).

Removed allSlots as unused.

12 years agoPolished entry freeing.
Alex Rousskov [Sun, 20 Jan 2013 01:53:24 +0000 (18:53 -0700)] 
Polished entry freeing.

Clean Writeable entries in addition to Readables ones. Otherwise, there is no
way for the caller to completely get rid of a [large] entry the caller has
been writing! We hold the lock so this should be safe as long as slice.next
(and slice extras) are valid even in a half-baked Writeable entry.

Reset slice.next [before giving it to the caller]. As a consequence, we must
free individual slices even if cleaner is not set.

12 years agoUse signed type for StoreMapSliceId because we use -1 as an "unset" value.
Alex Rousskov [Sun, 20 Jan 2013 01:50:52 +0000 (18:50 -0700)] 
Use signed type for StoreMapSliceId because we use -1 as an "unset" value.

Initialize slice.next to be "unset". This should not be necessary in most
cases, but reduces the probability that a half-made writeable entry cannot be
freed properly because it contains an invalid slice.next value.

Losing the bit to store ID sign is not a big deal: Since slices always contain
non-trivial number of bytes for metadata, it is unlikely that all 32 (but less
than 33) bits would be required to store slice IDs in the future.

12 years agoMade "make check" happier. Needs more work.
Alex Rousskov [Thu, 17 Jan 2013 04:27:30 +0000 (21:27 -0700)] 
Made "make check" happier. Needs more work.

12 years agoMoved StoreMapSlice declaration and ctor definition into StoreMap.h
Alex Rousskov [Thu, 17 Jan 2013 04:25:35 +0000 (21:25 -0700)] 
Moved StoreMapSlice declaration and ctor definition into StoreMap.h
as too small/trivial to warrant dedicated source files.

12 years agoSynced with Ipc::StoreMap API changes. No functionality changes expected.
Alex Rousskov [Mon, 7 Jan 2013 19:44:59 +0000 (12:44 -0700)] 
Synced with Ipc::StoreMap API changes. No functionality changes expected.

12 years agoWorking Large Rock implementation, including concurrent store "rebuild"
Alex Rousskov [Mon, 7 Jan 2013 19:41:41 +0000 (12:41 -0700)] 
Working Large Rock implementation, including concurrent store "rebuild"
and a simple "scan" replacement policy.

Needs polishing and possibly a swap.state equivalent for faster rebuild.

12 years agoUse size_t instead of int32_t for blob sizes
Alex Rousskov [Mon, 7 Jan 2013 19:08:33 +0000 (12:08 -0700)] 
Use size_t instead of int32_t for blob sizes
because MemBlob only stores in-memory things and does not use negative sizes.

12 years agoAdded patterns for finding Ipc::StoreMap entries.
Alex Rousskov [Mon, 7 Jan 2013 19:06:53 +0000 (12:06 -0700)] 
Added patterns for finding Ipc::StoreMap entries.

12 years agoFixed job entering/leaving search patterns in job tracing scripts.
Alex Rousskov [Mon, 7 Jan 2013 19:06:25 +0000 (12:06 -0700)] 
Fixed job entering/leaving search patterns in job tracing scripts.

Same as trunk r12530.

12 years agoFixed job entering/leaving search patterns in job tracing scripts.
Alex Rousskov [Mon, 7 Jan 2013 19:04:30 +0000 (12:04 -0700)] 
Fixed job entering/leaving search patterns in job tracing scripts.

Same as trunk r12530.

12 years agoDo not reject size-less entries in storeRebuildParseEntry(). Deal with
Alex Rousskov [Mon, 7 Jan 2013 18:01:37 +0000 (11:01 -0700)] 
Do not reject size-less entries in storeRebuildParseEntry(). Deal with
entry size in the caller.

Some callers can handle entries that had unknown (at swapout start time) sizes.

Added rebuild debugging.

12 years agoAdjusted StoreIOState::write() API to allow callers detect write errors.
Alex Rousskov [Mon, 7 Jan 2013 17:54:27 +0000 (10:54 -0700)] 
Adjusted StoreIOState::write() API to allow callers detect write errors.

The errors are reported without these changes, but only via callbacks, some of
which may be asynchronous. Callers such as doPages() would keep calling
write() after the failure. It is probably best to quit early instead of
ignoring "post-error" state in StoreIOState::write().

Added StoreIOState::write() API description.

12 years agoSplit lock() into "just lock" and "update entry reference time" interfaces.
Alex Rousskov [Mon, 7 Jan 2013 17:18:10 +0000 (10:18 -0700)] 
Split lock() into "just lock" and "update entry reference time" interfaces.
Improved entry lock/unlock debugging.

Several modern store entry users need to lock the entry for storage rather
then to update entry's reference time. There is an old XXX describing the
corresponding API bug that merges the two distinct operations. This change
does not modify existing code, but allows new code to use new/fixed API
instead of changing an essentially private entry lock counter.

12 years agoDebug push and pop operations.
Alex Rousskov [Mon, 7 Jan 2013 17:16:17 +0000 (10:16 -0700)] 
Debug push and pop operations.

12 years agoProvide a safer version of a "is set" operator and
Alex Rousskov [Mon, 7 Jan 2013 17:14:28 +0000 (10:14 -0700)] 
Provide a safer version of a "is set" operator and
its explicitly named equivalent.

12 years agoFixed SMP cache manager request handling.
Alex Rousskov [Wed, 2 Jan 2013 18:57:34 +0000 (11:57 -0700)] 
Fixed SMP cache manager request handling.

Same as trunk r12564.

12 years agoPrevent Rock Store map entries being locked for reading forever.
Alex Rousskov [Thu, 20 Dec 2012 04:48:13 +0000 (21:48 -0700)] 
Prevent Rock Store map entries being locked for reading forever.

The map entries were locked to serve a hit but the client side carelessly
discarded the attached StoreEntry object when the hit had to be ignored.
Discarded StoreEntry object was left idle because it was never [un]locked.

12 years agoMaximum number of slots is the maximum number of entries rather than
Alex Rousskov [Wed, 5 Dec 2012 20:03:38 +0000 (13:03 -0700)] 
Maximum number of slots is the maximum number of entries rather than
maximum number of bytes.

Renamed loaded member to processed, to avoid name clash with a local counter.

12 years agoUse unique map/index paths not only when creating their shared memory segments
Alex Rousskov [Wed, 5 Dec 2012 19:39:42 +0000 (12:39 -0700)] 
Use unique map/index paths not only when creating their shared memory segments
but also when opening those segments.

12 years agoUse newly added slot-size cache_dir parameter instead of abusing max-size.
Alex Rousskov [Wed, 5 Dec 2012 19:22:51 +0000 (12:22 -0700)] 
Use newly added slot-size cache_dir parameter instead of abusing max-size.

Use unique suffixes for inode and free slot index names.

12 years agoxmemset was removed from Squid sources recently
Alex Rousskov [Wed, 5 Dec 2012 16:48:51 +0000 (09:48 -0700)] 
xmemset was removed from Squid sources recently

12 years agoInitial Large Rock implmentation.
Alex Rousskov [Wed, 5 Dec 2012 16:06:35 +0000 (09:06 -0700)] 
Initial Large Rock implmentation.

Needs polishing, a better replacement policy, and rebuild fixes.

12 years agoReduced code duplication when creating rock db file.
Alex Rousskov [Tue, 4 Dec 2012 22:47:36 +0000 (15:47 -0700)] 
Reduced code duplication when creating rock db file.

12 years agoSSL server certificate validator implementation
Christos Tsantilas [Tue, 4 Dec 2012 14:29:02 +0000 (16:29 +0200)] 
SSL server certificate validator implementation

This patch implements the certificate validation helper interface described at:
  http://wiki.squid-cache.org/Features/SslServerCertValidator

The helper consulted after the internal OpenSSL validation, regardless of the
validation results. The helper will receive:
   1) the origin server certificate [chain],
   2) the intended domain name, and
   3) a list of OpenSSL validation errors (if any).

If the helper decides to honor an OpenSSL error or report another validation
error(s), the helper will return:
   1) A list of certificates.
   2) A list of items consists the the validation error name (see %err_name
      error page macro and %err_details logformat code), error reason
      (%ssl_lib_error macro), and the offending certificate.

The returned information mimics what the internal OpenSSL-based validation code
collects now. Returned errors, if any, fed to sslproxy_cert_error, triggering
the existing SSL error processing code.

The helper invocation controlled by the "sslcrtvalidator_program" and
"sslcrtvalidator_children" configurations options which are similar to the
ssl_crtd related options.

A simple testing cert validation helper developed in perl included in this
patch. This helper just echo back the certificate errors.

This is a Measurement Factory Project

12 years agoParse validation helper response bug
Christos Tsantilas [Tue, 4 Dec 2012 12:49:21 +0000 (14:49 +0200)] 
Parse validation helper response bug

- CertValidationResponse bug: The CertValidationResponse::RecvdError::id is
  not intialized in constructors

- Inside Ssl::CertValidationMsg::parseResponse, after parsing response run
  through the parsed errors for errors.

12 years agominor fix to build after latest merge from trunk
Christos Tsantilas [Tue, 4 Dec 2012 12:49:01 +0000 (14:49 +0200)] 
minor fix to build after latest merge from trunk

12 years agomerge from trunk r12500
Christos Tsantilas [Tue, 4 Dec 2012 10:17:43 +0000 (12:17 +0200)] 
merge from trunk r12500

12 years agoAdd missing initializer from rev.12495
Amos Jeffries [Sun, 2 Dec 2012 23:10:23 +0000 (12:10 +1300)] 
Add missing initializer from rev.12495

Fixes segfault in testHttpRequest destructor testing.

12 years agoPrep for 3.3.0.2, 3.2.4, 3.1.22
Amos Jeffries [Sun, 2 Dec 2012 08:24:33 +0000 (01:24 -0700)] 
Prep for 3.3.0.2, 3.2.4, 3.1.22

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

12 years agoBug 3688: Lots of Orphan Comm:Connections to ICAP server
Alexander Komyagin [Sat, 1 Dec 2012 03:32:44 +0000 (20:32 -0700)] 
Bug 3688: Lots of Orphan Comm:Connections to ICAP server

12 years agoSourceFormat Enforcement
Automatic source maintenance [Sat, 1 Dec 2012 01:20:32 +0000 (18:20 -0700)] 
SourceFormat Enforcement

12 years agoAdd kv-pair support to url_rewrite_helper interface
Amos Jeffries [Fri, 30 Nov 2012 23:02:11 +0000 (12:02 +1300)] 
Add kv-pair support to url_rewrite_helper interface

This stage of the helper reply protocol adds kv-pair support to the
url_rewrite_helper interfacefor URL redirect and rewrite operations.

It uses the new Notes objects and kv-pair field added by the stage 2
helper protocol instead of parsing the 'other' field. Although,
the 'other' field is still parsed when *no* result field is received
for backward compatibility with older helpers.

The response syntax for URL helpers becomes:
  [channel-ID SP] result [SP kv-pair ...] [SP other] EOL

NP: 'other' field is now deprecated and will be ignored/discarded on any
  response containing a result code field.

When result code "OK" is presented by the helper several kv-pairs are
reserved to control Squid actions:

* "rewrite-url=" is added to return a re-written URL.
 - When this key is presented the URL is re-written to the new one by
   Squid without client interaction.
 - The 'url' keys presence will override this key.

* "url=" is added to return the redirected-to URL.
 - When this key name is presented an HTTP redirect response is generated
   for the client.
 - This keys presence overrides the 'rewrite-url' key actions.

* "status=" is added to hold the HTTP status code for use in redirect
  operations.
 - This field is optional and status is no longer required for marking
   redirect actions.
 - If no redirect status is provided Squid will assign one (currently the
   default is 302, that may change in the future).
 - This key is only relevant when 'url' key is also presented. In all
   other uses it is currently ignored.

When result codes BH or ERR are presented by the helper no redirect or
rewrite action is performed and no kv-pair key names are reserved for use
at this time.

Any other keys MAY be sent on any response. The URL helper interface
makes no other use of them, but this patch does pass them on to the ALE
object for logging as transaction Notes. All kv-pairs returned by the
helper (including the url, stauts rewrite-url keys) are available for
logging via the %{...}note log format option.

As with changes to other helpers interfaces in earlier updates, only
the first value presented for any of the reserved kv-pairs is used.
Multiple values are accepted as notes, but otherwise ignored by Squid and
do not affect the transaction outcome.

Additionally, when the BH result code is received from the helper a
simple recovery is attempted. The lookup request will be re-scheduled (up
to once) in an attempt to find a better responding helper.

NOTE: Helper notes are *not* passed to adaptation interfaces.
 - REQMOD adaptation happens before URL helpers are used.
 - REPMOD adaptation may at some point receive them, but that change is
   not done by this update.

 This update was sponsored by Edgewave.

12 years agoDocs: doxygenate the HttpRequest::helperRnotes member
Amos Jeffries [Fri, 30 Nov 2012 22:57:54 +0000 (11:57 +1300)] 
Docs: doxygenate the HttpRequest::helperRnotes member

12 years agoTypo in HttpRequest
Amos Jeffries [Fri, 30 Nov 2012 22:54:46 +0000 (11:54 +1300)] 
Typo in HttpRequest

12 years agoPolish: Improve the messages output by UFS swap log management.
Amos Jeffries [Fri, 30 Nov 2012 11:57:23 +0000 (04:57 -0700)] 
Polish: Improve the messages output by UFS swap log management.

It also includes a small local variable symbol change from "new_path" to
"tmp_path" to prevent future developer mistakes like the one seen in
bug 3663 mistaking "new_path" for the new destination path of xrename().

12 years agoMerged from trunk
Amos Jeffries [Fri, 30 Nov 2012 11:24:03 +0000 (00:24 +1300)] 
Merged from trunk

12 years agoAdd kv-pir support to url_rewrite_helper interface
Amos Jeffries [Fri, 30 Nov 2012 11:08:47 +0000 (00:08 +1300)] 
Add kv-pir support to url_rewrite_helper interface

This stage of the helper reply protocol adds kv-pair support to the
url_rewrite_helper interfacefor URL redirect and rewrite operations.

It uses the new Notes objects and kv-pair field added by the stage 2
helper protocol instead of parsing the 'other' field. Although,
the 'other' field is still parsed when *no* result field is received
for backward compatibility with older helpers.

The response syntax for URL helpers becomes:
  [channel-ID SP] result [SP kv-pair ...] [SP other] EOL

NP: 'other' field is now deprecated and will be ignored/discarded on any
  response containing a result code field.

When result code "OK" is presented by the helper several kv-pairs are
reserved to control Squid actions:

* "rewrite-url=" is added to return a re-written URL.
 - When this key is presented the URL is re-written to the new one by
   Squid without client interaction.
 - The 'url' keys presence will override this key.

* "url=" is added to return the redirected-to URL.
 - When this key name is presented an HTTP redirect response is generated
   for the client.
 - This keys presence overrides the 'rewrite-url' key actions.

* "status=" is added to hold the HTTP status code for use in redirect
  operations.
 - This field is optional and status is no longer required for marking
   redirect actions.
 - If no redirect status is provided Squid will assign one (currently the
   default is 302, that may change in the future).
 - This key is only relevant when 'url' key is also presented. In all
   other uses it is currently ignored.

When result codes BH or ERR are presented by the helper no redirect or
rewrite action is performed and no kv-pair key names are reserved for use
at this time.

Any other keys MAY be sent on any response. The URL helper interface
makes no other use of them, but this patch does pass them on to the ALE
object for logging as transaction Notes. All kv-pairs returned by the
helper (including the url, stauts rewrite-url keys) are available for
logging via the %{...}note log format option.

As with changes to other helpers interfaces in earlier updates, only
the first value presented for any of the reserved kv-pairs is used.
Multiple values are accepted as notes, but otherwise ignored by Squid and
do not affect the transaction outcome.

Additionally, when the BH result code is received from the helper a
simple recovery is attempted. The lookup request will be re-scheduled (up
to once) in an attempt to find a better responding helper.

NOTE: Helper notes are *not* passe to adaptation interfaces.
 - REQMOD adaptation happens before URL helpers are used.
 - REPMOD adaptation may at some point receive them, but that change is
   not done by this update.

 This update was sponsored by Edgewave.

12 years agoRemove unnecessary xmemset()
Amos Jeffries [Thu, 29 Nov 2012 08:51:27 +0000 (01:51 -0700)] 
Remove unnecessary xmemset()

Was a simple wrapper around memset() to add debugs() traces. However
other profiling tools can trace memset far better.

12 years agoFix accept_filter on Linux
Amos Jeffries [Wed, 28 Nov 2012 09:49:15 +0000 (22:49 +1300)] 
Fix accept_filter on Linux

accept_filter directive on Linux requires TCP_DEFER_ACCEPT which
in turn requires netinet/tcp.h. This was removed when splitting comm
into libcomm.la.

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

12 years agoStage 2 synced with trunk
Amos Jeffries [Tue, 27 Nov 2012 22:04:18 +0000 (11:04 +1300)] 
Stage 2 synced with trunk

12 years agoHelper protocol upgrade: add optional kv-pair field to responses
Amos Jeffries [Tue, 27 Nov 2012 22:02:02 +0000 (11:02 +1300)] 
Helper protocol upgrade: add optional kv-pair field to responses

This adds an optional kv-pair field immediately following the result field
on all helper interface responses. This field contains a list of key=value
pairs where the value is a RFC1738 (URL) encoded token or a quoted string.
Quoted-string MAY contain whitespace and shell escaping.

The response syntax for all helpers becomes:
  [channel-ID SP] result [SP key-pair ...] [SP other] EOL

The parser for HelperReply is also updated to map the old AF and NA
NTLM/Negotiate response fields into the HelperReply notes:
 * "token=" is added to supply the NTLM and Negotiate server blob/token.
 * "user=" is added to supply the user label field.
The relevant callback handlers are updated for these helpers to make use
of these new keys.

The bundled Digest authentication helpers are all upgraded to send the new
format responses. They now use ERR for failed lookup, BH for internal
errors, and OK with "ha1=" key added to supply a HA1 response. The handler
for Digest authentication is updated to process the new HelperReply fields
with failover the old format on Unknown result codes.

The external ACL handler is updated to pull its key=value pairs out of the
Notes list. The old parser loop becomes useless with this and is removed.
Taking with it support for several long deprecated keys "login=", "passwd=",
and "error=" which are now ignored.

Any other keys MAY be sent on any response. However at this stage 2 patch
they are ignored. As are repeated / secondary values for the expected key
names, only the first instance sent in the response is used.

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 agominor changes
Christos Tsantilas [Sat, 24 Nov 2012 14:27:56 +0000 (16:27 +0200)] 
minor changes

12 years agoAmos requested changes
Christos Tsantilas [Sat, 24 Nov 2012 14:12:30 +0000 (16:12 +0200)] 
Amos requested changes

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