Viktor Szakats [Tue, 7 Oct 2025 10:04:03 +0000 (12:04 +0200)]
examples/usercertinmem: avoid stripping const
This API started accepting a const somewhere between OpenSSL 1.0.2b and
1.0.2t. It means this example, like the other similar one now works best
with those versions or newer:
```
docs/examples/usercertinmem.c:100:33: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
100 | bio = BIO_new_mem_buf((char *)mypem, -1);
| ^
docs/examples/usercertinmem.c:121:34: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
121 | kbio = BIO_new_mem_buf((char *)mykey, -1);
| ^
```
Stefan Eissing [Mon, 1 Sep 2025 09:58:16 +0000 (11:58 +0200)]
multi: add notifications API
Add infrastructure to colled and dispatch notifications for transfers
and the multi handle in general. Applications can register a callback
and en-/disable notification type the are interested in.
Without a callback installed, notifications are not collected. Same when
a notification type has not been enabled.
Memory allocation failures on adding notifications lead to a general
multi failure state and result in CURLM_OUT_OF_MEMORY returned from
curl_multi_perform() and curl_multi_socket*() invocations.
Daniel Stenberg [Mon, 6 Oct 2025 10:43:40 +0000 (12:43 +0200)]
test766: verify CURLOPT_SOCKOPTFUNCTION error on accept
This test does active FTP with a socketopt callback that returns error
for the CURLSOCKTYPE_ACCEPT "purpose" to make sure we test and exercise
this error path - without leaks.
Viktor Szakats [Sat, 4 Oct 2025 10:58:49 +0000 (12:58 +0200)]
lib: stop overriding system printf symbols
After this patch, the codebase no longer overrides system printf
functions. Instead it explicitly calls either the curl printf functions
`curl_m*printf()` or the system ones using their original names.
Also:
- drop unused `curl_printf.h` includes.
- checksrc: ban system printf functions, allow where necessary.
Viktor Szakats [Mon, 6 Oct 2025 13:46:29 +0000 (15:46 +0200)]
ldap: tidy-up types, fix error code confusion
- fix `CURLcode` vs. LDAP result code confusion.
Return `LDAP_NO_MEMORY` when `Curl_create_sspi_identity()` fails,
since it can only return `CURLE_OUT_OF_MEMORY` as error.
- use `ULONG` for result code on Windows. Drop casts.
- use portable `curl_ldap_num_t`. Drop casts.
- replace magic number 0 with `LDAP_SUCCESS`.
- compare with `LDAP_SUCCESS` instead of assuming non-zero.
(where necessary.)
- add/fix `#endif` comments.
- fix indentation.
Daniel Stenberg [Mon, 6 Oct 2025 08:20:45 +0000 (10:20 +0200)]
ftp: improve fragile check for first digit > 3
In a case where rubbish would be sent in the line something that isn't a
digit could be first in line and treated as less than '3'. Prevent this
risk by first doing a check that the byte is a digit.
Daniel Stenberg [Mon, 6 Oct 2025 08:11:30 +0000 (10:11 +0200)]
ftp: add extra buffer length check
This adds an extra check that the buffer really has data enough (at
least 4 bytes) to check for a status code before doing so. It *should*
not be necessary, but this was pointed out by an analyzer and it feels
better to make sure.
Stefan Eissing [Mon, 6 Oct 2025 11:45:38 +0000 (13:45 +0200)]
cf-socket: check params and remove accept procondition
- creating a socket filter with NULL addrinfo fails with
CURLE_BAD_FUNCTION_ARGUMENT
- remove getsockname use before accept call, serves no purpose
and did not lead to proper error before
Viktor Szakats [Sat, 4 Oct 2025 01:10:37 +0000 (03:10 +0200)]
curlx: move Curl_strerror, use in src and tests, ban `strerror` globally
Also:
- tests/server: replace local `sstrerror()` with `curlx_strerror()`.
- tests/server: show the error code next to the string, where missing.
- curlx: use `curl_msnprintf()` when building for src and tests.
(units was already using it.)
- lib: drop unused includes found along the way.
- curlx_strerror(): avoid compiler warning (and another similar one):
```
In file included from servers.c:14:
../../lib/../../lib/curlx/strerr.c: In function ‘curlx_strerror’:
../../lib/../../lib/curlx/strerr.c:328:32: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
328 | SNPRINTF(buf, buflen, "%s", msg);
| ^
../../lib/../../lib/curlx/strerr.c:47:18: note: ‘snprintf’ output 1 or more bytes (assuming 2) into a destination of size 1
47 | #define SNPRINTF snprintf
| ^
../../lib/../../lib/curlx/strerr.c:328:7: note: in expansion of macro ‘SNPRINTF’
328 | SNPRINTF(buf, buflen, "%s", msg);
| ^~~~~~~~
```
Joshua Rogers [Sun, 5 Oct 2025 02:57:29 +0000 (10:57 +0800)]
telnet: use pointer[0] for "unknown" option instead of pointer[i]
i is taken from pointer[length-2] (often the IAC byte) before we do
length -= 2, so using pointer[i] indexes an arbitrary/stale byte
unrelated to the option code. pointer[0] is the suboption’s option code
per the telnet SB format, so printing pointer[0] yields correct, stable
diagnostics.
Joshua Rogers [Sun, 5 Oct 2025 02:38:14 +0000 (10:38 +0800)]
cpool: make bundle->dest an array; fix UB
Replace `char *dest[1]` with a proper `char dest[1]` array in
cpool_bundle. This removes undefined behavior from memcpy (writing past
the declared object) while keeping the same key semantics: dest_len is
strlen+1 (includes NUL), and hash add/delete calls remain unchanged.
Viktor Szakats [Sat, 4 Oct 2025 11:04:29 +0000 (13:04 +0200)]
checksrc: fix possible endless loops/errors in the banned function logic
By quoting the search expression to be replaced. This avoid the issue
when the code leading up to a banned function contained regex characters
that the script did not explicitly handle, e.g. `+`.
Viktor Szakats [Fri, 3 Oct 2025 14:40:28 +0000 (16:40 +0200)]
GHA: drop quictls 3.3.0 builds in favor of openssl 3.5+
- http3-linux: move local nghttpx (nghttp2) build to openssl (from
quictls). Also tried LibreSSL, but it made some HTTP/2 tests fails.
- http3-linux: drop quictls ngtcp2 build.
- http3-linux: build local openssl with `no-deprecated`.
(previously tested in the quictls local build.)
- http3-linux: explicitly disable LDAP in cmake openssl jobs.
cmake builds auto-detect OpenLDAP (autotools don't), and when enabled,
linking curl fails because system `libsasl.so` requires MD5 openssl
functions, which are missing from openssl no-deprecated builds.
- macos: move options tested in quictls jobs to other ones.
Viktor Szakats [Sat, 4 Oct 2025 02:12:17 +0000 (04:12 +0200)]
openssl: fix build for v1.0.2
```
lib/vtls/openssl.c: In function 'asn1_object_dump':
lib/vtls/openssl.c:299:42: error: passing argument 3 of 'i2t_ASN1_OBJECT' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
299 | int i = i2t_ASN1_OBJECT(buf, (int)len, a);
| ^
In file included from /home/runner/djgpp/include/openssl/objects.h:965,
from /home/runner/djgpp/include/openssl/evp.h:94,
from /home/runner/djgpp/include/openssl/x509.h:73,
from /home/runner/djgpp/include/openssl/ssl.h:156,
from lib/curl_ntlm_core.c:71,
from bld/lib/CMakeFiles/libcurl_static.dir/Unity/unity_0_c.c:88:
/home/runner/djgpp/include/openssl/asn1.h:921:58: note: expected 'ASN1_OBJECT *' {aka 'struct asn1_object_st *'} but argument is of type 'const ASN1_OBJECT *' {aka 'const struct asn1_object_st *'}
921 | int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a);
| ~~~~~~~~~~~~~^
```
Ref: https://github.com/curl/curl/actions/runs/18236773678/job/51931937131?pr=18039
Viktor Szakats [Thu, 2 Oct 2025 14:01:15 +0000 (16:01 +0200)]
tests: stop overriding system printf symbols
To make the source code match the functions called at runtime.
And to avoid the preprocessor trick that may introduces build issues.
Before this patch, libtests, tunits and units were calling a mixture
of curl and system printf calls, then transformed them all to curl
printf calls by including `curl_printf.h`.
Changes made:
- tests: stop including `curl_printf.h`.
- libtest: switch a couple of outlier system printf calls to curl
printf.
- unit: use more curl printf to avoid casts and show whole values.
- unit: switch remaining calls to curl printf explicitly.
- tunit: switch to call curl printf explicitly.
- libtest, tunit, unit: ban system printf.
- unit1307, unit1607, unit1609, unit1652, unit1655, unit3214: bump
types/masks to avoid casts.
After this patch:
- libtests, tunits, units: use exclusively curl printf.
(as before, but explicitly, without relying on redefinitions.)
- servers: is unchanged (it can only use system printf).
Viktor Szakats [Thu, 2 Oct 2025 19:33:48 +0000 (21:33 +0200)]
checksrc: reduce directory-specific exceptions
By making them defaults, then fixing and/or reshuffling remaining
exceptions as necessary.
- checksrc: ban by default: `snprintf`, `vsnprintf`, `sscanf`, `strtol`.
- examples: replace `strtol` with `atoi` to avoid a checksrc exception.
- tests/libtest: replace `strtol` with `atol`.
- tests/server: replace most `strtol` with `atol`.
- tests/server: replace most `strtoul` with `atol`/`atoi`.
- tests/server: drop no longer used `util_ultous`.
- fix typo in checksrc rules: `vsnprint` -> `vsnprintf`.
- update local exceptions.
Also:
- examples: ban curl printf functions. They're discouraged in user code.
- examples: replace curl printf with system printf.
Add `snprintf` workaround for <VS2015.
- examples/synctime: fix `-Wfloat-equal`.
- examples/synctime: exclude for non-Windows and non-UWP Windows.
- examples/synctime: build by default.
Viktor Szakats [Fri, 3 Oct 2025 01:12:39 +0000 (03:12 +0200)]
checksrc: fix to handle `)` predecing a banned function
Fixing:
```
Unmatched ) in regex; marked by <-- HERE in m/ \*buffer_len = \(ssize_t) <-- HERE
strtol\(/ at /home/runner/work/curl/curl/scripts/checksrc.pl line 916, <$R> line 380.
```
Ref: https://github.com/curl/curl/actions/runs/18209824275/job/51848079550#step:3:5
Stefan Eissing [Fri, 3 Oct 2025 12:15:04 +0000 (14:15 +0200)]
doh: inherit new custom ssl flags
The new custom_* flags in the SSL config need to be inherited when
setting up the doh easy handle, so that defaults apply the same way as
for the original easy handle.
Daniel Stenberg [Fri, 3 Oct 2025 08:51:46 +0000 (10:51 +0200)]
progress: expand to use 6 characters per size
Previously the progress meter used a maximum of five digits+letter in
the progress meter output: up to 99999 bytes and then 9999k, 9999M etc.
The output then used two spaces after the size between the next field in
the display.
This new approach uses one letter more with only one space in between
the fields. It makes it possible to show up to 999999 bytes and then
99999k, 99999M etc. The function uses a single decimal when outputting a
value less than 1000 in any unit. Like 999.9M.
Stefan Eissing [Thu, 2 Oct 2025 12:20:05 +0000 (14:20 +0200)]
vquic: handling of io improvements
- better tracing of what system call is used and how often
- ngtcp2: combine vquic_send into larger chunks
- ngtcp2: define own PMTU values and enable MTU probing
- ngtcp2: trace interesting remote transport parameters
Stefan Eissing [Wed, 24 Sep 2025 08:19:46 +0000 (10:19 +0200)]
ssl: support Apple SecTrust configurations
- configure/cmake support for enabling the option
- supported in OpenSSL and GnuTLS backends
- when configured, Apple SecTrust is the default trust store
for peer verification. When one of the CURLOPT_* for adding
certificates is used, that default does not apply.
- add documentation of build options and SSL use
Viktor Szakats [Thu, 2 Oct 2025 11:39:35 +0000 (13:39 +0200)]
INTERNALS: specify minimum version for Heimdal: 7.1.0
Released on 2016-Dec-19, it's the first "revamped" stable version, and
the earliest available as a source tarball at the official repository:
https://github.com/heimdal/heimdal/releases/tag/heimdal-7.1.0
It's also the first version hosted by Homebrew. It builds fine locally
with curl, and also builds in CI with old linux: 7.1.0+dfsg-13+deb9u4.
Viktor Szakats [Wed, 1 Oct 2025 20:07:37 +0000 (22:07 +0200)]
CI: move no-verbose build from Circle CI to existing GHA jobs, with tests
To test it in GHA and catch issues at PR time. Before this patch,
Circle CI caught them after pushing to master (or non-fork PR
branches.) GHA also run runtests, pytests and static analysis on
these builds, after this patch.
- GHA/linux: enable no-verbose in an existing job.
- GHA/linux: enable no-verbose in the H3 scan-build job too.
- GHA/macos: enable no-verbose in one build (= 3 jobs with different
compilers).
- GHA/codeql: enable no-verbose in the MultiSSL Linux build.
- circleci: delete openssl no-verbose job in favor of the above.
Daniel Stenberg [Thu, 2 Oct 2025 06:30:52 +0000 (08:30 +0200)]
lib: remove personal names from comments
- it's just too random who got mentioned
- we can't mention all, so better consistently mention none
- make sure they all are mentioned in THANKS
- also remove some unnecessary comment ramblings
Daniel Stenberg [Thu, 2 Oct 2025 08:20:59 +0000 (10:20 +0200)]
tool_getparam: always disable "lib-ids" for tracing
Since the tool code itself adds the ids (controlled with "ids"), getting
them (also) added by the library adds nothing good. Always disable the
lib-ids even when "--trace-config all" is selected.
Also: change "== Info:" into just "* " to reduce output redundancy.
Ref: #18755 Reported-by: Alice Lee Poetics
Closes #18805