]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
9 hours agoReduce UDS/segment name clashes across same-service instances (#2023) v7
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.

9 hours 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.

7 days 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.

7 days 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.

12 days 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.

2 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.

2 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.

3 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.

3 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.

3 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)

3 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)

3 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().

3 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)

3 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

3 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)

3 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)

3 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)

3 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)

3 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.

3 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)

3 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.

3 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.

3 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.

3 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

3 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)

3 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.

3 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().

3 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.

3 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.

3 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)

3 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.

3 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)

3 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.

3 weeks 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.

3 weeks 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.

3 weeks 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)

3 weeks 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.

3 weeks 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.

4 weeks 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.

4 weeks 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.

4 weeks 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.

4 weeks 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)

4 weeks 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)

4 weeks 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)

4 weeks 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)

8 weeks 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.

8 weeks 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

2 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.

2 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.

2 months agov7.1 SQUID_7_1
Francesco Chemolli [Thu, 10 Jul 2025 10:34:16 +0000 (10:34 +0000)] 
v7.1

2 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".

2 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.

2 months agoBug 5498: cachemgr documentation improvements (#2109)
Francesco Chemolli [Sat, 5 Jul 2025 15:55:34 +0000 (15:55 +0000)] 
Bug 5498: cachemgr documentation improvements (#2109)

Be more explicit in documenting squid's well-known-prefix
for cache manager in the release notes

3 months agoRemove basic_smb_lm_auth helper (#2009)
Francesco Chemolli [Thu, 6 Mar 2025 00:24:22 +0000 (00:24 +0000)] 
Remove basic_smb_lm_auth helper (#2009)

This helper implementation is based on an old snapshot and adaptation of
Samba code. Samba project offers a more secure and better maintained
tool.

3 months agoBug 5497: Fix detection of duped IPs returned by getaddrinfo() (#2100)
aafbsd [Thu, 26 Jun 2025 18:57:19 +0000 (18:57 +0000)] 
Bug 5497: Fix detection of duped IPs returned by getaddrinfo() (#2100)

    WARNING: Ignoring <IP X> because it is already covered by <IP X>

Affects `src`, `dst`, and `localip` ACLs, especially those that use
domain names with multiple DNS A or AAAA records.

IP addresses returned by getaddrinfo(3) may not be sorted (e.g., when a
host has multiple DNS A RRs on FreeBSD). Instead of comparing the
current address with just the previous one, we now check all previously
added addresses (while processing a single getaddrinfo() call output).

This surgical fix minimizes changes without improving surrounding code.

3 months agoDocs: Describe cf.data.depend purpose (#2102)
Alex Rousskov [Wed, 25 Jun 2025 18:38:40 +0000 (18:38 +0000)] 
Docs: Describe cf.data.depend purpose (#2102)

3 months agoMaintenance: remove some duplicate auth code (#2097)
Amos Jeffries [Mon, 23 Jun 2025 23:11:47 +0000 (23:11 +0000)] 
Maintenance: remove some duplicate auth code (#2097)

3 months agov7.0.2 SQUID_7_0_2
Francesco Chemolli [Fri, 20 Jun 2025 16:47:09 +0000 (16:47 +0000)] 
v7.0.2

3 months agoFix missing CONTRIBUTOR name (#2091)
Amos Jeffries [Sun, 22 Jun 2025 00:48:05 +0000 (00:48 +0000)] 
Fix missing CONTRIBUTOR name (#2091)

Despite CONTRIBUTORS file being UTF-8 Ture's name
was dropped by our conversion script which does not
handle non-ASCII characters nicely. Re-add it manually.

3 months agoPrep for v7.0.2 (#2090)
Francesco Chemolli [Fri, 20 Jun 2025 12:16:21 +0000 (13:16 +0100)] 
Prep for v7.0.2 (#2090)

Co-authored-by: Amos Jeffries <yadij@users.noreply.github.com>
3 months agoDo not duplicate received Surrogate-Capability in sent requests (#2087)
Eduard Bagdasaryan [Tue, 17 Jun 2025 21:00:51 +0000 (21:00 +0000)] 
Do not duplicate received Surrogate-Capability in sent requests (#2087)

When computing Surrogate-Capability header while forwarding an
accelerated request, Squid duplicated old (i.e. received) header entries
(if any). For example, this outgoing request shows an extra hop1 entry:

    GET / HTTP/1.1
    ...
    Surrogate-Capability: hop1="Surrogate/1.0"
    Surrogate-Capability: hop1="Surrogate/1.0", hop2="Surrogate/1.0"

3 months agoCI: Update tested Linux versions to current (#2080)
Francesco Chemolli [Tue, 10 Jun 2025 06:05:06 +0000 (06:05 +0000)] 
CI: Update tested Linux versions to current (#2080)

Fedora 40 is EOL, and add CentOS Stream 10 and Ubuntu Plucky

3 months agoCI: Fix gperf 3.2 output filter (#2081)
Amos Jeffries [Mon, 9 Jun 2025 04:49:04 +0000 (04:49 +0000)] 
CI: Fix gperf 3.2 output filter (#2081)

gperf 3.2 now provides properly compiler and C++ version scoped
fallthrough attributes. Our filter to convert the gperf 3.1 and
older output for C++17 attribute requirements is now broken and
produces compiler errors due to listing '[[fallback]];' on two
consecutive lines.

3 months agoFix OpenSSL build with GCC v15.1.1 [-Wformat-truncation=] (#2077)
Francesco Chemolli [Tue, 3 Jun 2025 12:29:30 +0000 (12:29 +0000)] 
Fix OpenSSL build with GCC v15.1.1 [-Wformat-truncation=] (#2077)

On arm64 Fedora 42:

    src/ssl/crtd_message.cc:132:39: error: '%zd' directive output may be
        truncated writing between 1 and 19 bytes into a region
        of size 10 [-Werror=format-truncation=]
        snprintf(buffer, sizeof(buffer), "%zd", body.length());

4 months agoDisable EUI when arpreq is missing and cannot be defined (#2070)
Francesco Chemolli [Sat, 31 May 2025 18:40:35 +0000 (18:40 +0000)] 
Disable EUI when arpreq is missing and cannot be defined (#2070)

OpenBSD 7.7 provides a net/if_arp.h header file,
but it doesn't provide a `struct arpreq`, which
is necessary for our EUI implementation to work.

Disable EUI when arpreq definition is missing,
except on Windows where we provide our own.

4 months agoCI: Pin OpenBSD 7.6
Francesco Chemolli [Sun, 11 May 2025 10:26:36 +0000 (11:26 +0100)] 
CI: Pin OpenBSD 7.6

OpenBSD 7.7 introduces some changes that fail our build.
Pin version 7.6 while we work on version 7.7 adoption.

4 months agoFix SNMP cacheNumObjCount -- number of cached objects (#2053) 2074/head
Carl Vuosalo [Wed, 28 May 2025 19:17:38 +0000 (19:17 +0000)] 
Fix SNMP cacheNumObjCount -- number of cached objects (#2053)

SNMP counter cacheNumObjCount used StoreEntry::inUseCount() stats. For
Squid instances using a rock cache_dirs or a shared memory cache, the
number of StoreEntry objects in use is usually very different from the
number of cached objects because these caches do not use StoreEntry
objects as a part of their index. For all instances, inUseCount() also
includes ongoing transactions and internal tasks that are not related to
cached objects at all.

We now use the sum of the counters already reported on "on-disk objects"
and "Hot Object Cache Items" lines in "Internal Data Structures" section
of `mgr:info` cache manager report. Due to floating-point arithmetic,
these stats are approximate, but it is best to keep SNMP and cache
manager reports consistent.

This change does not fix SNMP Gauge32 overflow bug: Caches with 2^32 or
more objects continue to report wrong/smaller cacheNumObjCount values.

### On MemStore::getStats() and StoreInfoStats changes

To include the number of memory-cached objects while supporting SMP
configurations with shared memory caches, we had to change how cache
manager code aggregates StoreInfoStats::mem data collected from SMP
worker processes. Before these changes, `StoreInfoStats::operator +=()`
used a mem.shared data member to trigger special aggregation code hack,
but

* SNMP-specific code cannot benefit from that StoreInfoStats aggregation
  because SNMP code exchanges simple counters rather than StoreInfoStats
  objects. `StoreInfoStats::operator +=()` is never called by SNMP code.
  Instead, SNMP uses Snmp::Pdu::aggregate() and friends.

* We could not accommodate SNMP by simply adding special aggregation
  hacks directly to MemStore::getStats() because that would break
  critical "all workers report about the same stats" expectations of the
  special hack in `StoreInfoStats::operator +=()`.

To make both SNMP and cache manager use cases work, we removed the hack
from StoreInfoStats::operator +=() and hacked MemStore::getStats()
instead, making the first worker responsible for shared memory cache
stats reporting (unlike SMP rock diskers, there is no single kid process
dedicated to managing a shared memory cache). StoreInfoStats operator
now uses natural aggregation logic without hacks.

TODO: After these changes, StoreInfoStats::mem.shared becomes
essentially unused because it was only used to enable special
aggregation hack in StoreInfoStats that no longer exists. Remove?

4 months agoBug 5352: Do not get stuck in RESPMOD after pausing peer read(2) (#2065)
Eduard Bagdasaryan [Tue, 20 May 2025 18:52:04 +0000 (18:52 +0000)] 
Bug 5352: Do not get stuck in RESPMOD after pausing peer read(2) (#2065)

The transaction gets stuck if Squid, while sending virgin body bytes to
an ICAP RESPMOD service, temporary stops reading additional virgin body
bytes from cache_peer or origin server. Squid pauses reading (with
readSizeWanted becoming zero) if reading more virgin bytes is temporary
prohibited by delay pools and/or read_ahead_gap limits:

    readReply: avoid delayRead() to give adaptation a chance to drain...

HttpStateData::readReply() starts waiting for ModXact to drain the
BodyPipe buffer, but that draining may not happen, either because
ModXact::virginConsume() is not called at all[^1] or because it is
"postponing consumption" when BodyPipe still has some unused space[^2].

With HttpStateData not reading more virgin bytes, Squid may not write
more virgin body bytes to the ICAP service, and the ICAP service may not
start or continue responding to the RESPMOD request. Without that ICAP
activity, ModXact does not consume, the virgin BodyPipe buffer is not
drained, HttpStateData is not reading, and no progress is possible.

HttpStateData::readReply() should start waiting for adaptation to drain
BodyPipe only when the buffer becomes completely full (instead of when
it is not empty). This change may increase virgin response body bytes
accumulation but not the buffer capacity because existing buffer
space-increasing logic in maybeMakeSpaceAvailable() remains intact.

To prevent stalling, both BodyPipe ends (i.e. HttpStateData and
Icap::ModXact) must use matching "progress is possible" conditions, but

* HttpStateData used hasContent()
* Icap::ModXact used spaceSize()
* Ftp::Client used potentialSpaceSize()

Now, all three use matching potentialSpaceSize()-based conditions.

Squid eCAP code is unaffected by this bug, because it does not postpone
BodyPipe consumption. eCAP API does not expose virgin body buffer
capacity, so an eCAP adapter that postpones consumption risks filling
the virgin body buffer and stalling. This is an eCAP API limitation.

Broken since 2024 commit cc8b26f.

[^1]: Zero readSizeWanted is reachable without delay pools, but only if
Squid receives an adapted response (that makes readAheadPolicyCanRead()
false by filling StoreEntry). Ideally, receiving an adapted response
should result in a virginConsume() calls (that would trigger BodyPipe
draining), but currently it may not. Reliably starting virgin data
consumption sooner is not trivial and deserves a dedicated change.

[^2]: ModXact postpones consumption to preserve virgin bytes for ICAP
retries and similar purposes. ModXact believes it is safe to postpone
because there is still space left in the buffer for HttpStateData to
continue to make progress. ModXact would normally start or resume
draining the buffer when sending more virgin bytes to the ICAP service.

4 months agoMaintenance: Remove shared LDADD (#2058)
Amos Jeffries [Sun, 18 May 2025 06:39:04 +0000 (06:39 +0000)] 
Maintenance: Remove shared LDADD (#2058)

Most built binaries have a distinct set of dependencies and already have
their own foo_LDADD variables. Add a few variables to cover the
remaining binaries and stop setting an (incomplete) LDADD global.

Also removed unnecessary EXTRA_PROGRAMS because mem_node_test and splay
binaries are built unconditionally.

4 months agoBug 5316: Release note says version 6 still for testing (#2066)
Amos Jeffries [Sun, 18 May 2025 04:57:29 +0000 (04:57 +0000)] 
Bug 5316: Release note says version 6 still for testing (#2066)

5 months agoSource Format Enforcement (#2041)
squidadm [Wed, 23 Apr 2025 07:37:02 +0000 (19:37 +1200)] 
Source Format Enforcement (#2041)

5 months agoBug 5489: Fix "make check" linking on Solaris (#2049)
Francesco Chemolli [Sun, 13 Apr 2025 22:56:57 +0000 (22:56 +0000)] 
Bug 5489: Fix "make check" linking on Solaris (#2049)

Change link order of libcomm and libip to fix missing symbols at link
time on Solaris:

    libtool: link: /usr/gcc/14/bin/g++ ... -o tests/testCacheManager
    _ZN2Ip11InterceptorE ... libcomm.a
    _ZN2Ip9Intercept9LookupNatERKN4Comm10ConnectionE ... libcomm.a
    ld: fatal: symbol referencing errors

5 months agoCI: update FreeBSD version (#2051)
Francesco Chemolli [Sun, 13 Apr 2025 21:11:46 +0000 (21:11 +0000)] 
CI: update FreeBSD version (#2051)

The FreeBSD project has promoted version 14.2 to stable.
Some packages we use are not compatible with version 14.1.
Upgrade the reference version we use, the action supports it

6 months agoFix GCC v13 LTO build [-Walloc-size-larger-than=] (#1929)
Julien [Sun, 23 Feb 2025 20:06:06 +0000 (20:06 +0000)] 
Fix GCC v13 LTO build [-Walloc-size-larger-than=] (#1929)

    store/Disks.cc:690: error: argument 1 value 18446744073709551615
        exceeds maximum object size 9223372036854775807
        [-Werror=alloc-size-larger-than=]
    const auto tmp = new SwapDir::Pointer[swap->n_allocated];

    pconn.cc:43:53: error: argument 1 value 18446744073709551615 ...
    theList_ = new Comm::ConnectionPointer[capacity_];

Tested on Ubuntu 24.04 and GCC v13.2.0.

6 months agoFix tls-dh support for DHE parameters with OpenSSL v3+ (#1949)
Andreas Weigel [Thu, 13 Mar 2025 11:30:28 +0000 (11:30 +0000)] 
Fix tls-dh support for DHE parameters with OpenSSL v3+ (#1949)

    # When applying tls-dh=prime256v1:dhparams.pem configuration:
    WARNING: Failed to decode EC parameters 'dhparams.pem'

    # When forcing the use of FFDHE with something like
    # openssl s_client -tls1_2 -cipher DHE-RSA-AES256-SHA256 -connect...
    ERROR: failure while accepting a TLS connection on:
        SQUID_TLS_ERR_ACCEPT+TLS_LIB_ERR=A0000C1+TLS_IO_ERR=1

Squid `https_port ... tls-dh=curve:dhparams.pem` configuration is
supposed to support _both_ ECDHE and FFDHE key exchange mechanisms (and
their cipher suites), depending on client-supported cipher suites. ECDHE
mechanism should use the named curve (e.g., `prime256v1`), and FFDHE
mechanism should use key exchange parameters loaded from the named PEM
file (e.g., `ffdhe4096` named group specified in RFC 7919).

When 2022 commit 742236c added support for OpenSSL v3 APIs, new
loadDhParams() code misinterpreted curve name presence in `tls-dh` value
as an indication that the named parameters file contains ECDHE
parameters, setting OSSL_DECODER_CTX_new_for_pkey() type parameter to
"EC", and (when parameter file specified FFDHE details) triggering the
WARNING message quoted above.

Squid should not expect additional ECDHE parameters when the elliptic
curve group is already fully specified by naming it at the start of
`tls-dh` value. Squid now reverts to earlier (v4) behavior, where
the two mechanisms can coexist and can be configured separately as
described above:

    $ openssl s_client -tls1_2 -cipher DHE-RSA-AES256-SHA256 -connect...
    Server Temp Key: DH, 4096 bits

    $ openssl s_client -connect...
    Server Temp Key: ECDH, prime256v1, 256 bits

Furthermore, updateContextEecdh() code in commit 742236c continued  to
load parsed parameters using old SSL_CTX_set_tmp_dh() call but should
have used SSL_CTX_set0_tmp_dh_pkey() API because the type of parsed
parameters (i.e. DhePointer) have changed from DH to EVP_PKEY pointer.
This second bug affected configurations with and without an explicit
curve name in `tls-dh` value.

Also report a failure to load parsed parameters into TLS context.

6 months agoNoNewGlobals for cbdata_htable (#1991)
Eduard Bagdasaryan [Wed, 5 Feb 2025 12:58:59 +0000 (12:58 +0000)] 
NoNewGlobals for cbdata_htable (#1991)

This fix also reduces memory leak false positives
reported by Valgrind.

6 months agoCI: Do not classify "no failures" stats as test-build errors (#2001)
Francesco Chemolli [Mon, 24 Feb 2025 19:01:52 +0000 (19:01 +0000)] 
CI: Do not classify "no failures" stats as test-build errors (#2001)

CppUnit tests emit a lot of "FAIL: 0" and "XFAIL: 0" lines, which are
incorrectly classified as errors by the test-builds.sh. Filter these
messages out as they are not indicative of problems.

6 months agoMinGW: use nameless unions in ext_ad_group_acl (#2004)
Francesco Chemolli [Tue, 4 Mar 2025 15:15:06 +0000 (15:15 +0000)] 
MinGW: use nameless unions in ext_ad_group_acl (#2004)

ext_ad_group_acl was written in 2008 in C, and
it used the C variant of the Win32 API.
It was then ported to C++, but the API callers were
not updated to the C++ version of the API.
With more modern compilers, and
Squid enforcing more strict types and error handling,
it is no longer compiling.

This is part 1 of 2 of the fixes to make the helper build
again, the scope is to update Win32 API callers so they
use the C++ version of the API

Examples of fixed errors:

    error: 'IADs' {aka 'struct IADs'} has no member named 'lpVtbl'
    error: 'VARIANT' {aka 'struct tagVARIANT'} has no member named 'n1'

6 months agoFix Mem::Segment::open() stub to fix build without shm_open() (#2016)
Francesco Chemolli [Fri, 14 Mar 2025 15:55:44 +0000 (15:55 +0000)] 
Fix Mem::Segment::open() stub to fix build without shm_open() (#2016)

When the environment does not HAVE_SHM, Ipc::Mem::Segment::open() method
definition does not match its declaration. Make it match.

    src/ipc/mem/Segment.cc:346:1: error: no declaration matches
    void Ipc::Mem::Segment::open()
    src/ipc/mem/Segment.h:37:10: note: candidate is:
    void Ipc::Mem::Segment::open(bool)

6 months agoMingGW: do not build ext_edirectory_userip_acl (#2017)
Francesco Chemolli [Sun, 16 Mar 2025 23:25:46 +0000 (23:25 +0000)] 
MingGW: do not build ext_edirectory_userip_acl (#2017)

ext_edirectory_userip_acl uses API that are too
different from what is provided by windlap.h, do not build it

6 months agoMinGW: add mkdir adapter (#2018)
Francesco Chemolli [Fri, 14 Mar 2025 17:21:31 +0000 (17:21 +0000)] 
MinGW: add mkdir adapter (#2018)

On Windows, mkdir only takes one argument.
compat/mswindows.h has an adapter, add it to
compat/mingw.h as well.

Solves error:

```
UFSSwapDir.cc:617:26: error: too many arguments
    to function 'int mkdir(const char*)'
mingw/include/io.h:282:15: note: declared here
    int __cdecl mkdir (const char *);
```

6 months agoMinGW: fix store/Controller.cc build (#2019)
Francesco Chemolli [Sat, 15 Mar 2025 03:38:36 +0000 (03:38 +0000)] 
MinGW: fix store/Controller.cc build (#2019)

    error: 'WNOHANG' was not declared in this scope

6 months agoMinGW: fix aio compatibility layer (#2020)
Francesco Chemolli [Thu, 13 Mar 2025 21:21:48 +0000 (21:21 +0000)] 
MinGW: fix aio compatibility layer (#2020)

The AIO Windows compatibilty layer is also
necessary on mingw

Problems fixed:

```
DiskIO/AIO/async_io.h:58:18:
    error: field 'aq_e_aiocb' has incomplete type 'aiocb'
DiskIO/AIO/async_io.h:58:12:
     note: forward declaration of 'struct aiocb'

DiskIO/AIO/AIODiskFile.cc:
    In member function
    'virtual void AIODiskFile::read(ReadRequest*)':
src/DiskIO/AIO/AIODiskFile.cc:134:9:
    error: 'aio_read' was not declared in this scope;
    did you mean 'file_read' ?
```

6 months agoPortability: add include guards to ldap_backend.cc (#2021)
Francesco Chemolli [Sat, 15 Mar 2025 05:00:49 +0000 (05:00 +0000)] 
Portability: add include guards to ldap_backend.cc (#2021)

In the non-Windows case, we unconditinoally
include some system headers. Add conditions
for improved portability

Fixes error:
```
src/auth/digest/LDAP/ldap_backend.cc:49:10:
   fatal error: lber.h: No such file or directory
```

6 months agoMinGW: add libnettle to negotiate_sspi_auth (#2024)
Francesco Chemolli [Fri, 14 Mar 2025 00:40:13 +0000 (00:40 +0000)] 
MinGW: add libnettle to negotiate_sspi_auth (#2024)

libnettle is needed to build negotiate_sspi_auth.

This change fixes many errors similar to:

    negotiate_sspi_auth.cc:126: undefined reference to
        nettle_base64_decode_init

6 months agonegotiate_sspi_auth: Fix command debugging (-v) (#2025)
Francesco Chemolli [Sun, 16 Mar 2025 14:15:56 +0000 (14:15 +0000)] 
negotiate_sspi_auth: Fix command debugging (-v) (#2025)

Terminate helper_command buffer before using it as a c-string. Supported
helper commands have two characters.

This change also reduces MinGW build errors.

6 months agontlm_sspi_auth: Fix missing base64 symbol linkage (#2031)
Francesco Chemolli [Sat, 22 Mar 2025 22:30:29 +0000 (22:30 +0000)] 
ntlm_sspi_auth: Fix missing base64 symbol linkage (#2031)

Solve build error:

```
ld: ntlm_sspi_auth.o: in function `token_decode':
    undefined reference to `nettle_base64_decode_init'
    undefined reference to `nettle_base64_decode_update'
    undefined reference to `nettle_base64_decode_final'
```

7 months agov7.0.1 SQUID_7_0_1
Francesco Chemolli [Tue, 11 Feb 2025 22:12:52 +0000 (22:12 +0000)] 
v7.0.1

7 months agoCI: prepare for v7
Francesco Chemolli [Sun, 2 Feb 2025 23:23:53 +0000 (23:23 +0000)] 
CI: prepare for v7

7 months agoPrep for v7.0.1 (#1988)
Francesco Chemolli [Sun, 2 Feb 2025 15:49:05 +0000 (15:49 +0000)] 
Prep for v7.0.1 (#1988)

Add v7.0.1 ChangeLog section.
Incorporate changes from v6.8 to v6.13 (inclusive).

8 months agoFix eCAP build broken by Adaptation::Config::metaHeaders change (#1987)
Eduard Bagdasaryan [Tue, 21 Jan 2025 13:19:47 +0000 (13:19 +0000)] 
Fix eCAP build broken by Adaptation::Config::metaHeaders change (#1987)

2024 master/v7 commit 984577ac replaced Adaptation::Config::metaHeaders
data member with a function but did not update metaHeaders users in eCAP
code.

8 months agoFix GCC v14 [-Wanalyzer-null-dereference] warnings in Kerberos (#1983)
huaraz [Fri, 17 Jan 2025 17:08:18 +0000 (17:08 +0000)] 
Fix GCC v14 [-Wanalyzer-null-dereference] warnings in Kerberos (#1983)

    src/acl/external/kerberos_ldap_group/support_sasl.cc:190:17: error:
    dereference of NULL 'defs' [CWE-476] [-Wanalyzer-null-dereference]

    src/auth/negotiate/kerberos/negotiate_kerberos_pac.cc:235:19: error:
    dereference of NULL 'Rids' [CWE-476] [-Wanalyzer-null-dereference]

8 months agoBug 5091: document that changes to workers require restart (#1980)
Francesco Chemolli [Wed, 15 Jan 2025 07:49:13 +0000 (07:49 +0000)] 
Bug 5091: document that changes to workers require restart (#1980)

8 months agoBug 5481: Fix GCC v14 build [-Wmaybe-uninitialized] (#1982)
Alex Rousskov [Tue, 14 Jan 2025 19:22:36 +0000 (19:22 +0000)] 
Bug 5481: Fix GCC v14 build [-Wmaybe-uninitialized] (#1982)

Successful xstrtoui(start,end) calls do initialize `end`, but we can
polish this code and avoid triggering that GCC warning at the same time.

8 months agoImprove Tunnel Server RESPONSE dumps (#1975)
Eduard Bagdasaryan [Mon, 13 Jan 2025 19:53:36 +0000 (19:53 +0000)] 
Improve Tunnel Server RESPONSE dumps (#1975)

Level-2 "Tunnel Server RESPONSE:..." debugs() incorrectly assumed that
its readBuf parameter contained hdr_sz header bytes. In reality, by the
time code reached that debugs(), readBuf no longer had any header bytes
(and often had no bytes at all). Besides broken header dumps, this bug
could lead to problems that Valgrind reports as "Conditional jump or
move depends on uninitialised value" in DebugChannel::writeToStream().

This fix mimics HttpStateData::processReplyHeader() reporting code,
including its known problems. Future changes should address those
problems and reduce code duplication across at least ten functions
containing similar "decorated" level-2 message dumps.

8 months agoBug 5311: clarify configuration byte units (#1979)
Francesco Chemolli [Thu, 9 Jan 2025 14:58:13 +0000 (14:58 +0000)] 
Bug 5311: clarify configuration byte units (#1979)

8 months agoBug 5093: List http_port params that https_port/ftp_port lack (#1977)
Francesco Chemolli [Tue, 7 Jan 2025 23:20:48 +0000 (23:20 +0000)] 
Bug 5093: List http_port params that https_port/ftp_port lack (#1977)

To avoid documentation duplication, current https_port and ftp_port
directive descriptions reference http_port directive instead of
detailing their own supported parameters. For https_port, this solution
creates a false impression that the directive supports all http_port
options. Our ftp_port documentation is better but still leaves the
reader guessing which options are actually supported.

This change starts enumerating http_port configuration parameters that
ftp_port and https_port directives do _not_ support. Eventually, Squid
should reject configurations with unsupported listening port options.

9 months agoCI: Add workflow_dispatch to workflows that still lack it (#1976)
Francesco Chemolli [Tue, 31 Dec 2024 23:18:39 +0000 (23:18 +0000)] 
CI: Add workflow_dispatch to workflows that still lack it (#1976)

Manually triggering a workflow rerun is handy when troubleshooting. Our
coverity-scan.yaml workflow already has a workflow_dispatch trigger.

9 months agoWork around some mgr:forward accounting/reporting bugs (#1969)
Alex Rousskov [Tue, 31 Dec 2024 21:59:05 +0000 (21:59 +0000)] 
Work around some mgr:forward accounting/reporting bugs (#1969)

In modern code, FwdReplyCodes[0][i] is usually zero because n_tries is
usually at least one at logReplyStatus() call time. This leads to
mgr:forward report showing nothing but table heading (i.e. no stats)

Also improve `try#N` heading:data match by skipping FwdReplyCodes[0]
reporting (there is still no `try#0` heading) and adding a previously
missing `try#9` heading

9 months agoClarify --enable-ecap failure on missing shared library support (#1968)
Alex Rousskov [Tue, 31 Dec 2024 20:40:46 +0000 (20:40 +0000)] 
Clarify --enable-ecap failure on missing shared library support (#1968)

    checking if libtool supports shared libraries... no
    checking whether to build shared libraries... no
    configure: error: eCAP support requires loadable modules.
        Please do not use --disable-shared with --enable-ecap.

After 2022 commit 5a2409b7, our advice for handling the above error
became misleading in environments that do not --disable-shared
explicitly but lack shared libraries support for other reasons