]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
3 days agoSNMP: Clear community aliases to avoid dangling pointer (#2215) master
Joshua Rogers [Mon, 3 Nov 2025 03:52:55 +0000 (03:52 +0000)] 
SNMP: Clear community aliases to avoid dangling pointer (#2215)

Currently not a issue, but reduces UAF hazard in the future

4 days agonegotiate_sspi_auth: Respond with ERR when FormatMessage() fails (#2158)
Joshua Rogers [Sun, 2 Nov 2025 19:56:35 +0000 (19:56 +0000)] 
negotiate_sspi_auth: Respond with ERR when FormatMessage() fails (#2158)

4 days agoFix and improve debugging of tunneled TCP connections (#2291)
Alex Rousskov [Sun, 2 Nov 2025 13:48:19 +0000 (13:48 +0000)] 
Fix and improve debugging of tunneled TCP connections (#2291)

When a to-client write failed, TunnelStateData::writeClientDone()
debugging said "from-client read failed".

TunnelStateData::keepGoingAfterRead() debugging did not differentiate
two key cases: zero-size read and Squid-initiated closure of the other
end of the tunnel. That "other end" was called "client", but it could be
the "server" end. Related `if` statements logic was difficult to follow.

TunnelStateData::Connection state was difficult to reconstruct when
debugging long-lived tunnels. These debugging enhancements were
instrumental in tunnel closure problems triage, but those problems
deserve dedicated fixes.

Debugging improvements aside, no functionality changes are expected.

4 days agosecurity_file_certgen: Fix OPENSSL_malloc()/free(3) mismatch (#2174)
Joshua Rogers [Sun, 2 Nov 2025 03:53:33 +0000 (03:53 +0000)] 
security_file_certgen: Fix OPENSSL_malloc()/free(3) mismatch (#2174)

4 days agoRemoved always-true ClientRequestContext::httpStateIsValid() (#2279)
Joshua Rogers [Sat, 1 Nov 2025 22:37:23 +0000 (22:37 +0000)] 
Removed always-true ClientRequestContext::httpStateIsValid() (#2279)

... and related cbdata checks/comments.

`ClientRequestContext::httpStateIsValid()` always returns true. We
can prove that by contradiction:

* `ClientRequestContext::httpStateIsValid()` return value is
  `cbdataReferenceValid(http)` return value.
* `ClientRequestContext::http` points to a `ClientHttpRequest` object.
* If `cbdataReferenceValid(http)` is false, then the corresponding
  `ClientHttpRequest` object pointed to by `http` has been destructed.
* `ClientHttpRequest` destructor deletes its `calloutContext` data
  member (i.e. `ClientRequestContext`).

Thus, if an `x->httpStateIsValid()` call returns false, then `x` object
has already been deleted, and the call itself was buggy because it was
dereferencing a pointer to a deleted object!

Moreover, `cbdataReferenceValid(nullptr)` is always true, so calling
`httpStateIsValid()` twice for a deleted `ClientHttpRequest` object does
not actually protect the second caller (i.e. does not detect that `http`
is gone) because the first call makes `ClientRequestContext::http` nil,
making `httpStateIsValid()` true again!

None of the above problems actually happen because
`cbdataReferenceValid(http)` is never false inside
`ClientRequestContext::httpStateIsValid()`. By the time it could have
become false, `ClientRequestContext` object itself is already gone.

Also removed a source code comment that falsely claimed that
`ClientRequestContext` callback methods should check whether
`ClientHttpRequest` object is still "valid". In reality,
`ClientRequestContext` methods are not called after `ClientHttpRequest`
object is destructed because they are protected by cbdata guards, and
`ClientHttpRequest` destruction deletes `ClientRequestContext` object,
resulting in those guards skipping any callbacks.

The same comment also incorrectly implied that `ClientHttpRequest` first
becomes "invalid" and then, _after_ the current callback is done,
`ClientHttpRequest` destructor is called. In reality,
`cbdataReferenceValid(x)` becomes false when `delete x` is called and,
hence, when `x` destructor runs.

10 days agoReduce testHttpRequest dependencies (#2252)
Eduard Bagdasaryan [Sat, 25 Oct 2025 19:51:51 +0000 (19:51 +0000)] 
Reduce testHttpRequest dependencies (#2252)

No functionality changes are expected.

12 days agopinger: Echo all received bytes on Windows icmp_sock (#2210)
Joshua Rogers [Sat, 25 Oct 2025 15:08:41 +0000 (15:08 +0000)] 
pinger: Echo all received bytes on Windows icmp_sock (#2210)

Avoids OOB read by strlen().

12 days agoMaintenance: Drop HttpStateData::handleMoreRequestBodyAvailable (#2286)
Alex Rousskov [Sat, 25 Oct 2025 10:07:58 +0000 (10:07 +0000)] 
Maintenance: Drop HttpStateData::handleMoreRequestBodyAvailable (#2286)

The method is unreachable: It was supposed to be a virtual method. It is
declared as such in HttpStateData class, but it should have been
declared virtual in Client (i.e. the _parent_ class). Without that
virtual declaration in Client, the caller calls a Client method with the
same name instead. This code became unreachable in 2007 commit 5f8252d2.

The current method implementation is unusable: There are two explicit
XXXs, excessive (and unclassified) level-1 debugging, and an infinite
recursion added in the same 2007 commit 5f8252d2.

It is possible to refactor this method implementation to address known
concerns. We decided to remove this method instead because proper
refactoring is costly and is likely to result in this method removal.

The infinite recursion concern was raised by Joshua Rogers
https://joshua.hu/

12 days agoQuit NTLM authenticate() on missing NTLM authorization header (#2216)
Joshua Rogers [Sat, 25 Oct 2025 08:42:26 +0000 (08:42 +0000)] 
Quit NTLM authenticate() on missing NTLM authorization header (#2216)

Previously, various null-pointer dereferences, UAFs, and so on occurred.

12 days agoICMP: Harden echo paths, fix overflows, UB, and leaks (#2199)
Joshua Rogers [Thu, 23 Oct 2025 10:11:27 +0000 (10:11 +0000)] 
ICMP: Harden echo paths, fix overflows, UB, and leaks (#2199)

ICMPv4 send now validates getAddrInfo results before touching
ai_addr, avoiding null-deref, and frees the address on error.
Logging no longer passes nullptr strings, preventing UB.

ICMPv4 recv gained strict bounds checks: reject packets shorter
than IP/ICMP headers, reject bogus iphdrlen, and require enough
bytes for echo meta. Payload length is computed from real data,
clamped to MAX_PAYLOAD, and malformed negatives are dropped. The
result size calculation now uses PINGER_PAYLOAD_SZ instead of the
wrong MAX_PKT4_SZ, fixing excess memory disclosure.

ICMPv6 send added the same getAddrInfo validation and safe log
string handling. The recv path now checks for minimal header
lengths, validates echo meta, fixes ident comparison with ntohs,
and clamps payload length safely before copying into preply.

The pinger handshake no longer uses strlen() on raw buffers;
it now echoes exactly the bytes received, avoiding OOB reads.

Squid Recv was changed to treat pingerReplyData as variable-
length. It validates base header size, available payload, and
non-negative psize, and rejects truncated or oversized datagrams,
fixing past OOB read risks.

Finally, netdbBinaryExchange now flushes its 4K buffer before
writing the next record, fixing a possible overflow at the end of
the buffer.

2 weeks agoBug 5520: ERR_INVALID_URL for CONNECT host with leading digit (#2283)
Alex Rousskov [Thu, 23 Oct 2025 08:05:28 +0000 (08:05 +0000)] 
Bug 5520: ERR_INVALID_URL for CONNECT host with leading digit (#2283)

Squid 7.2 commit b8337359 added validation of host names
following RFC 1035 requirements. But those requirements were
outdated by RFC 1123:

  One aspect of host name syntax is hereby changed: the
  restriction on the first character is relaxed to allow either a
  letter or a digit.  Host software MUST support this more liberal
  syntax.

The commit treated CONNECT host names that start with a decimal digit
as invalid IPv4 addresses and rejected the corresponding requests,
resulting in HTTP 404 errors. Undo that change.

We have considered preserving code that detects valid IPv4 addresses (as
opposed to treating all non-IPv6 input as an "IPv4 address or reg-name"
without disambiguating the two cases) because its pieces may be reused,
but that essentially unused code has non-trivial performance penalty and
final code may look quite different after we complete our "non-CONNECT
uri-host parsing code" migration TODO. Polished source code comments
aside, this change reverts 2025 commit b8337359 and restores 2023
AnyP::Uri::parseHost() implementation (commit 963ff143).

2 weeks agoSNMP: Remove extraneous va_start() from snmpAddNode() (#2228)
Joshua Rogers [Tue, 21 Oct 2025 14:52:18 +0000 (14:52 +0000)] 
SNMP: Remove extraneous va_start() from snmpAddNode() (#2228)

Also polished snmpAddNode() implementation, including adding
`mib_tree_head->parent` initialization.

2 weeks agoFix Auth::User::absorb() IP list transfer logic (#2194)
Joshua Rogers [Tue, 21 Oct 2025 05:31:41 +0000 (05:31 +0000)] 
Fix Auth::User::absorb() IP list transfer logic (#2194)

Detach IP from source list before reattaching to destination and
decrement ipcount. This prevents list corruption and counter mismatch.

2 weeks agoBug 5501: Squid may exit when ACLs decode an invalid URI (#2145)
Alex Rousskov [Sun, 19 Oct 2025 19:42:38 +0000 (19:42 +0000)] 
Bug 5501: Squid may exit when ACLs decode an invalid URI (#2145)

    2025/08/14 09:28:51| FATAL: invalid pct-encoded triplet
        exception location: Uri.cc(102) Decode

The bug affects url_regex and urllogin ACLs. However, not every use of
those ACLs results in a FATAL exit. The exact preconditions are unknown.

Three pct-encoding (RFC 3986) error handling algorithms were considered:

### Algorithm A: An ACL that cannot decode, mismatches

This algorithm is similar to the algorithm used for handling "ACL is
used in context without ALE" and similar errors, but there is a
significant context difference: Those "without ALE" errors are Squid
misconfigurations or bugs! Decoding failures, on the other hand, are
caused by request properties outside of admin or Squid control.

With this algorithm, a request can easily avoid a "deny urlHasX" rule
match by injecting an invalid pct-encoding (e.g., `X%bad`). Such
injections may not be practical for URLs of most resources outside of
client control because most servers are unlikely to recognize the
malformed URL as something useful for the client. As for resources that
client does control, a urlHasX ACL cannot be effective for those anyway
because the client can change URLs.

Algorithm A does not let Squid admins match problematic URLs!

### Algorithm B: An ACL that cannot decode X, tests raw/encoded X

With this algorithm, a request can trigger some "allow urlHasY" rule
matches by injecting an invalid pct-encoding that looks like Y (e.g., if
an "allow" rule looks for the word `good`, a request may contain a
`%good` or `%XXgood` sequence). Just like with algorithm A, such
injections probably have little practical value, for similar reasons.

Algorithm B lets Squid admins match problematic URLs.

### Algorithm C: An ACL that cannot decode X, tests partially decoded X

With this algorithm, a "partially decoded X" is X where invalid
pct-encoding sequences (or their parts) are left "as is" while valid
pct-encoding triplets are decoded. This is actually a family of similar
algorithms because there are multiple ways to define invalid
pct-encoding sequence boundaries in certain URLs! For example,
`%6Fne%f%6Fo` can be replaced with `one%foo` or `one%f%6Fo`. This
additional complexity/uncertainty aggravates the two concerns below.

Algorithm B notes apply to algorithm C as well.

Algorithm C lets admins match problematic URLs but, again, it requires
that admins know exactly how Squid is going to isolate problematic
pct-encoding triplets (e.g., skip/leave just `%` byte that starts an
invalid pct-encoding sequence or the following two bytes as well).

Algorithm C family includes rfc1738_unescape() behavior. That decoding
function was used for the two ACLs before commit cbb9bf12 and commit
226394f2 started to use AnyP::Uri::Decode() added in commit 26256f28.
For example, rfc1738_unescape() decodes `%%` as `%` and leaves some
other invalid pct-encoding one-, two-, and three-byte sequences in the
decoded result. It is unlikely that many admins know exactly what that
old decoding does, but they could tune their rules to "work" as they
expect for specific cases. Those rules could stop working after the
above commits (v7.0.1+) and this change, to their surprise.

This change implements Algorithm B:

* Unlike Algorithm A, B allows admins to match bad URLs.
* Unlike Algorithm C, B does not force admins to guess how Squid
  mangles a bad URL before matching it.

Also updated ACLs documentation to reflect current implementation.

2 weeks agoFix libntlmauth string parsing on big-endian machines (#2242)
Joshua Rogers [Sun, 19 Oct 2025 17:33:18 +0000 (17:33 +0000)] 
Fix libntlmauth string parsing on big-endian machines (#2242)

Prevent off-by-one reads in ntlm_fetch_string(); clamp copies too.
Convert flags with le32toh; validate lengths; ensure NUL-terminate.
cast ntlm string characters to unsigned char explicitly.
Return BlobError on oversized fields to avoid UB.

Combined these changes affect Big-Endian CPU architectures
which will fail to detect ASCII vs UTF encoding properly and
produce invalid strings (including user/password to compare).

2 weeks agoSNMP: Fix OID truncation and sibling lookup (#2244)
Joshua Rogers [Sat, 18 Oct 2025 15:15:07 +0000 (15:15 +0000)] 
SNMP: Fix OID truncation and sibling lookup (#2244)

Previously, SNMP OIDs could be truncated (peer_Inst didn't update
the length after appending a subid), snmpTreeSiblingEntry() misused
len and sometimes returned the wrong sibling or stepped past the
end.

Now we update the OID length while building, select siblings
by matching name[len] (returning the right neighbor only if present).

Also, cleanup socket closure.

2 weeks agoCI: Use OpenBSD 7.7 instead of 7.6 (#2275)
Francesco Chemolli [Sat, 18 Oct 2025 09:52:37 +0000 (09:52 +0000)] 
CI: Use OpenBSD 7.7 instead of 7.6 (#2275)

Fix staging checks by targeting the current version of OpenBSD.

    https://cdn.openbsd.org/pub/OpenBSD/7.6/packages/amd64/: no such dir

3 weeks agoCI: update target FreeBSD version to 14.3 (#2271)
Francesco Chemolli [Sun, 12 Oct 2025 05:17:57 +0000 (06:17 +0100)] 
CI: update target FreeBSD version to 14.3 (#2271)

FreeBSD VM setup is unhappy unless we
target the latest minor version.

3 weeks agoBug 3390: Proxy auth data visible to scripts (#2249)
Amos Jeffries [Sat, 11 Oct 2025 03:33:02 +0000 (16:33 +1300)] 
Bug 3390: Proxy auth data visible to scripts (#2249)

Original changes to redact credentials from error page %R code
expansion output was incomplete. It missed the parse failure
case where ErrorState::request_hdrs raw buffer contained
sensitive information.

Also missed was the %W case where full request message headers
were generated in a mailto link. This case is especially
problematic as it may be delivered over insecure SMTP even if
the error was secured with HTTPS.

After this change:
* The HttpRequest message packing code for error pages is de-duplicated
  and elides authentication headers for both %R and %W code outputs.
* The %R code output includes the CRLF request message terminator.
* The email_err_data directive causing advanced details to be added to
  %W mailto links is disabled by default.

Also redact credentials from generated TRACE responses.

---------

Co-authored-by: Alex Rousskov <rousskov@measurement-factory.com>
4 weeks agodiskd: avoid abort on shared memory exhaustion (#2241)
Joshua Rogers [Mon, 6 Oct 2025 13:19:05 +0000 (13:19 +0000)] 
diskd: avoid abort on shared memory exhaustion (#2241)

4 weeks agoDo not forward HTCP CLR requests denied by htcp_clr_access (#2246)
Alex Rousskov [Sun, 5 Oct 2025 18:44:01 +0000 (18:44 +0000)] 
Do not forward HTCP CLR requests denied by htcp_clr_access (#2246)

Before this change:

* htcp_access controls TST access
* htcp_clr_access controls CLR access to local cache purging
* nothing controls CLR forwarding -- it is always allowed

After this change:

* htcp_access controls TST access
* htcp_clr_access controls CLR access to local cache purging
* htcp_clr_access controls CLR forwarding

This bug was discovered and detailed by Joshua Rogers
https://joshua.hu/

4 weeks agoAvoid putenv() problems by switching to setenv() (#2262)
Eduard Bagdasaryan [Fri, 3 Oct 2025 09:40:25 +0000 (09:40 +0000)] 
Avoid putenv() problems by switching to setenv() (#2262)

Developers work around putenv() design flaws by writing more complex
code that still leaks memory (e.g., commit b1b2793 and commit 96b9d96).
We should follow putenv(3) manual page advice and use setenv() instead:

    The setenv() function is strongly preferred to putenv().

Kerberos builds have been using setenv() since 2009 commit 9ca29d2.
Twenty years ago, setenv() code failed to build on Solaris (see 2005
commit cff61cb), but modern Solaris does have setenv(3).

Since setenv(3) is a standard C library _extension_ unavailable on
Windows, we provide a setenv(3) replacement for MS Windows builds. Our
replacement should work correctly in known current use cases, but acts
differently if given a variable with an empty value. This replacement
does not make things worse because the old macro trick had the same
flaw. We do not know of an easy way to support empty variable values on
Windows the way setenv(3) does.

Also fixed negotiate_kerberos_auth undefined behavior caused by freeing
memory returned by getenv() when the helper was run without `-k keytab`.

4 weeks agoBug 5510: False Cache Digests misses (#2254)
Lior Brown [Fri, 3 Oct 2025 08:18:34 +0000 (08:18 +0000)] 
Bug 5510: False Cache Digests misses (#2254)

Since 2002 commit add2192d, code receiving fresh Cache Digests from
cache_peers corrupted peer digest bitmask, leading to misses for objects
that were supposed to be present in the digest[^1]. Memory overreads
were probably happening as well. The exact corruption conditions/effects
probably changed when 2023 commit 122a6e3c removed HTTP response headers
from storeClientCopy() API, but the underlying memmove() size
calculation bug predates that 2023 change.

[^1]: Bitmask corruption also ought to trigger some hits for objects
that were not present in peer's cache, although such hits were not
observed in triage, and some excessive hits are endemic to our Bloom
filters.

4 weeks agoMaintenance: Remove obsolete snapshot scripts (#2256)
Amos Jeffries [Fri, 3 Oct 2025 06:06:08 +0000 (06:06 +0000)] 
Maintenance: Remove obsolete snapshot scripts (#2256)

The Squid website no longer publishes daily snapshots of code
under development.

5 weeks agoFlip configure --enable-arch-native default (#2261)
Francesco Chemolli [Thu, 2 Oct 2025 20:03:45 +0000 (20:03 +0000)] 
Flip configure --enable-arch-native default (#2261)

Flip the default of configure's `--enable-arch-native` option from
enabled to disabled.

GCC's and clang's `-march=native` argument causes issues in some
environments, most notably containers where the compilers' heuristics
about CPU feature set may fail. These issues manifest as
hard-to-reproduce SIGILL errors in binaries such as `squid` or unit test
programs. The new default is safer. Performance-minded administrators
still have a convenient option to optimize via `--enable-arch-native`.

6 weeks agoSupport no-digest X509 certificate keys like ML-DSA/EdDSA (#2165)
uhliarik [Mon, 22 Sep 2025 13:46:05 +0000 (13:46 +0000)] 
Support no-digest X509 certificate keys like ML-DSA/EdDSA (#2165)

Recent OpenSSL releases (e.g., OpenSSL v3.5) support several private key
types[^1] for which supplying a message digest algorithm is prohibited
when signing a certificate. Prior to this enhancement, Squid was
rejecting https_port and http_port configurations using such key types
(with the above FATAL message) because OpenSSL X509_sign() call made
with a prohibited (for the given key type) non-nil digest algorithm was
failing.

Technically, only listening ports with generate-host-certificates (and
ssl-bump) parameters need to generate X509 certificates and, hence, call
X509_sign(). However, current Squid code generates so called "untrusted"
certificates even for ports that do not support dynamic host certificate
generation or SslBump (XXX). Thus, this enhancement is applicable to
both regular and SslBump configurations.

[^1]: Known no-message-digest key types are ML-DSA-44, ML-DSA-65,
ML-DSA-87, ED25519, and ED448, but others might exist or will be added.
This change was tested against known types, but should support others.
ML-DSA key types are used in post-quantum cryptography.

6 weeks agoSNMP: Match Var allocation/deallocation methods (#2183)
Joshua Rogers [Sat, 20 Sep 2025 16:48:47 +0000 (16:48 +0000)] 
SNMP: Match Var allocation/deallocation methods (#2183)

Pdu::setVars() and Pdu::unpack() allocate variables with `new Var(...)`,
but clearVars() freed them using snmp_var_free(). That skipped the `Var`
destructor and mismatched the allocator.

We hope that all Pdu::variables are allocated via Pdu class methods
despite the presence of snmp_var_new() and snmp_var_clone() calls in
low-level snmplib code.

7 weeks agoFix parsing of malformed quoted squid.conf strings (#2239)
Joshua Rogers [Mon, 15 Sep 2025 14:22:01 +0000 (14:22 +0000)] 
Fix parsing of malformed quoted squid.conf strings (#2239)

Iteration of a quoted token that ends with a backslash (escape with no
next char) kept going past the end of the token. That bug as well as
hypothetical 2KB-byte tokens (exceeding CONFIG_LINE_LIMIT) could also
result in a 1-byte NUL overrun.

7 weeks agoext_ldap_group_acl: Require base dn and user search filter (#2167)
Joshua Rogers [Sat, 13 Sep 2025 12:02:58 +0000 (12:02 +0000)] 
ext_ldap_group_acl: Require base dn and user search filter (#2167)

Make ext_ldap_group_acl require -B (user base DN) and -F (user search
filter) so the helper finds the user before checking group membership.
Fix LDAP referrals handling and make %v always expand to the requested
group name. Improve logging and errors, and include release notes for
the breaking flag requirements.

7 weeks agoHTCP: Check for too-small packed and too-large unpacked fields (#2164)
Joshua Rogers [Thu, 11 Sep 2025 23:33:51 +0000 (23:33 +0000)] 
HTCP: Check for too-small packed and too-large unpacked fields (#2164)

Harden HTCP parsing by checking HTCP fields

- Check packed field lengths and buffer space before reads.
- Guard CLR "reason" when sz < 2; log invalid messages.
- Support old minor==0 layout with safe prefix copy.
- Use early returns and unique_ptr for safer flows.

8 weeks agoMaintenance: Remove extra (and incorrect) error map value (#2238)
Joshua Rogers [Thu, 11 Sep 2025 14:49:16 +0000 (14:49 +0000)] 
Maintenance: Remove extra (and incorrect) error map value (#2238)

ERROR_INVALID_HANDLE is already (correctly) defined as EBADF.

8 weeks agoFix off-by-one in helper args count assertion (#2212)
Joshua Rogers [Thu, 11 Sep 2025 13:27:27 +0000 (13:27 +0000)] 
Fix off-by-one in helper args count assertion (#2212)

The `nargs` value should now be pointing past both the
`HELPER_MAX_ARGS` and the additional terminator. i.e. outside
the valid array space. This is okay because it is an absolute
counter (1-based) not an offset (0-based) despite how it is
used to fill the array.

8 weeks agodigest_edirectory_auth: safely return password (#2197)
Joshua Rogers [Thu, 11 Sep 2025 11:58:52 +0000 (11:58 +0000)] 
digest_edirectory_auth: safely return password (#2197)

Previously, nmasldap_get_simple_pwd() and nmasldap_get_password()
could overrun or return non-terminated strings at length
boundaries. This change adds strict bounds checks, copies at most
len - 1, and ensures explicit NUL termination, aligning both
helpers buffer/length semantics without altering call-site
behavior.

8 weeks agoNoNewGlobals for Auth::Scheme::_Schemes (#2196)
Joshua Rogers [Thu, 11 Sep 2025 10:31:55 +0000 (10:31 +0000)] 
NoNewGlobals for Auth::Scheme::_Schemes (#2196)

8 weeks agoFix purging of entries by relative [Content-]Location URLs (#2235)
Joshua Rogers [Wed, 10 Sep 2025 05:12:19 +0000 (05:12 +0000)] 
Fix purging of entries by relative [Content-]Location URLs (#2235)

8 weeks agoDo not leak file handle on _open_osfhandle() xaccept() failure (#2231)
Joshua Rogers [Wed, 10 Sep 2025 03:48:22 +0000 (03:48 +0000)] 
Do not leak file handle on _open_osfhandle() xaccept() failure (#2231)

8 weeks agoRemove ntlm_sspi_auth helper (#2223)
Amos Jeffries [Wed, 10 Sep 2025 02:26:32 +0000 (02:26 +0000)] 
Remove ntlm_sspi_auth helper (#2223)

As of 2025 Microsoft has officially removed NTLM support from
Windows machines entirely. The SSPI mechanisms will no
longer provide NTLM authentication for this helper to use.

8 weeks agoFix UDP log module opening and closing code (#2214)
Joshua Rogers [Wed, 10 Sep 2025 00:57:09 +0000 (00:57 +0000)] 
Fix UDP log module opening and closing code (#2214)

logfile_mod_udp_open() mistreated successful comm_connect_addr() result
as an "Unable to connect" failure (and vice versa), rendering UDP-based
logging unusable. Broken since at least 2010 commit d938215.

Also fixed logfile_mod_udp_close() closing FD 0 after "Invalid UDP
logging address" ERRORs during logfile_mod_udp_open().

8 weeks agowin32: close pi.hThread as required by Windows API (#2208)
Joshua Rogers [Tue, 9 Sep 2025 18:41:17 +0000 (18:41 +0000)] 
win32: close pi.hThread as required by Windows API (#2208)

Previously, a leak would occur due to an unclosed pi.hThread.

8 weeks agoDo not leak file handle on _open_osfhandle() failure (#2222)
Joshua Rogers [Tue, 9 Sep 2025 17:15:26 +0000 (17:15 +0000)] 
Do not leak file handle on _open_osfhandle() failure (#2222)

8 weeks agoext_file_userip_acl: harden lookups and memory handling (#2198)
Joshua Rogers [Tue, 9 Sep 2025 15:46:55 +0000 (15:46 +0000)] 
ext_file_userip_acl: harden lookups and memory handling (#2198)

Stop mutating getgrnam(3) buffer; iterate gr_mem safely
Zero last node and NULL-check in dict_lookup() to prevent OOB read
Add free_dict() and free dictionary before exit

8 weeks agoext_edirectory_userip_acl: Redact password from stdout (#2156)
Joshua Rogers [Tue, 9 Sep 2025 14:19:52 +0000 (14:19 +0000)] 
ext_edirectory_userip_acl: Redact password from stdout (#2156)

8 weeks agoDo not leak RedirectStateData on snprintf error/truncation (#2205)
Joshua Rogers [Tue, 9 Sep 2025 09:45:48 +0000 (09:45 +0000)] 
Do not leak RedirectStateData on snprintf error/truncation (#2205)

8 weeks agoFix BodyPipe debugging in handleChunkedRequestBody() (#2224)
Joshua Rogers [Tue, 9 Sep 2025 08:18:25 +0000 (08:18 +0000)] 
Fix BodyPipe debugging in handleChunkedRequestBody() (#2224)

8 weeks agoSimplify by removing lazy ACLDomainData::domains initialization (#2182)
Joshua Rogers [Tue, 9 Sep 2025 06:52:44 +0000 (06:52 +0000)] 
Simplify by removing lazy ACLDomainData::domains initialization (#2182)

8 weeks agoext_ldap_group_acl: avoid infinite loop on login containing '%s' (#2217)
Joshua Rogers [Tue, 9 Sep 2025 05:29:34 +0000 (05:29 +0000)] 
ext_ldap_group_acl: avoid infinite loop on login containing '%s' (#2217)

8 weeks agoFix debugging of Eui48::lookup() problems (#2211)
Joshua Rogers [Tue, 9 Sep 2025 04:00:06 +0000 (04:00 +0000)] 
Fix debugging of Eui48::lookup() problems (#2211)

arpReq.arp_ha.sa_data is not a null-terminated buffer.
Log meaningful data: the sa_family which caused the log.

8 weeks agourn: free urn object on initial error (#2195)
Joshua Rogers [Tue, 9 Sep 2025 02:38:48 +0000 (02:38 +0000)] 
urn: free urn object on initial error (#2195)

Previously, the object wasn't freed if an error occurred
when setting the uri.

Also sets the location header to the first url, regardless
of qsort shifting the buffer.

8 weeks agoDNS: Do not leak RR data upon RR data unpacking errors (#2193)
Joshua Rogers [Tue, 9 Sep 2025 01:14:06 +0000 (01:14 +0000)] 
DNS: Do not leak RR data upon RR data unpacking errors (#2193)

8 weeks agodigest_edirectory_auth: Remove useless free in edirectory digest (#2192)
Joshua Rogers [Mon, 8 Sep 2025 23:47:49 +0000 (23:47 +0000)] 
digest_edirectory_auth: Remove useless free in edirectory digest (#2192)

In this codepath, `requestBer` is nullptr.

8 weeks agonegotiate_kerberos_auth: Properly align NDR data (#2186)
Joshua Rogers [Mon, 8 Sep 2025 22:18:21 +0000 (22:18 +0000)] 
negotiate_kerberos_auth: Properly align NDR data (#2186)

Resolves sporadic Negotiate/Kerberos auth failures that manifested
as proxy 407 loops or helper errors when decoding PAC data, depending
on ticket layout.

Previously, the parser advanced bpos by the remainder:
(bpos += bpos %n)
instead of padding to the next multiple of n.

For example, n = 4:
    bpos=5 (r=1): current: 6 (wrong), correct: 8
    bpos=6 (r=2): current: 8 (accidentally right)
    bpos=7 (r=3): current: 10 (wrong), correct: 8

8 weeks agodigest_edirectory_auth: null-terminate NMAS values array (#2184)
Joshua Rogers [Mon, 8 Sep 2025 20:51:22 +0000 (20:51 +0000)] 
digest_edirectory_auth: null-terminate NMAS values array (#2184)

This patch NULL-terminates the NMAS Universal Password values
array (values[1] = nullptr) to match ldap_get_values() semantics
and avoid potential out-of-bounds iteration.

8 weeks agoext_kerberos_ldap_group_acl: avoid freeing getenv() pointer (#2190)
Joshua Rogers [Mon, 8 Sep 2025 19:20:03 +0000 (19:20 +0000)] 
ext_kerberos_ldap_group_acl: avoid freeing getenv() pointer (#2190)

8 weeks agoImprove how NotePairs::find() reports its results (#2175)
Joshua Rogers [Mon, 8 Sep 2025 17:54:42 +0000 (17:54 +0000)] 
Improve how NotePairs::find() reports its results (#2175)

Replaced a problematic combination of a boolean return type and an SBuf
out-parameter with a safer and more readable optional SBuf return type.

8 weeks agontlm_sspi_auth: memcmp not memcpy, send newline, no uninit mem (#2218)
Joshua Rogers [Mon, 8 Sep 2025 16:25:18 +0000 (16:25 +0000)] 
ntlm_sspi_auth: memcmp not memcpy, send newline, no uninit mem (#2218)

Previously, memcpy was incorrectly used instead of memcmp. In addition
to this, uninitalized memory could be used, and responses to Squid were
missing a newline.

8 weeks agoDo not allow client_ip_max_connections+1 connections (#2168)
Joshua Rogers [Mon, 8 Sep 2025 14:43:54 +0000 (14:43 +0000)] 
Do not allow client_ip_max_connections+1 connections (#2168)

Previously, setting client_ip_max_connections to a non-negative N would
allow N+1 client connections, due to an off-by-one error.

8 weeks agoDNS: fix RRPack memcpy to copy rdata buffer, not the pointer (#2189)
Joshua Rogers [Mon, 8 Sep 2025 12:33:38 +0000 (12:33 +0000)] 
DNS: fix RRPack memcpy to copy rdata buffer, not the pointer (#2189)

Fortunately, broken code had no effect because its only caller --
rfc2671RROptPack() that sends EDNS option -- always supplies zero-size
rdata.

Also clarified rfc1035QueryUnpack() implementation using sizeof().

8 weeks agoSNMP: Improve parsing of malformed ASN.1 object identifiers (#2185)
Joshua Rogers [Mon, 8 Sep 2025 11:08:47 +0000 (11:08 +0000)] 
SNMP: Improve parsing of malformed ASN.1 object identifiers (#2185)

ASN.1 object identifiers are length-delimited, not null-terminated. If
the input encoding omits a terminating byte (MSB clear), then the parser
would walk past the buffer.

Also simplified expressions related to sub-identifier parsing.

8 weeks agoAvoid memory leaks when logging to MS Windows syslog (#2154)
Joshua Rogers [Mon, 8 Sep 2025 09:37:01 +0000 (09:37 +0000)] 
Avoid memory leaks when logging to MS Windows syslog (#2154)

8 weeks agoSNMP: Do not send responses that we fail to encode (#2151)
Alex Rousskov [Mon, 8 Sep 2025 08:05:00 +0000 (08:05 +0000)] 
SNMP: Do not send responses that we fail to encode (#2151)

When snmp_build() fails, its output buffer must not be used:

    Syscall param sendto() points to uninitialised byte(s)
        by xsendto() (socket.h:118)
        by comm_udp_sendto() (comm.cc:923)
        by snmpConstructReponse() (snmp_core.cc:449)

Also inform the admin about SNMP encoding failures.

8 weeks agoDo not assert when debugging SNMP requests with long OIDs (#2150)
Alex Rousskov [Mon, 8 Sep 2025 06:40:02 +0000 (06:40 +0000)] 
Do not assert when debugging SNMP requests with long OIDs (#2150)

    FATAL: assertion failed: MemBuf.cc: "new_cap > (size_t) capacity"

Also fixes repeated same-buffer snmpDebugOid() calls that used to
accumulate stale content in snmpTreeNext():

    snmpTreeNext: Current : .1.3.6.1.4.1.3495
    snmpTreeNext: Next : .1.3.6.1.4.1.3495.1.3.6.1.4.1.3495.1.1.1.0

Current snmpDebugOid() callers have been checked for compatibility with
this fix. Fixing snmpDebugOid() API is out of this surgical fix scope.

8 weeks agoFix memory leak when parsing deprecated %rG logformat code (#2187)
Joshua Rogers [Mon, 8 Sep 2025 05:06:43 +0000 (05:06 +0000)] 
Fix memory leak when parsing deprecated %rG logformat code (#2187)

Also terminate the tables for ProxyProtocol and TableTransport %codes.

8 weeks agotext_backend: avoid memory leaks when reload/clearing (#2188)
Joshua Rogers [Sun, 7 Sep 2025 23:04:46 +0000 (23:04 +0000)] 
text_backend: avoid memory leaks when reload/clearing (#2188)

8 weeks agoBug 5504: Document that Squid discards invalid rewrite-url (#2202)
Eduard Bagdasaryan [Sat, 6 Sep 2025 22:16:07 +0000 (22:16 +0000)] 
Bug 5504: Document that Squid discards invalid rewrite-url (#2202)

... values returned by url_rewrite_program.

2 months agoext_kerberos_ldap_group_acl: Improve LDAPMessage freeing (#2181)
Joshua Rogers [Sat, 6 Sep 2025 12:34:22 +0000 (12:34 +0000)] 
ext_kerberos_ldap_group_acl: Improve LDAPMessage freeing (#2181)

Do not free uninitialized or freed LDAPMessage.

2 months agoext_ad_group_acl: Fix domain lookup error handling (#2180)
Joshua Rogers [Sat, 6 Sep 2025 08:28:12 +0000 (08:28 +0000)] 
ext_ad_group_acl: Fix domain lookup error handling (#2180)

On errors, the helper was reporting DsRoleGetPrimaryDomainInformation()
error info using the wrong/bogus error code and probably freeing an
uninitialized pointer.

2 months agoConsistently check strcspn return value (#2166)
Joshua Rogers [Sat, 6 Sep 2025 07:04:21 +0000 (07:04 +0000)] 
Consistently check strcspn return value (#2166)

2 months agoDocs: Fix markdown for squid-bugs link in SECURITY.md (#2201)
Joshua Rogers [Fri, 5 Sep 2025 13:45:03 +0000 (13:45 +0000)] 
Docs: Fix markdown for squid-bugs link in SECURITY.md (#2201)

2 months agoMaintenance: Fix out-of-sync If-None-Match copying explanation (#2200)
Joshua Rogers [Thu, 4 Sep 2025 20:25:19 +0000 (20:25 +0000)] 
Maintenance: Fix out-of-sync If-None-Match copying explanation (#2200)

If `cache_miss_revalidate` is enabled, we append the header.

2 months agonegotiate_wrapper: Search buffer with strchr instead of memchr (#2176)
Joshua Rogers [Wed, 3 Sep 2025 17:36:49 +0000 (17:36 +0000)] 
negotiate_wrapper: Search buffer with strchr instead of memchr (#2176)

Previously, memchr would search tainted data.

2 months agonegotiate_sspi_auth: Do not exit on the first request (#2159)
Joshua Rogers [Wed, 3 Sep 2025 16:15:05 +0000 (16:15 +0000)] 
negotiate_sspi_auth: Do not exit on the first request (#2159)

Broken since 2010 commit 8eeb87e6.

2 months agoReject eui64 ACL addresses with trailing garbage (#2157)
Joshua Rogers [Wed, 3 Sep 2025 13:09:10 +0000 (13:09 +0000)] 
Reject eui64 ACL addresses with trailing garbage (#2157)

Also limit eui64 ACL addresses to 255 characters.

2 months agoFTP: Avoid null dereferences when handling ftp_port traffic (#2172)
Joshua Rogers [Tue, 2 Sep 2025 19:06:12 +0000 (19:06 +0000)] 
FTP: Avoid null dereferences when handling ftp_port traffic (#2172)

`strchr` may return null if a deliminator is not found. Likewise,
if an `Http::HdrType::FTP_REASON` string is not found, nullptr would
be used in the %s formatter, leading to UB.

2 months agoCheck for SNMP objid memory allocation failures (#2162)
Joshua Rogers [Tue, 2 Sep 2025 11:36:42 +0000 (11:36 +0000)] 
Check for SNMP objid memory allocation failures (#2162)

2 months agoAdd RegisteredRunner for HTCP (#2143)
Amos Jeffries [Tue, 2 Sep 2025 05:46:16 +0000 (05:46 +0000)] 
Add RegisteredRunner for HTCP (#2143)

2 months agoReduce testHttpRange dependencies (#2148)
Eduard Bagdasaryan [Sat, 30 Aug 2025 22:09:14 +0000 (22:09 +0000)] 
Reduce testHttpRange dependencies (#2148)

This drastic reduction in testHttpRange dependencies is made possible by
splitting HeaderTools code into several parts:

* Header-mangling code that pulled in many heavy dependencies but was
  unused by testHttpRange code. This high-level code does not belong to
  libhttp, so it was left in src/ (see HeaderMangling.cc).

* Simple header manipulation functions without heavy dependencies; some
  used by testHttpRange code. This low-level code should eventually be
  moved to libhttp, but it was left in HttpHeaderTools.cc for now
  because libhttp itself is currently bloated with heavy dependencies --
  linking with libhttp requires linking with or stubbing a lot of
  code unrelated to testHttpRange.

* Definition of httpHeaderParseQuotedString() and a few other functions
  declared in HttpHeader.h were moved to HttpHeader.cc to improve
  declaration/definition/stubs affinity and avoid linking errors:
  testHttpRange now depends on stub_HttpHeader.cc that has stubs for
  these functions.

* httpHeaderMaskInit() and getStringPrefix() are only used by
  HttpHeader.cc, so they were moved to HttpHeader.cc and made static.

Moved code was unchanged. A few comments were relocated to better match
Squid coding style. A few STUBs were added/adjusted as needed.

TODO: Check the remaining two tests that still include header mangling
code: testHttpRequest and testCacheManager.

2 months agoAdd RegisteredRunner for SNMP (#2142)
Amos Jeffries [Sat, 30 Aug 2025 10:17:49 +0000 (10:17 +0000)] 
Add RegisteredRunner for SNMP (#2142)

2 months agoFix ASN.1 encoding of long SNMP OIDs (#2149)
Alex Rousskov [Sat, 30 Aug 2025 06:49:36 +0000 (06:49 +0000)] 
Fix ASN.1 encoding of long SNMP OIDs (#2149)

2 months agoMaintenance: C++11 default initializers for Comm::Connection (#2147)
Amos Jeffries [Sat, 30 Aug 2025 05:26:44 +0000 (05:26 +0000)] 
Maintenance: C++11 default initializers for Comm::Connection (#2147)

2 months agoAdd origin-form and absolute-path to URI API (#2141)
Amos Jeffries [Sat, 30 Aug 2025 04:00:29 +0000 (04:00 +0000)] 
Add origin-form and absolute-path to URI API (#2141)

Convert callers of Uri::path() as appropriate to their needs.

These methods provide %-encoded URI components for use in
display or normalized processing. The path() method is now only
guaranteed to provide the URL-path component in un-escaped form
(though query has not yet been moved).

2 months agoValidate raw-IPv4 when parsing hostnames (#2140)
Amos Jeffries [Wed, 27 Aug 2025 19:13:15 +0000 (19:13 +0000)] 
Validate raw-IPv4 when parsing hostnames (#2140)

2 months agoRemove DEFAULT_ICP_PORT build variable (#2146)
Amos Jeffries [Tue, 26 Aug 2025 02:36:53 +0000 (02:36 +0000)] 
Remove DEFAULT_ICP_PORT build variable (#2146)

Since 2008 commit df2eec10, this variable has only been used for
icp_port documentation and only in one location. Just stating the IANA
registered port (i.e. 3130) there is better.

2 months agoFix type mismatch in new/delete of addrinfo::ai_addr (#2136)
Ben Kallus [Mon, 11 Aug 2025 13:02:17 +0000 (13:02 +0000)] 
Fix type mismatch in new/delete of addrinfo::ai_addr (#2136)

new/delete type mismatches are UB. Fix an instance of this
problem that occurs when sockaddr_in6 is allocated, but
sockaddr is deallocated, by always allocating/deallocating
sockaddr_storage.

    AddressSanitizer: new-delete-type-mismatch:
      object passed to delete has wrong type:
      size of the allocated type:   28 bytes;
      size of the deallocated type: 16 bytes.
    #0 0xaaaad1a8db54 in operator delete(void*, unsigned long)
    #1 0xaaaad287a668 in Ip::Address::FreeAddr(addrinfo*&)
        src/ip/Address.cc:710:22

2 months agoUpdated CREDITS to better match current repository files (#2139)
Alex Rousskov [Sun, 10 Aug 2025 23:36:26 +0000 (23:36 +0000)] 
Updated CREDITS to better match current repository files (#2139)

Updated a few stale or mispelled paths.

Also deleted CREDITS entries for files deleted in recent commit 1ce58610
that removed basic_smb_lm_auth helper.

Also, acinclude/ax_cxx_compile_stdcxx.m4 got new authors (compared to
its earlier ax_cxx_compile_stdcxx_11.m4 incarnation).

2 months agoRemove smblib and librfcnb (#2138)
Francesco Chemolli [Sat, 9 Aug 2025 23:01:57 +0000 (23:01 +0000)] 
Remove smblib and librfcnb (#2138)

Unused since we removed basic_smb_lm_auth helper.

3 months agoBug 5407: Support at least 1000 groups per Kerberos user (#2047)
Norman Ziert [Tue, 5 Aug 2025 08:31:40 +0000 (08:31 +0000)] 
Bug 5407: Support at least 1000 groups per Kerberos user (#2047)

Increase MAX_PAC_GROUP_SIZE to a more reasonable value,
so negotiate_kerberos_auth can report more than approximately
200 groups an authenticated user is member of back to Squid.

3 months agoMake spell-check.sh happy and remove stale spelling exceptions (#2122)
Amos Jeffries [Mon, 4 Aug 2025 12:20:02 +0000 (12:20 +0000)] 
Make spell-check.sh happy and remove stale spelling exceptions (#2122)

This change fixes a few misspellings identified by Codespell v2.4.1 and
removes all no-longer-used spelling exceptions that we could find. Most
of the fixed misspellings were present but ignored in 2020 commit
2f8abb64 because then-current Codespell v1.16.0 did not flag them.

N.B. GitHub Actions ubuntu-24.04 runner still uses Codespell v1.16.0.

3 months agoFix FTP response parsing and error handling memory leaks (#2133)
Eduard Bagdasaryan [Fri, 1 Aug 2025 19:58:26 +0000 (19:58 +0000)] 
Fix FTP response parsing and error handling memory leaks (#2133)

FTP EPLF parsing leaks in ftpListParseParts() were detected by Coverity.
CID 1660782 and CID 1660785: Resource leaks (RESOURCE_LEAK).

Three other FTP client-related leaks were detected by Valgrind:

* Ftp::CtrlChannel::last_reply
* ErrorPage::ftp::cwd_msg
* Ftp::DataChannel::host

3 months agoEnhance and use POSIX socket compatibility layer (#2046)
Francesco Chemolli [Thu, 31 Jul 2025 18:01:47 +0000 (18:01 +0000)] 
Enhance and use POSIX socket compatibility layer (#2046)

Implement portable wrappers around most socket-related functions, named
x[function], and use them in all callsites.

winsock's socket-related functions are very similar but not
identical to the POSIX standard. Make the mswindows
compatibility layer available to MinGW, and modernize it.

Error highlighting the issue:
```
TcpAcceptor.cc: In member function
  'bool Comm::TcpAcceptor::acceptInto(Comm::ConnectionPointer&)':
TcpAcceptor.cc:352:17: error:
  comparison of unsigned expression in '< 0'
  is always false [-Werror=type-limits]
  352 |     if (rawSock < 0) {
```

3 months agoSimplify Ipc::Strand::handleRegistrationResponse() (#2129)
Eduard Bagdasaryan [Thu, 31 Jul 2025 05:22:56 +0000 (05:22 +0000)] 
Simplify Ipc::Strand::handleRegistrationResponse() (#2129)

Checking PID to ignore stale responses became unnecessary after 2021
commit 4c21861 added Mine() calls that guarantee message freshness.

Also replaced the matching kidId check with an assertion because no IPC
messages, not even stale ones, may be sent to the kid with the wrong kid
identifier. This assertion cannot be easily generalized because most IPC
messages do not contain the kid identifier of the intended recipient.

3 months agoCI: Support customizing CONTRIBUTORS in new contributor PRs (#2128)
Eduard Bagdasaryan [Tue, 29 Jul 2025 12:26:28 +0000 (12:26 +0000)] 
CI: Support customizing CONTRIBUTORS in new contributor PRs (#2128)

When our source-maintenance.sh recognizes a magic phrase in a commit
message, it treats that commit as authoritative for CONTRIBUTORS file.
That feature allows us to customize CONTRIBUTORS by adding a magic
phrase to the commit message, preventing unwanted automated
collectAuthors() actions for earlier commits. Such commits work well
enough when CONTRIBUTORS is customized by an already known Squid
developer in a dedicated PR.

The same feature cannot work for PRs created by new developers because
when quick.yaml tests a PR, the first commit visible to collectAuthors()
is not a PR branch commit that the author could, with some considerable
trouble, customize, but a so called GitHub PR "merge commit" that GitHub
automatically creates with PR creator as the author. That merge commit
message does not contain PR description and never has our magic phrase.
That merge commit author details are wrong when PR creators want to use
information that differs from their public GitHub account info.

With this change, collectAuthors() consults PR description (when testing
PRs), allowing CONTRIBUTORS customization without any extra efforts:
Adding the magic phrase to PR description has to be done anyway.

3 months agoSimplify DelayId composite position management (#2126)
Eduard Bagdasaryan [Tue, 22 Jul 2025 23:42:46 +0000 (23:42 +0000)] 
Simplify DelayId composite position management (#2126)

Moved DelayId::compositeId initialization to the constructor and removed
its setter and getters as unused. Simplified DelayId methods by using
"pool and compositeId are either both set or both unset" invariant that
is now upheld by the two corresponding class constructors.

3 months agoFix scripts/update-contributors.pl CONTRIBUTORS screening (#2125)
Alex Rousskov [Mon, 21 Jul 2025 21:18:14 +0000 (21:18 +0000)] 
Fix scripts/update-contributors.pl CONTRIBUTORS screening (#2125)

    Possible unintended interpolation of @users in string
    Bareword "true" not allowed
    Bareword "false" not allowed
    Execution of ... aborted due to compilation errors

Recent commit daa76f41 broke scripts/update-contributors.pl syntax (see
error messages quoted above) and its lower-case comparison logic,
effectively disabling CONTRIBUTORS checks.

Also do not hide update-contributors.pl execution failures. Buggy
failure detection contributed to the above problems ignored by CI tests.

3 months agoDelayId::operator bool() should account for cache_peer no-delay (#2121)
Eduard Bagdasaryan [Sat, 19 Jul 2025 20:48:12 +0000 (20:48 +0000)] 
DelayId::operator bool() should account for cache_peer no-delay (#2121)

Without this check, a DelayId::operator bool() caller could incorrectly
limit reading from a cache_peer that has been configured to ignore delay
pools. Luckily, all existing code paths that use this operator checked
the markedAsNoDelay flag, avoiding this problem:

* DelayId::bytesWanted() and DelayId::bytesIn() checked markedAsNoDelay.

* While MemObject::delayRead() itself did not check markedAsNoDelay, the
  method is not called when markedAsNoDelay is true. The analysis of the
  corresponding code paths is complex, especially for HttpStateData! We
  also call expensive mostBytesAllowed() several times on these paths.
  Refactoring this code is outside this API safety improvement scope.

This change helps avoid accidental/unwanted read delays during future
code changes.

3 months agoMaintenance: update MemBlob (#2106)
Amos Jeffries [Sat, 12 Jul 2025 14:57:06 +0000 (14:57 +0000)] 
Maintenance: update MemBlob (#2106)

Use C++11 initialization for constructors.

Update documentation for class details matching std::basic_string API.

3 months agoFix SQUID_YESNO 'syntax error near unexpected token' (#2117)
Amos Jeffries [Fri, 11 Jul 2025 13:50:50 +0000 (13:50 +0000)] 
Fix SQUID_YESNO 'syntax error near unexpected token' (#2117)

autoconf can be confused by use of commas (,) in the error
message when the SQUID_YESNO macro is followed by AC_CASE.

3 months agoBug 5499: Remove support for src_as and dst_as ACLs (#2113)
Eduard Bagdasaryan [Wed, 9 Jul 2025 19:59:39 +0000 (19:59 +0000)] 
Bug 5499: Remove support for src_as and dst_as ACLs (#2113)

Squid ACL initialization code calls asnCacheStart() and tries to connect
to an ASN server. If the configuration requires a cache_peer, that
connection fails because none of cache_peers are available an that time:

    WARNING: AS ... whois request failed

Since ASN-based ACLs are essentially unused and properly fixing this
bug requires significant effort work, we drop Autonomous System Numbers
instead. Any rare use cases may implement an external ACL helper with
similar functionality and more features.

Also removed no longer necessary radix.{c,h} code, "asndb" cache manager
report, and "asn" initiator value in transaction_initiator ACLs.

3 months agoReduce UDS/segment name clashes across same-service instances (#2023)
ankor2023 [Wed, 9 Jul 2025 17:45:19 +0000 (17:45 +0000)] 
Reduce UDS/segment name clashes across same-service instances (#2023)

Add a PID file name hash to the names of the shared memory segments and
Unix Domain Sockets. Since all instances running on the same host are
supposed to have unique PID files, this addition significantly reduces
the probability of name clashes when running multiple Squid instances
with the same service name (i.e. the same `squid -n` parameter value
that defaults to "squid").

A clash may still happen if two different PID file names have the same
hash or if multiple instances disable PID file management with
`pid_filename none`. Clashes may also happen in environments where Squid
does not even use service name for naming shared memory segments.

Examples of UDS and shared memory segment names (while using default
service name):

    /var/run/squid/squid-SLWQ-kid-1.ipc
    /var/run/squid/squid-SLWQ-coordinator.ipc
    /dev/shm/squid-SLWQ-tls_session_cache.shm
    /dev/shm/squid-SLWQ-transients_map_slices.shm

This change is a reference point for automated CONTRIBUTORS updates.

3 months agoBug 5303: document regexp dialect (#2110)
Francesco Chemolli [Wed, 9 Jul 2025 16:01:14 +0000 (16:01 +0000)] 
Bug 5303: document regexp dialect (#2110)

Squid currently uses the GNU API providing regex_t and regcomp()
with POSIX.2 implementation expected.

Squid specifically uses/requires the REG_EXTENDED pattern
matching - which is commonly referred to as "POSIX extended
regex".

3 months agoCI: drop FreeBSD 13 testing (#2112)
Francesco Chemolli [Tue, 8 Jul 2025 21:24:57 +0000 (21:24 +0000)] 
CI: drop FreeBSD 13 testing (#2112)

FreeBSD 13 packages are unreliably packaged, causing
version mismatches that lead to CI test failures:

    Newer FreeBSD version for package ztrack:
      - package: 1305000
      - running userland: 1304000
    repository FreeBSD contains packages for wrong OS version

Continue to test on FreeBSD 14 which is more reliable.