Commit graph

36622 commits

Author SHA1 Message Date
Viktor Szakats
2b30d29c3c
autotools: merge ifs in GnuTLS/OpenSSL feature detection
Closes #19222
2025-10-24 22:53:26 +02:00
Viktor Szakats
833da09b53
vtls: drop duplicate CURL_SHA256_DIGEST_LENGTH definition
Closes #19224
2025-10-24 19:16:53 +02:00
Viktor Szakats
207a74206b
mbedtls: fix building with sha-256 missing from PSA
Fixing:
```
lib/vtls/mbedtls.c:1505:10: error: call to undeclared function 'Curl_sha256it'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
 1505 |   return Curl_sha256it(sha256sum, input, inputlen);
      |          ^
1 error generated.
```

with mbedTLS configuration:
```
tf-psa-crypto/scripts/config.py unset PSA_WANT_ALG_SHA_256
tf-psa-crypto/scripts/config.py unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS
tf-psa-crypto/scripts/config.py unset MBEDTLS_LMS_C
```

Follow-up to 3a305831d1 #19077

Closes #19223
2025-10-24 19:14:28 +02:00
Viktor Szakats
f4293cd81e
GHA/dependabot: group updates
To avoid update spam and PR that can't be applied on top of each other.

Ref: #19217 #19218 #19219

Closes #19220
2025-10-24 15:05:15 +02:00
dependabot[bot]
e0d6ecdf01
GHA: bump pips
- cryptography from 46.0.2 to 46.0.3 in /tests
- filelock from 3.19.1 to 3.20.0 in /tests
- psutil from 7.1.0 to 7.1.1 in /tests

Closes #19217
Closes #19218
Closes #19219
2025-10-24 15:02:24 +02:00
Viktor Szakats
7d0261c228
GHA/checksrc: extend zizmor to Dependabot, set cooldown periods
Closes #19216
2025-10-24 14:01:04 +02:00
Viktor Szakats
87ab1cd255
GHA/fuzz: try fixing concurrency group deadlock
```
Fuzzer
Canceling since a deadlock was detected for concurrency group:
'Fuzzer-82fa9862dfa3083d4014d6dcfb721a7278e66f0b' between a top level workflow and 'Fuzzing'
```
https://github.com/curl/curl/actions/runs/18778617351

Follow-up to 82fa9862df #19215
2025-10-24 13:46:14 +02:00
Viktor Szakats
82fa9862df
GHA: set concurrency: where missing
To silence zizmor 1.16.0 warnings.

Also:
- http3-linux: replace hard-coded workflow name with variable.
  Follow-up to a8174176b5 #13841
- codeql: set `cancel-in-progress: true`.
  zizmor apparently does not allow `false` in pedantic mode anymore:
  https://github.com/zizmorcore/zizmor/pull/1227
- codeql: sync concurrency setting with the rest of the jobs.
  (I'm not sure this is correct, or why it was previously special-cased.)

Expressions used (before and after this patch):
- `group: ${{ github.workflow }}-${{ github.event.sha }}-${{ github.event.target_url }}`
  for GHA/appveyor-status.
- `group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}`
  for all the rest.

Ref: https://github.com/curl/curl/actions/runs/18776245057/job/53571438139?pr=19209

Closes #19215
2025-10-24 13:38:11 +02:00
Viktor Szakats
c96b7c4636
des: merge curl_des into curl_ntlm_core.c
`curl_des.c` contained a single, short, function
`Curl_des_set_odd_parity()`, called from `curl_ntlm_core.c` alone.

Move it there, and define it only when needed.

Follow-up to 300876a7a6
Follow-up to 8cc70db2db

Closes #19209
2025-10-24 12:39:27 +02:00
Viktor Szakats
4a6fbd5e1d
NTLM: disable if DES support missing from OpenSSL or mbedTLS
Make autotools and cmake detect DES support in OpenSSL and mbedTLS.
Forward feature macros to C and omit NTLM from the feature preview list.
Use the feature macros in source. This ensure that `-V` output matches
the preview.

OpenSSL doesn't support DES when built with `no-des` or `no-deprecated`.
mbedTLS 4.x no longer supports it, and it's possible to disable it in
<4 with `scripts/config.py unset MBEDTLS_DES_C`.

Before this patch this worked for
mbedTLS 4 only, and with a regression for pending PR #16973.

Also:

- drop NTLM feature check from `curl_setup.h` in favour of autotools/
  cmake feature macros. This makes `curl_setup.h` no longer need
  to include an mbedTLS header, which in turn makes tests/server build
  without depending on mbedTLS.
  Fixing, in #16973:
  ```
  In file included from tests/server/first.h:40,
                   from bld/tests/server/servers.c:3:
  lib/curl_setup.h:741:10: fatal error: mbedtls/version.h: No such file or directory
    741 | #include <mbedtls/version.h>
        |          ^~~~~~~~~~~~~~~~~~~
  ```
  Ref: https://github.com/curl/curl/actions/runs/18689537893/job/53291322012?pr=16973
  Ref: #19181 (initial fix idea)
  Follow-up to 3a305831d1 #19077

- move back mbedTLS header include and version check from
  `curl_setup.h` to each source which consumes mbedTLS.

- GHA/http3-linux: drop workaround that disabled NTLM for
  `no-deprecated` OpenSSL builds.
  Follow-up to 006977859d #12384

- curl_ntlm_core: drop pointless macro `CURL_NTLM_NOT_SUPPORTED`.
  Follow-up to 006977859d #12384

Closes #19206
2025-10-24 12:12:20 +02:00
Viktor Szakats
1de4a9a5fb
mbedtls: fix building with <3.6.1
```
lib/vtls/mbedtls.c:786:3: error: call to undeclared function 'mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  786 |   mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets(&backend->config,
      |   ^
lib/vtls/mbedtls.c:787:5: error: use of undeclared identifier 'MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_ENABLED'; did you mean 'MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH'?
  787 |     MBEDTLS_SSL_TLS1_3_SIGNAL_NEW_SESSION_TICKETS_ENABLED);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH
dep/mbedtls-3.4.0/_pkg/include/mbedtls/ssl.h:700:5: note: 'MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH' declared here
  700 |     MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH,
      |     ^
2 errors generated.
```

Regression from d63e40f8e6 #18271 (8.16.0)

Closes #19208
2025-10-24 12:12:20 +02:00
Daniel Stenberg
ab590ba62f
TODO: a fixed FTP directory listing format
Closes #19212
2025-10-24 11:21:48 +02:00
Daniel Stenberg
576f9f7c07
cfilters: check return code from Curl_pollset_set_out_only()
I added WARN_UNUSED_RESULT to two of the cfilter functions to make this
mistake harder to slip in next time.

Pointed out by CodeSonar

Closes #19211
2025-10-24 11:11:40 +02:00
Dalei
e51966d9df
tool_cfgable: remove superfluous free calls
Fixes #19213
Closes #19214
2025-10-24 11:05:43 +02:00
Daniel Stenberg
48d314f262
connect: for CONNECT_ONLY, CURLOPT_TIMEOUT does not apply
Since using CONNECT_ONLY is by defintion only a connect, we make the
timeleft function return 0 after the connection is done so that it does
not - surprisingly - timeout later.

Fixes #18991
Reported-by: Pavel P
Closes #19204
2025-10-23 22:53:15 +02:00
Daniel Stenberg
3692cd837e
schannel: replace a run-time condition with an assert
For detecting a bad function argument that probably also would cause a
compiler warning.

Closes #19203
2025-10-23 22:52:02 +02:00
Viktor Szakats
3ac38a6b80
md4: drop mbedtls implementation (not available in mbedtls v3+)
Follow-up to 01a2308236 #18254

Closes #19202
2025-10-23 16:47:19 +02:00
Daniel Stenberg
0d1d35fa34
http: only accept ';' as a separator for custom headers
When parsing incoming headers, they need to have a plain normal colon.

Previously out of convenience we used the same parser function for both
cases (incoming + custom set headers via the API) which made the
function too liberal for incoming HTTP traffic.

Closes #19200
2025-10-23 14:18:11 +02:00
Theo Buehler
2edce44065
vtls: remove call to PKCS12_PBE_add()
Curl is one of the last callers of PKCS12_PBE_add(). It has been a noop
since OpenSSL 0.9.8k (2006) stubbed it out when moving the built-in PBE
algorithms to a static table:
b8f702a0af

Closes #19201
2025-10-23 14:13:26 +02:00
Daniel Stenberg
9752d5fe0b
netrc: when the cached file is discarded, unmark it as loaded
Pointed out by ZeroPath

Closes #19199
2025-10-23 13:05:25 +02:00
Stefan Eissing
a330117bb0
smtp: fix EOB handling
SMTP automatically appends a \n.\n to an upload if there is not already
one at the end of the input. The implementation had a bug where this did
not happen, depending on read size and buffering.

Change test 900 to reproduce the failure. The bug only happened for mail
body input of known length, where EOS was known on the last chunk read.
Change test 900 to use an input file and make it large enough.

Fixes #18798
Closes #19193
Reported-by: madoe on github
2025-10-23 13:03:10 +02:00
Stefan Eissing
0a79a599a9
transfer: fix retry for empty downloads on reuse
When a reused connection did transfer 0 bytes, it assumed the transfer
had failed and needed a retry. Add a check for data->red.done, so we can
successfully accept the transfer of a 0-length file via SFTP.

Add test case 1583 to verfiy.

Fix SFTP disconnect debug trace when there was nothing to
disconnect (like when reusing a connection).

Fixes #19165
Reported-by: Alexander Blach
Closes #19189
2025-10-23 13:01:35 +02:00
Daniel Stenberg
a7ece53e96
test776: NTLM with too long NTMLv2 ntresplen 2025-10-23 10:20:16 +02:00
Daniel Stenberg
41e6b45edd
test775: verify NTLM with too long user name set 2025-10-23 10:20:16 +02:00
Daniel Stenberg
d922db880c
ntlm: improved error path on bad incoming NTLM TYPE3 message
No leaks

Reported-by: Tim Becker
Closes #19198
2025-10-23 10:19:51 +02:00
x2018
6032b8f2a2
vtls: unify the error handling in ssl_cf_connect().
Check preference at first, then init peer and do connect. Also fixes
CF_DATA_RESTORE.

Closes #19196
2025-10-23 08:23:44 +02:00
x2018
28ebaf86ce
cw-out: unify the error handling pattern in cw_out_do_write
to proper set the error status and release resource

Closes #19195
2025-10-23 08:17:55 +02:00
Daniel Stenberg
9e15b07638
openssl: only try engine/provider if a certificate file/name is provided
Bug: https://issues.oss-fuzz.com/issues/435278402

Closes #19197
2025-10-23 07:54:34 +02:00
Daniel Stenberg
d51d19bd06
ftp: remove the retr_size_saved struct field
It was basically a duplicate of data->req.size already

Closes #19194
2025-10-22 23:43:39 +02:00
Daniel Stenberg
a8f16da712
ftp: remove the state_saved struct field
It was not necessary. Its only purpose was to know if an upload is done,
and that information is already available elsewhere.

Closes #19192
2025-10-22 22:52:36 +02:00
Viktor Szakats
96717dea4c
GHA/labeler: add FindGnuTLS.cmake
Follow-up to 1966c86d71 #19163
Cherry-picked from #16973
2025-10-22 18:58:10 +02:00
Daniel Stenberg
4d93592a26
ftp: reduce size of some struct fields
Closes #19191
2025-10-22 15:55:05 +02:00
Daniel Stenberg
61156f7921
ftp: remove 'newhost' and 'newport' from the ftp_conn struct
They are only needed locally, no need to keep them around.

Closes #19190
2025-10-22 14:13:19 +02:00
Daniel Stenberg
fb6a4802d7
imap: parse and use UIDVALIDITY as a number
Instead of a string. Saves a malloc, adds earlier format check.

RFC 3501 section 2.3.1.1 documents the value as a 32-bit value.

Closes #19188
2025-10-22 14:12:07 +02:00
Stefan Eissing
bb78c45407
vquic: fix recvmsg loop for max_pkts
The parameter `max_pkts` was not checked in the recvmsg() implementation
of vquic_recv_packets() as the packter counter was never increased. This
led to the loop running until an EAGAIN was encountered. Which, in any
real case scenario, does no harm as long as libcurl is ingesting packets
faster than a server is able to send them.

However on a slow device and a fast network this could happen and allow
a denial of serice.

Not a real regression as the vulnerable code has never been released.
libcurl 8.16.0 does not have this bug.

Closes #19186
2025-10-22 11:40:47 +02:00
Stefan Eissing
fcae0733a7
gnutls: fix re-handshake comments
With GnuTLS, a GNUTLS_E_REHANDSHAKE can be a renegotiate in TLSv1.2 or a
key update in TLSv1.3. This had been made non-blocking in
a1850ad7de but the comment warning about a
blocking call was not updated.

Closes #19187
2025-10-22 11:40:00 +02:00
Stefan Eissing
9c313b61b4
ftp: check errors on remote ip for data connection
Obtaining the remote ip of the control connection to be used for the
data connection can fail. Check that and fail the transfer when that
does not work.

Triggered by an OSS-Fuzz issue.
Closes #19185
2025-10-22 10:58:21 +02:00
Daniel Stenberg
f8ba00fe9d
RELEASE-NOTES: synced 2025-10-22 09:55:34 +02:00
x2018
68e63a7997
curl_path: add curlx_dyn_free() on an error path
Follow-up to 976333dd40

Closes #19183
2025-10-22 09:37:54 +02:00
Daniel Stenberg
7295546447
hostip: fix infof() output for non-ipv6 builds using IPv6 address
Pointed out by ZeroPath

Closes #19184
2025-10-22 08:41:19 +02:00
x2018
7d5d0645e5
http: unify error handling in Curl_http()
Closes #19182
2025-10-21 23:19:39 +02:00
renovate[bot]
30734e48d6
Dockerfile: update debian:bookworm-slim Docker digest to 78d2f66
Closes #19173
2025-10-21 17:33:46 +02:00
Viktor Szakats
ea6455b7a4
spelling: subdirectories
Closes #19180
2025-10-21 17:18:35 +02:00
Viktor Szakats
09f857803f
INSTALL-CMAKE.md: add manual configuration examples
Closes #19179
2025-10-21 17:18:34 +02:00
Daniel Stenberg
48df7b29d9
cookie: only count accepted cookies in Curl_cookie_add
The counter used to stop accepting cookies after a certain amount has
been received in a single response would previously also count some
cookies that were not actually accepted as they were discarded after the
counter was increased.

Starting now, the counter is increased only for cookies that were
accepted.

Pointed out by ZeroPath
Closes #19157
2025-10-21 16:33:32 +02:00
Stefan Eissing
40f7cd2bdd
mime: fix unpausing of readers
When unpausing a transfer, check if the reader pause state differs
in addition to the "keepon" flags.

Reported-by: 包布丁
Fixes #18848
Closes #19178
2025-10-21 16:30:47 +02:00
Daniel Stenberg
76d2852550
hmac: free memory properly on errors
If one of the hmac init calls fail, Curl_HMAC_init previously would
return without first freeing the allocated HMAC_context.

Fixes #19176
Reported-by: WangDaLei on github
Closes #19177
2025-10-21 16:24:21 +02:00
Viktor Szakats
38c19edd67
cmake: say 'absolute path' in option descriptions and docs
To not have to guess. Also to sync with autotools, which already uses
this wording.

Also:
- replace the stray term 'folder' with 'directory' for consistency.
- store help text in a temp variable to avoid overly long strings
  (mandatory in CMake <4.2.0 and can't be trivially split), also
  to avoid repeating this string 4 times.

Ref: https://cmake.org/cmake/help/v4.2/command/set.html

Closes #19169
2025-10-21 15:07:36 +02:00
Viktor Szakats
1966c86d71
cmake: add and use local FindGnuTLS module
Replacing a combination of custom logic in the main script and relying
on CMake's built-in Find module, with code and behavior used for
the rest of dependencies.

Also to:
- add version detection in the non-pkg-config path.
- make `GNUTLS_INCLUDE_DIR` and `GNUTLS_LIBRARY` take precedence over
  pkg-config. As with other dependencies.
- document the above two configuration options.
- prepare for #16973, which originally introduced this local Find
  module.

The local module is doing largely the same as CMake's built-in
FindGnuTLS. Differences:
- honors `CURL_USE_PKGCONFIG`.
- returns GnuTLS version for non-pkg-config detection.
- consistently returns `GNUTLS_VERSION`.
  (CMake's built-in uses s different name in <3.16.)
- CMake 3.16+ returns an imported target. curl supports 3.7,
  therefore we may only use it conditionally, which isn't worth it.

Cherry-picked from #16973

Closes #19163
2025-10-21 14:37:40 +02:00
Daniel Stenberg
9e198618de
tool_parsecfg: detect and error on recursive --config use
The config file parser now has a maximum level of inclusions allowed (5)
to detect and prevent recursive inclusions of itself leading to badness.

Bonus: clean up return code handling from the config parser.

Test 774 verifies
Closes #19168
2025-10-21 10:11:43 +02:00