Commit Graph

35949 Commits

Author SHA1 Message Date
Viktor Szakats
25eb2dbfbf
sshserver.pl: use Perl chmod
Instead of relying on the external/shell command. For portability.

Follow-up to 213c5aca7b #3899
Closes #16859
2025-03-29 12:35:34 +01:00
Viktor Szakats
7be2c421bf
runtests: rewrite genserv.sh in Perl
To remove POSIX shell as an extra dependency for runtests.

Also fix to `chmod 0600` the `.pem` file (was: `.prm`), and apply it
_before_ writing the keys.

Follow-up to 44341e736a #16824
Closes #16858
2025-03-29 12:35:33 +01:00
Daniel Stenberg
ad99067d92
RELEASE-NOTES: synced 2025-03-29 11:27:44 +01:00
Stefan Eissing
7cb079ad1b
c-ares httpsrr: fix ifdef
Fix the ifdef const when enabling HTTPSRR with c-ares.

Reported-by: Pavel Kropachev
Ref: #16855
Closes #16861
2025-03-28 23:44:48 +01:00
Viktor Szakats
c8b0f0c9ad
cmake: add shell completion support
Add the last (*) missing bit for feature parity with autotools.

Also test in CI. Add a new `cmake install` step to GHA/macos.

(*) AFAIK. Let us know if there's something else missing.

Closes #16833
2025-03-28 13:51:38 +01:00
Viktor Szakats
e95f509c66
tests/server: make the signal handler signal-safe
Before this patch the signal handler called `logmsg()` which in turn
called `printf()` variants (internal implementations), and `FILE *`
functions, `localtime()`. Some of these called `malloc`/`free`, which
isn't supported in s signal handler. Replace them with `write` calls,
losing some logging functionality.

Also:
- De-dupe and move `STD*_FILENO` macros to `lib/curl_setup.h`. Revert
  the `src` definition to point to `stderr`, instead of `tool_stderr`.
  Follow-up to e5bb88b8f8 #11958

POSIX specs with list of functions allowed in a signal handler:
2004: https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
2017: https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03
2024: https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_04_03

Linux CI run with the thread sanitizer going crazy when
hitting the signal handler in test 1238 and 1242 (TFTP):
```
WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=12582)
    #0 malloc <null> (servers+0x5ed70)
    #1 _IO_file_doallocate <null> (libc.so.6+0x851b4)
    #2 formatf /home/runner/work/curl/curl/bld/tests/server/../../lib/../../lib/mprintf.c:886:9 (servers+0xdff77)
[...]
WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=12582)
    #0 free <null> (servers+0x5f453)
    #1 fclose <null> (libc.so.6+0x8532f)
    #2 logmsg /home/runner/work/curl/curl/bld/tests/server/../../../tests/server/util.c:134:5 (servers+0xe684d)
```
Ref: https://github.com/curl/curl/actions/runs/14118903372/job/39555309490?pr=16851

Closes #16852
2025-03-28 12:02:38 +01:00
Viktor Szakats
3b6c7142f6
GHA/linux: move pytests to non-valgrind job variants, drop 2 redundant runs
- move pytest from the valgrind variant of the mbedTLS and Rustls jobs
  to their non-valgrind counterpart (they different in C compiler and
  build tool respectively). To parallelize more and finish the workflow
  faster.

- drop pytest from the valgrind variant of the two identical (other than
  the build tool) 'libressl heimdal' jobs. Saves 1.5 minutes CI time.

- drop pytest from the longest valgrind job to make the workflow finish
  almost 2 minutes faster. `sync-resolver` is its unique build propery.
  It wasn't pytested on Azure.

- explicitly install `libnghttp2-dev` and `libldap-dev` to keep them in
  jobs where pytest deps were installing them implicitly before this
  patch.

Before: https://github.com/curl/curl/actions/runs/14118080563
After: https://github.com/curl/curl/actions/runs/14118903372?pr=16851

Closes #16851
2025-03-28 01:25:48 +01:00
Viktor Szakats
8cc05992a8
GHA/linux: enable ECH in Rustls jobs
Closes #16850
2025-03-27 23:42:18 +01:00
Daniel McCarney
8836e65967
docs: add rustls --ca-native & CURLSSLOPT_NATIVE_CA
The one important caveat is that presently _only_ the native platform
verifier/CAs are consulted when this option is used w/ rustls.

Closes #16848
2025-03-27 22:54:24 +01:00
Stefan Eissing
a910f5ba6a
vquic: obey IOV_MAX
When using `recvmmsg()`, check `IOV_MAX` for limits to the iovec array
passed.

Reported-by: Teh Kok How
Fixes #16846
Closes #16849
2025-03-27 22:53:01 +01:00
Stefan Eissing
0c1ad21f97
tests/makefile: add dependency on build-certs
Closes #16845
2025-03-27 13:23:21 +01:00
Viktor Szakats
44341e736a
runtests: generate certs dynamically, bump to EC-256, tidy up
Before this patch the curl repository and source tarball distribution
contained test certificates as binary blobs. Used by runtests.

Drop these certificates in favor of generating them dynamically as
part of the build process. Both via autotools and CMake.

As part of this, improve certificates, the generator script and process,
file layout, and fix any issue to make it work fast and smooth both in
CI and local builds.

Note, cert generator scripts require OpenSSL >=1.0.2
(or LibreSSL >=3.1.0). Generation requires POSIX shell, also with CMake.
Without a POSIX shell tests relying on TLS (and stunnel) will fail.

Details:

- build: generate certs as part of the test run process.
- build, tests: generate certs in the build directory.
- binarycheck: drop concept of known binary files with hashes.
- binarycheck: move binary check logic into spacecheck and drop this
  separate checker tool.
- build: fix to clean all cert files.
- autotools: fix to not run leaf cert generators in parallel. To avoid
  confusion when updating the revocation database and counter.
- scripts: drop `scripts` subdir, merge two scripts into one,
  auto-generate root cert, allow generating multiple leafs at once.
- scripts: switch to EC-256 keys (was: RSA-2048). For key size and perf.
- scripts: drop `-x` echo, text dumps, most other output. To avoid log
  noise and make it quicker in CI.
- scripts: make it non-RSA-specific.
- scripts: delete unused code.
- scripts: use POSIX shell shebang. Some envs don't have bash (Alpine).
- scripts: pass test pseudo-secrets via the command-line. To avoid:
  ```
  + openssl genrsa -out test-ca.key -passout fd:0 2048
  Invalid password argument, starting with "fd:"
  ```
- cmake: fix to launch generator scripts via the detected POSIX shell.
- cmake: fix `build-certs` rule to not depend on `SRPFILES`
  (`srp-verifier-*`).
- cmake: drop `EXCLUDE_FROM_ALL` for the cert subdir. It makes
  the Visual Studio generator miss to create the `clean-certs`,
  `build-certs` targets. No target depend on them, so they don't execute
  implicitly anyway. Fixes:
  ```
  MSBUILD : error MSB1009: Project file does not exist.
  Switch: clean-certs.vcxproj
  ```
- cmake: add `VERBATIM USES_TERMINAL` to `build-certs` target.
- GHA/linux: install openssl on Alpine, for the cert generator scripts.

Follow-up to 556f722fe3 #16593
Follow-up to fa461b4eff #14486

Closes #16824
2025-03-27 10:21:57 +01:00
Daniel McCarney
1821ea8b14
rustls: support native platform verifier
e.g. `curl --ca-native ...`
2025-03-27 08:48:13 +01:00
Daniel McCarney
3143efd86a
docs: include rustls-ffi in ECH docs 2025-03-27 08:48:13 +01:00
Daniel McCarney
07addb54f4
rustls: support ECH w/ DoH lookup for config
E.g. `curl --tlsv1.3 --doh-url https://one.one.one.one/dns-query --ech true ...`

Closes #16828
2025-03-27 08:48:10 +01:00
Daniel McCarney
b1ba919676
rustls: add ECH support w/ string ECH config
e.g. `curl --tlsv1.3 --ech ecl:<BASE64 encoded ECH config list> ...`

Closes #16828
2025-03-27 08:48:06 +01:00
Daniel McCarney
233b668903
rustls: support ECH GREASE
e.g. `curl --tlsv1.3 --ech grease ...`
2025-03-27 08:47:51 +01:00
Yedaya Katsman
1c8c93ae15
rustls: use client cert and key if available 2025-03-27 08:47:51 +01:00
Yedaya Katsman
1d31f2592f
rustls: Add support for SSLKEYLOGFILE
With rustls-ffi 0.15+ we can set up a callback for writing TLS secrets
hooked up to call Curl_tls_keylog_write. To make sure the associated
file is cleaned up we update the Curl_ssl struct for the rustls-ffi vtls
backend to have a cleanup callback.

Closes #16828
2025-03-27 08:47:43 +01:00
Yedaya Katsman
9ad2d8c557
keylog: move some constants to header file
This allows TLS implementations to use the constants for defining sizes
and verification.
2025-03-27 08:47:43 +01:00
Daniel McCarney
6fa31a3043
ci: use rustls-ffi 0.15 deb
Take the latest rustls-ffi version and install it via the upstream
project's `.deb` for x86_64 linux.
2025-03-27 08:47:43 +01:00
Daniel McCarney
14761d8b61
docs: rework RUSTLS install instructions
Describes using a package manager or pre-built binaries and adopts the
0.15 installation from source instructions.

Previously the rustls docs described installing rustls-ffi from source
using the GNU Makefile. The upstream project has switched to using
cargo-c as a cross-platform solution that works well with the rust
toolchain, pkg-config, and Windows and so this needs an update.

Similarly, for folks that want to avoid the extra cargo-c tool
requirement, rustls-ffi provides binary releases for common platforms,
and some Linux distributions/package managers offer pre-built packages.

The install instructions are expanded to cover these options since
they're generally better for end users than building the dep. from
source (no `rustc` required).
2025-03-27 08:47:43 +01:00
Viktor Szakats
0c20e9bf1a
tests: replace remaining non-ASCII bytes with hex markup
Also drop from `binarycheck`.

Closes #16837
2025-03-26 23:38:41 +01:00
Viktor Szakats
795425f765
configure: tidy up shell completion rules
- allow generating completions in cross-builds.
  Follow-up to d055a01ce9 #16789

- fix warning messages.

- language, quotes, whitespace.

Closes #16836
2025-03-26 15:31:54 +01:00
Viktor Szakats
627e9816ff
cmake: add custom command scripts as dependencies where missing
Also some formatting.

Closes #16835
2025-03-26 15:31:53 +01:00
Daniel Stenberg
39931f7fbe
RELEASE-NOTES: synced 2025-03-26 07:54:09 +01:00
Viktor Szakats
4af9d75783
GHA/non-native: revert to bare builds for Android 21
vcpkg requires Android 28 by default after a recent update that's being
deployed onto CI runs (with `libiconv:arm64-android@1.18#1`).

Revert to bare, no-ssl, no-psl configuration for Android 21 jobs to make
them work again.

Bug: https://github.com/curl/curl/pull/16824#issuecomment-2750912507
Ref: https://github.com/microsoft/vcpkg/pull/44424#issuecomment-2753027630

Closes #16832
2025-03-26 03:31:10 +01:00
Viktor Szakats
1447726663
cmake: document SH_EXECUTABLE option
Closes #16830
2025-03-26 00:54:04 +01:00
Daniel Stenberg
7d1a5c6bdf
tests: remove base64 encoded sections
The base64 sections were added in a time when there was no other way to
do these tests. Now we remove them again to make less "hidden" data in
the test suite.

For several test cases we instead then provide a sequence of binary
octets which is not really better, but I have tried to minimize them.

Closes #16816
2025-03-25 16:47:48 +01:00
Daniel Stenberg
9a7baa34cc
mqtt: cleanups
- make a variable const
- use calloc instead of malloc + memset
- fix comment language
- improve error messages

Closes #16826
2025-03-25 09:18:08 +01:00
Daniel Stenberg
b2078c0e1c
mqtt: convert sendleftovers to dynbuf
Avoid frequent strdups/free calls, including the double-free risk.

Reported-by: Ronald Crane
Closes #16823
2025-03-25 08:22:05 +01:00
Ben Bodenmiller
38b94c80f3
SSLCERTS: list support for SSL_CERT_FILE and SSL_CERT_DIR
Closes #16762
2025-03-25 08:20:39 +01:00
tiymat
d055a01ce9
scripts: update completion.pl to parse options from docs
Reported-by: kpcyrd on github
Fixes #16072
Closes #16789
2025-03-24 23:48:26 +01:00
Gabriel Marin
c329321bf9
easy: add 'populate_fds' func to reduce size of 'wait_or_timeout'
Closes #16820
2025-03-24 23:46:52 +01:00
Daniel McCarney
088f0e6a5b
rustls: tidy up
Closes #16796
2025-03-24 23:45:02 +01:00
Jay Satiro
e601668154 openssl: fix crash on missing cert password
- Return 0 for password length if OpenSSL is expecting a certificate
  password but the user did not provide one.

Prior to this change libcurl would crash if OpenSSL called the certificate
password callback in libcurl but no password was provided (NULL).

Reported-by: Roman Zharkov

Fixes https://github.com/curl/curl/issues/16806
Closes https://github.com/curl/curl/pull/16807
2025-03-24 18:22:53 -04:00
Daniel Stenberg
18f04faef9
asyn-thread: minor cleanups
- Use 'td->' in more places instead of the full thing.

- Remove an assert that is always true since the extra dynamic malloc
  was removed

- Ignore Curl_ares_perform() errors to prioritize the "real" resolver
  info and leave RR as "less important"

Closes #16808
2025-03-24 22:54:39 +01:00
Dave Nicolson
ed0966643d
tool_operate: fix pluralization of seconds
Closes #16751
2025-03-24 22:44:09 +01:00
Stefan Eissing
a95b291ec0
conncache: eliminate cpool's diconnect callback
The callback, provided from url.c did the work that the cshutdn
functionality also implemented. Remove it.

Change some DEBUGF(infof()) to CURL_TRC_M().

Closes #16810
2025-03-24 22:41:53 +01:00
renovate[bot]
ac3c353747
GHA: update mbedtls to v3.6.3
Closes #16822
2025-03-24 22:36:05 +01:00
Viktor Szakats
579625efa5
test615: fix for Cygwin, unignore in CI
Setting a server-side file read-only by `chmod 0444` has does not
prevent overwriting it via SFTP upload (as tested in CI).

Fix it by setting its MS-DOS read-only attribute in addition. It
requires the Cygwin tool `chattr`.

Also unignore in CI.

Fixes:
```
test 0615...[SFTP put remote failure]
curl returned 0, when expecting 9
 615: exit FAILED
=== Start of file stderr615
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
 100    30    0     0  100    30      0     93 --:--:-- --:--:-- --:--:--    95

 100    30    0     0  100    30      0     92 --:--:-- --:--:-- --:--:--    92
=== End of file stderr615
```
Ref: https://github.com/curl/curl/actions/runs/14037991918/job/39300723214#step:12:1269

Closes #16818
2025-03-24 16:49:57 +01:00
Viktor Szakats
89101fabf8
GHA/windows: dl-mingw PATH follow-up
Follow-up to 468bfc2618 #16813

Closes #16817
2025-03-24 15:34:00 +01:00
Daniel Stenberg
76d7483fe5
INFRASTRUCTURE.md: add IRC and Matrix details
Closes #16809
2025-03-24 15:21:59 +01:00
Viktor Szakats
ac6f7145a9
GHA/windows: use a pure Cygwin environment
Use the `PATH` `/usr/bin` to avoid any Windows system or 3rd-party tool
installed on the runner machine that may interfere with or add undesired
dependencies to the builds and tests.

Follow-up to d838d43430 #16465
Ref: #16437

Closes #16814
2025-03-24 12:41:52 +01:00
Viktor Szakats
468bfc2618
GHA/windows: boost dl-mingw and cygwin install performance
Install on drive `D:` which has much better write performance than `C:`,
on GitHub Windows runner machines.

- It's bringing down `dl-mingw` installation steps to 5-15s per job,
  from 15s-130s before this patch.

- Saving 30-90s per job in the Cygwin install step.

The before values were fluctuating, but it seems reasonable to expect
saving at least a couple of minutes for each workflow run.

Closes #16813
2025-03-24 12:37:44 +01:00
Viktor Szakats
5cce329873
libssh2: minor tidy-ups
Fix indentation and drop an unnecessary assigment.

Closes #16812
2025-03-24 12:37:44 +01:00
Viktor Szakats
be21c95740
GHA/windows: install OpenSSH-Windows manually for transparency
To have the current latest version, and to avoid the stale, misleading
versions installed by Chocolatey. It also installs transparently, faster,
and making the source of the binaries clear. Install on drive `D:` for
best performance.

After much detective work it turns out that the OpenSSH Windows versions
installed by Chocolatey aren't what they seem:

- The latest pre-release named 9.5.0-beta20240403:
  https://community.chocolatey.org/packages/openssh/9.5.0-beta20240403
  is in reality 8.6.0.0p1-Beta from 2021-05-27:
  https://github.com/PowerShell/Win32-OpenSSH/releases/download/V8.6.0.0p1-Beta/OpenSSH-Win64.zip

- The latest "stable" version 8.0.0.1 is in reality:
  https://community.chocolatey.org/packages/openssh/8.0.0.1
  is in reality 8.0.0.0p1-Beta:
  https://github.com/PowerShell/Win32-OpenSSH/releases/download/v8.0.0.0p1-Beta/OpenSSH-Win64.zip

Ref: https://github.com/curl/curl/pull/16803#issuecomment-2746365654
Follow-up to 67a7775d12 #16704
Follow-up to 0ec72c1ef8 #16672

Closes #16811
2025-03-24 12:37:44 +01:00
Viktor Szakats
e7944fb3da
GHA: extend clang-tidy jobs with more build options, add Windows job
- linux: wolfssl, wolfssh (replacing libssh2), ech, kerberos/GSSAPI,
  ssls-export (libssh2 remains tested on macos.)

- macos: brotli, zstd, c-ares, gnutls, mbedtls, gsasl, rtmp, ssls-export

- windows: new job with schannel, sspi, winidn, winldap, ssls-export

- unit3205: fix/silence remaining NULL dereferences.

Commits fixing the issues found:
cbbccb8b3a #16766
554e4c14be #16777

Closes #16764
2025-03-24 12:37:43 +01:00
Stefan Eissing
c712effda3
multi_ev: fixes regarding connection shutdowns
When handling connections (not transfers) related events, always use the
passed `conn` and not `data->conn` as the transfer does not need to have
the same connection.

Fix handling of conn pollset diffs to disregard the transfer.

Closes #16782
2025-03-24 10:55:40 +01:00
Viktor Szakats
7991b5a85e
memdebug: drop dynamic allocation from curl_dbg_log()
Closes #16745
2025-03-24 10:22:58 +01:00