Commit graph

7493 commits

Author SHA1 Message Date
Viktor Szakats
614b94eecc
tidy-up: miscellaneous
- avoid "will" in builds scripts, scripts folder, curl_easy_ssls_export.md,
  and few other files.
- badwords: add "initialise", "nul terminated", "thread safety" and
  variations.
- prefer "null-terminat", where missing (two places).
- fix "null-terminat*" missing dash.
- hostip: merge two `#if` blocks.
- tool_doswin: fix comment
  Spotted by GitHub Code Quality
  Follow-up to 9a2663322c #17572
- fix stray spaces and newlines.

Closes #21638
2026-05-16 01:56:17 +02:00
Viktor Szakats
47f411c6d8
GHA: enable -Wunused-macros in clang-tidy jobs
Also fix fallouts found.

Windows clang-tidy CI job is a little pickier than I'd prefer due to the
`_CURL_TESTS_CONCAT=ON` option used there, and all macros considered
local, thus checked by the compiler. Upside: it revealed macro usage
dynamics in tests. If too annoying, `first.h` may be opted-out from the
concat logic. Some macros may also be deleted instead of `#if 0`-ing.

Follow-up to e0e56e9ae4 #21550
Follow-up to 5fa5cb3825 #20593

Closes #21554
2026-05-16 01:17:41 +02:00
jeffhuang
a15483c4ca
url: compare full origin when setting credentials
Closes #21575
2026-05-16 01:14:29 +02:00
Stefan Eissing
91dcf4e610
url: url_match_destination fix
Match origin/via_peer also for non-SSL schemes.

Closes #21573
2026-05-16 01:11:06 +02:00
Sergio Correia
61d59c9e39
x509asn1: fix DH public key parameter extraction
The dh(g) parameter was read from param->beg instead of from the
cursor p returned by parsing dh(p). This caused dh(g) to always
report the same value as dh(p) when inspecting DH certificates
via CURLOPT_CERTINFO on non-OpenSSL backends.

The DSA branch correctly advances the cursor; the DH branch lost
this during what appears to be a copy-paste.

Add unit1676 to verify that dh(p) and dh(g) report distinct values
using a hand-crafted minimal DER certificate.

Assisted by: Claude Opus 4.6
Signed-off-by: Sergio Correia <scorreia@redhat.com>
Closes #21595
2026-05-16 01:06:56 +02:00
Daniel Stenberg
831a151484
urlapi: consume trailing dots after IPv4 numerical addresses
If the hostname is specified as an IPv4 numerical address and it is
followed by a single dot, acccept that as a valid IPv4 and remove the
dot when normalizing.

This prevents otherwise legitimate IPv4 hostnames to have trailing dots.
Seems to match what browsers do.

Extended test 1560 to verify.

Closes #21635
2026-05-15 23:38:50 +02:00
Daniel Stenberg
a15cfeb100
cookie: compare path case sensitively
Verify with test 1645

Reported-by: Joshua Rogers
Closes #21616
2026-05-15 13:37:52 +02:00
Viktor Szakats
4780e509aa
tidy-up: prefer "initialize" with a 'z'
To match the majority of usage in source.

Closes #21618
2026-05-15 11:49:06 +02:00
Viktor Szakats
eb9b253d66
libssh: add support for SHA256 host public keys
Reported-by: Joshua Rogers
Fixes #21605

Closes #21607
2026-05-15 11:49:06 +02:00
Daniel Stenberg
9135294115
urlapi: deny hostnames with more than one trailing dot
Or consisting of just a single dot.

Such names cannot be resolved with DNS.

While they *can* still be resolved with /etc/hosts or --resolve tricks,
they easily cause internal problems because their trailing dots.

Let's not allow them anymore.

Closes #21622
2026-05-15 11:44:20 +02:00
Viktor Szakats
a36c571984
pythonlint.sh: make it fail on error, fix ruff warnings in pytest
Follow-up to a5542c23e7 #21289
Follow-up to 17e8200733

Closes #21597
2026-05-13 22:59:36 +02:00
Daniel Stenberg
675a9b0189
urlapi: change more lowercase percent-encoded to uppercase
For consistency with other code, prefer uppercase.

Verified by test 1628
Reported-by: Fabian Keil
URL: https://curl.se/mail/lib-2026-05/0006.html
Closes #21592
2026-05-13 16:47:05 +02:00
Daniel Stenberg
b079595f2e
url: keep the question mark for empty queries
Reported-by: Bill Mill
Fixes #21544

Verified by test 1721

Closes #21584
2026-05-13 14:34:54 +02:00
Stefan Eissing
5e99b73cf4
creds: add sasl service name
The SASL service name, used in authentication, is part of curl's credentials
when authenticating to a server/proxy. Make it part of `struct Curl_creds`.

Change code to use `creds` to obtain a service name. By tying creds used
to the connection, connection reuse is also only allowed when the service
name matches.

Closes #21585
2026-05-13 14:04:17 +02:00
Daniel Stenberg
2238f0921c
curl: named globs in output file name for upload glob references
Use parts of text from the upload filename field when that uses globbing
by giving it a name the same way we do it for URL globs. For example, if
you upload three files to a HTTP URL and want to save the corresponding
responses in separate files:

    curl -T 'file{<num>1,2,3}' https://upload.example/ -o 'response-#<num>'

Verified by test 2014

Closes #21407
2026-05-13 10:07:50 +02:00
Daniel Stenberg
287b082c63
tool_urlglob: better 'Duplicate glob name' position
This now points to where the duplicate name ends, not where it starts.

Also fixes test 2410 to use a fixed hostname so that the error position
remains the same.

Reported-by: Viktor Szakats
Fixes #21567
Closes #21568
2026-05-12 23:46:04 +02:00
Stefan Eissing
8f71d0fde5
creds: hold credentials
Authorizdation credentials are kept in `struct Curl_creds`. This contains:

* `user`: the username, maybe the empty string
* `passwd`: the password, maybe the empty string
* `sasl_authzid`: the SASL authz value, maybe the empty string
* `oauth_bearer`: the OAUTH bearer token, maybe the empty string
* `source`: where the credentials from from
* `refcount`: a reference counter to link/unkink creds

A `creds` with all values empty is equivalent to NULL, e.g. no `creds`
instance. With reference counting, `creds` can be linked/unlinked
in several places.

See docs/internals/CREDENTIALS.md for use.

Closes #21548
2026-05-12 16:05:15 +02:00
Song X. Gao
cc6777d939
spnego_sspi: honor CURLOPT_GSSAPI_DELEGATION for Windows SSPI
Make CURLOPT_GSSAPI_DELEGATION effective on Windows builds that use SSPI
(instead of a native GSS-API implementation), so Kerberos delegation can
be requested during SPNEGO/Negotiate authentication.

Closes #21528
2026-05-12 10:27:29 +02:00
Daniel Stenberg
cb0636980b
tool_urlglob: add named globs
Idea-by: Bastian Jesuiter

Verified by test 2408 - 2411

Closes #21409
2026-05-12 08:33:01 +02:00
Viktor Szakats
4815070794
tidy-up: sort TLS backends, distros, alphabetically
Also:
- replace stray [Rr]ustls-ffi with Rustls for consistency.
- add AWS-LC to a couple of lists where missing.

Closes #21481
2026-05-11 11:57:25 +02:00
Daniel Stenberg
b174b8b326
ECH: cleanups
- passing an unknown string to CURLOPT_ECH now returns error

  To properly allow applications to spot if they pass in a typo or
  something to libcurl.

- CURLECH_DISABLE is now a plain zero internally, not a dedicated bit which
  simplifies checks for when ECH is enabled

- Dropped the CURLECH_CLA_CFG bit, and just check STRING_ECH_CONFIG

- Turn grease/enable/hard into three different numerical values, no bitmask
  needed

- Convert the struct field 'tls_ech' from an int to a byte.

Closes #21532
2026-05-08 13:09:45 +02:00
Daniel Stenberg
3ce10063f1
tool_urlglob: avoid overflow at end of range
Due to how the range span globbing code works, a range that ends with
9223372036854775807 (the maximum signed 63 bit value) cannot be used as
it triggers an integer overflow.

Verified in test 2092

Reported-by: Andrew Nesbit
Closes #21529
2026-05-07 22:58:20 +02:00
parasol-aser
74bc655bdf
tool1622: assert width and exact format boundaries
Convert the silent "was too long!" diagnostics in the timebuf and
max5data width loops into fail_unless assertions, so a regression in
output width fails the unit test directly instead of only printing.

Add small exact-output tables that probe format-transition boundaries
not necessarily hit by the geometric value sweep: the 99999/100000
suffix kick-in for max5data, and the 6d/01h, 51m, 136y, and >99999y roll
points for timebuf.

Closes #21516
2026-05-07 08:00:03 +02:00
Dan Fandrich
478e280278 tests: fix unit1636 with --disable-progress-meter
Closes #21500
2026-05-06 21:46:40 -07:00
Daniel Stenberg
2cb6ba672d
hsts: rename Curl_hsts() to hsts_check() and make it static
It is no longer used outside of hsts.c

Closes #21507
2026-05-05 17:46:51 +02:00
Daniel Stenberg
117d50b4bf
thrdqueue: make thrdq_await_done only for unit tests
It is not used for anything else, so drop Curl_ and make it conditional
accordingly.

Closes #21499
2026-05-05 08:55:49 +02:00
Daniel Stenberg
f59733be23
setopt: changing the proxy port is also a proxy change
Test 1589 verifies.

Closes #21485
2026-05-04 00:14:06 +02:00
dependabot[bot]
47755c4e69
GHA: bump actions and pips
- update action `actions/cache` from 5.0.4 to 5.0.5
- update action `actions/upload-artifact` from 7.0.0 to 7.0.1
- update action `github/codeql-action` from 4.32.4 to 4.35.2
- update action `msys2/setup-msys2` from 2.31.0 to 2.31.1

- update pip `filelock` from 3.25.2 to 3.29.0
- update pip `impacket` to 0.13.0
- update pip `ruff` from 0.15.10 to 0.15.12

Closes #21483
Closes #21482
2026-05-01 21:19:22 +02:00
Viktor Szakats
91232fc2a2
tidy-up: miscellaneous
- sha256: fix backend priority in comment.
- URLs: link to IETF URLs to the HTML document, to match others.
- VERSIONS.md: use unified date format for recent entries too.
  Ref: ce5d32032f
- GHA/labeler.yml: alpha-sort file masks in a label block.
- tests/server/mqttd: fix call arg list in a disabled function.
- tests/server/mqttd: fix comment.

Closes #21473
2026-04-30 20:22:23 +02:00
Raymond Steen
2bb5c9b555
mqtt: validate PINGRESP and DISCONNECT have remaining_length == 0
Per MQTT 3.1.1 sections 3.13.1 and 3.14.1, PINGRESP and DISCONNECT fixed
headers must have remaining_length set to zero. The previous code
dispatched to mqtt->nextstate based on the queued state alone without
validating remaining_length for these no-payload packet types, allowing
a malicious broker to send a PINGRESP with non-zero remaining_length
whose trailing bytes would be interpreted as the payload of whatever
message type was queued (CONNACK, SUBACK, etc.).

The exploitation path turned out to be narrow — curl sends data to the
server the user chose to talk to — but the spec violation and the
resulting protocol-state error are real. Reject the malformed packets
with CURLE_WEIRD_SERVER_REPLY before state dispatch.

Reported-by: Raymond Steen <raymond@vortiqxconsilium.com>
Found by VORTIQ-X VXF Framework
Bug: https://hackerone.com/reports/3702718

Signed-off-by: Raymond Steen <raymond@vortiqxconsilium.com>
Closes #21465
2026-04-30 14:14:44 +02:00
Viktor Szakats
377ed81ab7
tidy-up: a cmake warning message and a variable name
Spotted by GitHub Code Quality

Closes #21462
2026-04-28 09:07:27 +02:00
Viktor Szakats
0f47ddc0a9
build: stop building and installing runtests.1 and testcurl.1
The corresponding tools are never installed, and both are dev tools.
Refer to their `.md` originals instead.

Also markdownify text in lines nearby.

Ref: https://github.com/curl/curl/pull/21460#issuecomment-4328258450

Closes #21461
2026-04-28 09:07:27 +02:00
Viktor Szakats
032ea65ff2
tidy-up: whitespace
Closes #21456
2026-04-27 13:34:27 +02:00
Viktor Szakats
13b6a6036c
tool_dirhie: fix to create drive-relative directory
Fix to create the top directory `foo` when specified as
`X:foo\bar\filename`, on Windows and MS-DOS. Add test to verify.

Caught by Codex Security

Follow-up to 787ee935ac #16566

Closes #21449
2026-04-27 12:09:09 +02:00
Viktor Szakats
e2f84e6ba9
tunits: initialize global tool_stderr
To avoid difficult to track down crashes when a tested function ends up
outputing a message via `errorf()`, `warnf()` or siblings.

Cherry-picked from #21449

Closes #21454
2026-04-27 11:53:47 +02:00
Viktor Szakats
4d89043fbc
runtests: fix linefeeds in log messages
Cherry-picked from #21449

Closes #21452
2026-04-27 11:53:47 +02:00
Viktor Szakats
aab8d47227
units: tidy up dynbuf init
Init dynbuf after global init to bring closer to use, improve
readability and sync test sources.

Closes #21451
2026-04-27 11:53:47 +02:00
Daniel Stenberg
c1cfdf59ac
setopt: clear proxy auth properties when switching
Verify with test 1588

Closes #21453
2026-04-27 10:27:01 +02:00
Viktor Szakats
024c73dfa1
test_22_httpsrr: avoid class name clash with test_21_resolve
Spotted by GitHub Code Quality

Closes #21448
2026-04-25 14:20:42 +02:00
Viktor Szakats
c6b1c49be0
test_22_httpsrr: drop duplicate skipif conditions
Already set at class-level.

Spotted by GitHub Code Quality

Closes #21446
2026-04-25 13:59:20 +02:00
Viktor Szakats
05905b1207
pytest: drop unused imports
Spotted by GitHub Code Quality

Closes #21445
2026-04-25 12:38:07 +02:00
Viktor Szakats
4449110561
sshserver.pl: tidy up around AllowUsers setup
- drop redundant space-to-`?` replacement.
- add parentheses to silence code checker.
- tidy up comments.

Follow-up to e53523fef0 #14859

Closes #21442
2026-04-25 08:42:54 +02:00
Viktor Szakats
41f3f94d91
sshserver.pl: add option to enable KEX algorithms in sshd
Necessary when the libssh2/libssh client library does not support KEX
algos offered by default by the OpenSSH server. E.g. libssh2 with WinCNG
combined with OpenSSH 10+.

Also: use this option in GHA/windows.

Follow-up to 3b8bb1a86a #21219
Follow-up to c98d0a2e9a #21220

Closes #21438
2026-04-24 17:09:21 +02:00
Viktor Szakats
0d3d9f2222
checksrc: add missing semicolon, fix IFDEFSINGLE capture group
Pointed out by GitHub Code Quality

Closes #21435
2026-04-24 11:08:56 +02:00
Daniel Stenberg
2f37943406
tests: drop support for the hex="yes" option in getpart
The remaining datacheck sections using this for MQTT tests were not
actually used anyway!

Closes #21428
2026-04-24 10:42:34 +02:00
Viktor Szakats
ee65f19e2a
checksrc: fix code quality findings
- fix counting errors. Update test1185 results accordingly.
- fix an error message.
- tidy up regexp syntax.

Pointed out by GitHub Code Quality

Closes #21429
2026-04-24 09:46:35 +02:00
Daniel Stenberg
b16be8e244
tool_operate: reset the upload glob counter for next URL
Fixes #21402

Adjust test 2012 and 2013 accordingly

Closes #21403
2026-04-22 07:50:59 +02:00
Daniel Stenberg
dcf535629b
tool_operate: keep the filename for upload globbing
Follow-up to 19695e815c

Verify with test 2012 and 2013

Closes #21401
2026-04-21 23:11:42 +02:00
Daniel Stenberg
779bba2f3f
runtests: allow %EMPTY in <stdout> to verify no output 2026-04-21 17:22:11 +02:00
Daniel Stenberg
4daf483b5b
lib557: add tests with flags AND conversion specifier
Remove superfluous and never-built test code for systems with 16-bit and
64-bit ints and 16-bit longs, as we don't know any such.
2026-04-21 15:21:16 +02:00