Commit Graph

35949 Commits

Author SHA1 Message Date
Daniel Stenberg
b2ca61a0ac
curlinfo: provide the 'digest' feature
... since the tests check for the feature using this name, we
accidentally had lots tests not run because this provided the
`digest-auth` feature that was not checked for.

Closes #17786
2025-07-01 09:53:15 +02:00
Viktor Szakats
73840836a5
tests: move GSS-API dynamic stub into debug-mode libcurl
Replace the `libstubgss.so`-based overload solution with one built into
libcurl at compile-time.

The previous, `LD_PRELOAD`-based, solution was non-portable, allowlisted
for Linux, BSD and Solaris. It also required non-debug builds, which
turned out to be an accidental condition:
7d342c723c. It also required a curl tool
built against a shared libcurl. Detecting this condition wasn't always
accurate, e.g. with certain cmake configurations.

The overload solution also didn't work on macOS, though it theoretically
should have:
- #17653
- #2394

Experiments on making the overload solution work in more envs:
- #17759
  That revealed that it also did not work on NetBSD, in CI.

The replacement solution is overloading the necessary GSS-API functions
for test 2056 and 2057 at compile time. It requires a debug-enabled curl
build (due to its insecure nature).

This makes these tests run on all platforms. Including most GSS jobs in
CI, that are running tests. (the exception is old-linux, non-debug jobs,
where it felt overkill to enable debug for this.)

The refactored GSS stub code needs to overload less than before because
it's free to use the official GSS API. (This didn't work with
the overload solution on Alpine for example). It can also use libcurl
functions, allowing to replace `snprintf()` with `msnprintf()`.

OS/400 is also overloading GSS API functions. I haven't tested how this
works after this PR. In theory it should, because this PR doesn't rely
on preprocessor overrides.

Note that for future GSS tests, it may be necessary to stub these GSS
API functions: `gss_inquire_context()`, `gss_unwrap()`, `gss_wrap()`.
They are on codepaths not (yet) touched by tests.

Also:
- stub-gss: check for token buffer overrun.
- stub-gss: replace size macros with `sizeof()`.
- GHA: enable debug for some jobs with GSS.
- GHA/linux: ignore results for 2056 and 2057 in the valgrind job.
  They leak the same way as seen with 2077 and 2078.
  Ref: 7020ba7979 #17462
  Ref: 146759716c #14430
- GHA/linux: fix to ignore `gss_import_name()` leaks in valgrind builds.
  only.
- lib/vauth/krb5_gssapi: reduce variable scope.
- lib/vauth/spnego_gssapi: reduce variable scope.
- tests/libtest: drop code and build logic dealing with `libstubgss`.
- runtests:
  - drop `ld_preload` feature.
  - drop special handling of `LD_PRELOAD` env in tests.
  - drop logic dealing with shared curl tool detection.
  - drop `LD_PRELOAD` envs from tests.

Follow-up to 56d949d31a #1687

Closes #17752
2025-07-01 00:17:15 +02:00
Daniel Stenberg
c9bb9cd165
unit tests: extract "private" prototypes at build time
In order to do unit tests for private functions, functions that are
marked UNITTEST but without a global scope in the library, functions
that do not have prototypes in their corresponding header file, unit
tests previously brought their own private prototype *copy* into the
unit test.

This was error-prone when the internal function changes but the change
might be missed in the unit test which then uses an outdated prototype
copy for testing.

This change removes the private prototypes from unit tests and instead
introduces a C file parser that parses the specific C files and extracts
the necessary unit test prototypes into a generated header file for unit
tests to use. This geneated lib/unitprotos.h header is then included by
unit tests that need private prototypes.

Assisted-by: Viktor Szakats
Closes #17750
2025-06-30 23:16:40 +02:00
Viktor Szakats
48d3407d7c
GHA: fix zizmor 1.10.0 warnings, update names
Job `name:` now mandatory in zizmor.

Also:
- enclose `name:` values in single-quotes, for uniformity.
- drop `name: checkout` where set, for uniformity.
- dist: also install with cmake.
- dist: replace `make` with `cmake --build` for cmake.
  (to make this make-tool agnostic)
- appveyor-status: double-quote shell arguments.
- tweak existing names to be shorter, to sync terms and style across
  jobs and steps.

Ref: https://github.com/zizmorcore/zizmor/releases/tag/v1.10.0

Closes #17773
2025-06-30 18:38:56 +02:00
Viktor Szakats
a3787f98ac
lib: drop two interim macros in favor of native libcurl API calls
Drop `strcasecompare` and `strncasecompare` in favor of libcurl API
calls `curl_strequal` and `curl_strnequal` respectively.

Also drop unnecessary `strcase.h` includes. Include `curl/curl.h`
instead where it wasn't included before.

Closes #17772
2025-06-30 18:38:56 +02:00
Fabrício Canedo
d553f7e9f0
docs/CONTRIBUTE: fix broken link
Add the missing "docs" directory in the link.

Closes #17780
2025-06-30 13:47:06 +02:00
Stefan Eissing
a29133e909
multi: remove careful bounds check as coverity says it is not needed
And we all hope that future code changes will not make it necessary
again or this will all be blamed on you, coverity!

Closes #17784
2025-06-30 13:46:06 +02:00
Stefan Eissing
21ecc7e376
cf-socket: make socket data_pending a nop
Eliminating the socket readability check in the socket connection
filters for the 'data_pending' callback. Improves performance of
handling of transfers, up to ~30%, depending on parallelism and response
size.

Whatever `data_pending()` once was, its semantics are now:
"Is there anything buffered in the connection filters that needs
 receive?"
Any checks of the socket's readability are done via `multi_wait()`
and friends.

Fix the one place in HTTP/1 proxy code that checked `data_pending()` and
did an early return if false. Remove that check and actually try to
receive data every time.

Closes #17785
2025-06-30 13:44:24 +02:00
Daniel Stenberg
a487a4e4bd
RELEASE-NOTES: synced 2025-06-29 17:02:37 +02:00
Daniel Stenberg
a3272c526c
GHA: make the spacecheck say line number for trailing space errors
As it can be quite confusing and frustrating without it.

Closes #17777
2025-06-29 16:43:41 +02:00
Daniel Stenberg
ff15eef2d6
VULN-DISCLOSURE-POLICY: all reports should be disclosed
As a matter of policy.

Closes #17778
2025-06-29 16:42:03 +02:00
Dan Fandrich
0b98f596c8 firefox-db2pem: avoid use of eval in script
This could potentially be exploited by manipulating nicknames in the
cert DB.

Reported-by: behindtheblackwall on hackerone
Closes #17766
2025-06-28 21:12:27 -07:00
Viktor Szakats
d2a408587a
cmake: fix generator expression in docs/examples
To pass the MSVC-specific macro to MSVC only.

Closes #17767
2025-06-28 02:00:09 +02:00
Viktor Szakats
f9656445ba
checksrc: reduce exceptions, apply again to curlx
- tests/libtest: move exception to `stub_gssapi.h`.
- tests/libtest: move remaining exception to `testtrace.c`.
- tests/server: drop obsolete exception.
- docs/examples: move `BANNEDFUNC` exceptions to local files (3 lines).
- docs/examples: move `ERRNOVAR` exception to `ephiperfifo.c`.
- docs/examples: drop `typedef struct` (8 files).
- lib/curlx: add `.checksrc` with banned funcs copied from lib.
- checksrc: ban `strncpy`, `strtok_r`, `strtoul` by default.
  Drop local bans. Add exception for `strtoul` to `tests/server'.
- lib, src: sync banned funcs.

Also:
- REUSE: drop `stunnel.pem`, it no longer exists.
- docs/examples: formatting.
- docs/examples: simplify some `sizeof()`s.

Closes #17764
2025-06-27 17:33:35 +02:00
Viktor Szakats
081e78b023
lib: replace scache no-op macros with #ifdef
To avoid warning/error in no-SSL, non-unity builds:
```
lib/multi.c:273:5: error: code will never be executed [-Werror,-Wunreachable-code]
273 |     goto error;
    |     ^~~~~~~~~~
```

Reported-by: Marcel Raad
Fixes #17754
Closes #17760
2025-06-27 17:33:34 +02:00
Viktor Szakats
3f36e1e502
lib2082: drop typedef struct
To not need the checksrc exception `disable TYPEDEFSTRUCT`.

Follow-up to a517378de5 #7477

Closes #17763
2025-06-27 14:16:30 +02:00
Viktor Szakats
344ccb077c
tests/libtest: drop a checksrc exception
Follow-up to a0a1df5af9 #17414

Closes #17762
2025-06-27 14:16:21 +02:00
Stefan Eissing
d4983ffc13
bufq: change read/write signatures
Change the signature of `bufq` functions from

* `ssize_t Curl_bufq_*(..., CURLcode *err)` to
* `CURLcode Curl_bufq_*(..., size_t *pn)`

This allows us to write slightly less code and avoids the ssize_t/size_t
conversions in many cases. Also, it gets the function in line with all
the other send/recv signatures.

Added helper functions in `cfilters.h` for sending from/receving into
a bufq.

Fuzzer now fails to build due to these changes and its testing of
the bufq API.

Closes #17396
2025-06-27 14:16:21 +02:00
Daniel Gustafsson
86eb054286 VULN-DISCLOSURE-POLICY: exclude not installed software
Flaws in any script or compiled artifact which isn't installed by
default is not considered to be security vulnerabilities.

Closes #17761
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
2025-06-27 12:08:01 +02:00
Viktor Szakats
cf8c0e9cbd
curl-config: fix whitespace in usage text
Closes #17758
2025-06-27 01:03:08 +02:00
Viktor Szakats
7b0b03c057
runtests: fix LD_PRELOAD detection for cmake-built curl binaries
CMake builds by default don't include a triplet in the `curl -V` output,
but a CMake-specific OS string, which is usually capitalized or stylized,
e.g. "Linux", or "FreeBSD". Make the regexp expression case-insensitive
to handle this.

Follow-up to 171b623759 #17653

Closes #17756
2025-06-27 00:24:13 +02:00
Marcel Raad
2a9dfe275d
http: fix build with cookies and HSTS disabled
All arguments and local variables in `http_header_s` were unused when
both `CURL_DISABLE_COOKIES` and `CURL_DISABLE_HSTS` were defined.

Closes https://github.com/curl/curl/pull/17753
2025-06-26 12:19:16 +02:00
Viktor Szakats
f37d5f42f2
tests: fix BUNDLE variable references in Makefile.am
Bug: https://github.com/curl/curl/pull/17750/files#diff-0c866a04cf144e1595f64820c652daaa923358d4de1b30ca8baf85c70ec12a2dR83

Closes #17751
2025-06-26 10:55:47 +02:00
Viktor Szakats
1679802b3a
tests: use %b64[] to base64 data in 2056, 2057
Follow-up to 63011ac638 #17721

Closes #17748
2025-06-26 10:20:43 +02:00
Viktor Szakats
73c548e101
autotools: drop redundant Makefile.inc from EXTRA_DIST in src
Closes #17747
2025-06-26 10:20:43 +02:00
Viktor Szakats
53c88435d8
build: split .c and .h file lists in tests
It allows to pass `.h` files only where they are really needed, which is
`EXTRA_DIST` (or `*SOURCES`) for autotools.

Also:
- rename variables to be shorter and consistent.
- drop references to non-local headers. We don't need to pass them as
  dist sources.
- drop empty variables and references, after the above.
- server: add placeholder `UTIL_H`.

Closes #17745
2025-06-26 10:20:41 +02:00
Dan Fandrich
f547bca4b6 DISTROS: update NixOS link 2025-06-25 23:01:58 -07:00
DoI
83baac43a8
curl: improve non-blocking STDIN performance
Using a select() call on supported platforms to check for data with a
given timeout

Closes #17566
2025-06-25 22:58:53 +02:00
Viktor Szakats
4914c2177e
autotools: detect and link brotlicommon library for brotli
`brotlicommon` is necessary when linking brotli statically.
E.g. on Alpine Linux with `PKG_CONFIG='pkg-config --static'`.

It also syncs brotli libs listed in `libcurl.pc` and `curl-config` with
those generated by cmake, which already listed `brotlicommon` there.

Also:
- remove workaround from GHA/configure-vs-cmake CI jobs.

Ref: 69cda1b704
Follow-up to f2adb3b6d7 #15431
Reported-by: Christopher Boyd
Fixes #17678
Closes #17723
2025-06-25 19:45:35 +02:00
SC404
6c85579c84
cmake: enable soversion by default for OpenHarmony OS
Closes #17743
2025-06-25 15:49:17 +02:00
Daniel Stenberg
d22057d78b
lib: address singleuse issues
- markup some functions UNITTEST, so that they are static unless in a
  unit test build

- make some functions #ifdef UNITTESTS as they are only used from unit
  tests

- adjusted unit tests accordingly to use local prototypes for functions
  not global in the library

Closes #17734
2025-06-25 11:46:26 +02:00
Daniel Stenberg
b5593a6fe0
urlapi: use uppercase hex encoding
For consistency. RFC 3986 section 2.1 says:

  "URI producers and normalizers should use uppercase hexadecimal digits
  for all percent-encodings."

Reported-by: Jeroen Ooms
Fixes #17685
Closes #17739
2025-06-25 11:44:13 +02:00
Daniel Stenberg
4c5672774f
runtests.pl: fix sprintf() using one too many %s
Closes #17740
2025-06-25 11:27:32 +02:00
Keno Fischer
40dcf5567c
docs: reflect that delimiter-separated capath is only OpenSSL
curl passes down the capath directly to the backends. OpenSSL will then
delimiter-separate this path internally to support multiple directories
(using its certificate hash scheme). However, the other backends
(wolfSSL, mbedTLS, gnutls) only expect a single directory (and do not
use the hash scheme, preferring to iterate the directory and load all
files). This adjusts the `--capath` documentation to reflect that
multiple paths is an OpenSSL-specific feature. Alternatively, curl could
delimiter-separate these itself, but I'm not sure it's worth it.

Ref https://github.com/JuliaLang/NetworkOptions.jl/issues/41

Closes #17737
2025-06-25 11:23:56 +02:00
Viktor Szakats
7ba58cf89c
autotools: drop headers from src mk-unity rules (fixup)
Unnecessarily added in f4649425f2.

Follow-up to f4649425f2 #17727

Closes #17742
2025-06-25 11:02:25 +02:00
Viktor Szakats
26326c5297
build: stubgss tidy-ups (in tests)
- cmake: avoid running clang-tidy twice.
- autotools: do not pass curl/libtest-specific macros.

Also:
- autotools: drop `CFLAG_CURL_SYMBOL_HIDING` from libtests.
   Unused since 09437d8cd4 #14695

Closes #17738
2025-06-25 09:57:06 +02:00
Viktor Szakats
f4649425f2
build: fix libcurltool with cmake and tunits, related tidy-ups
Sync how libcurltool is built in different modes and build systems.

cmake:
- build libcurltool with curlx when building shared libcurl.
  To make it possible to use standard libcurl when linking tunits.
  Also syncing this with autotools.
  The remaining difference is that cmake allows to select shared or
  static for curl tool and tests/examples independently.
- fix to link with libcurl instead of libcurlu.
  To sync with autotools and to link with the standard libcurl for
  tool unit tests.
- fix `source_group()` to always include curlx sources.
- add missing 'curlx header files' source group.

autotools:
- build libcurltool without curlx when building static libcurl in
  non-unity builds.
  To avoid double compilation, just to be thrown away at link time.
  Also to sync with unity builds.

both:
- sync source order between autotools and cmake.
- make sure to pass all headers with both autotools and cmake.
  This is a no-op with cmake. Maybe a future patch should make sure
  to not pass those to remove that noise.

Ref: #17696

Closes #17727
2025-06-25 09:57:06 +02:00
Viktor Szakats
1ec0da0149
tests: constify, make consts static
- lib509: constify an input string.
- add `static` to const data, where missing.
- tool1394: fix indentation.

Closes #17736
2025-06-25 09:57:06 +02:00
Viktor Szakats
db512ee267
tests/server: move memory init to memptr.c
To sync with tests/libtest.

Closes #17735
2025-06-25 01:37:56 +02:00
Viktor Szakats
04e90d4814
mk-lib1521: replace printf with curl_mprintf
Ref: #17731

Closes #17732
2025-06-25 01:37:56 +02:00
Stefan Eissing
e80c893254
multi: xfer table/bitset, handle limits
* calculate capacity growth on multi's xfer table and bitsets to
  work correctly when approaching UINT_MAX
* uint-bset: track the first 64bit slot used. This avoids slot scans
  on empty sets.
* uint-tbl: remove restriction to grow ot UINT_MAX, it is multi's
  job to enforce limits suitable for its use
* test751: use curl_mfprintf() for error messages

Closes #17731
2025-06-24 15:02:52 +02:00
Daniel Stenberg
65f8253336
bufq: remove the unused Curl_bufq_unwrite function
Follow-up to 02edae54e8

Closes #17730
2025-06-24 10:56:54 +02:00
Joel Depooter
c153d9eadf
cmake: check USE_WINDOWS_SSPI when adding secur32 to CURL_LIBS
Instead of CURL_WINDOWS_SSPI.

When running CMake on Windows with no additional parameters (ie default
build configuration), the generated project files do not include the
`secur32.lib` library in the linker settings. This is because
the relevant check was looking at `CURL_WINDOWS_SSPI` instead of
`USE_WINDOWS_SSPI`.

`USE_WINDOWS_SSPI` is enabled when building with SChannel (the default
on Windows), or if `CURL_WINDOWS_SSPI` is specified on the command line.

Follow-up to 0d71b18153 #17413

Closes #17728
2025-06-24 09:57:42 +02:00
Viktor Szakats
8c9a9b87c2
appveyor: move old cmake from VS2008 to VS2010
In preparation of dropping the VS2008 job. To keep testing old cmake
(3.12.2) after that.

Closes #17725
2025-06-24 09:44:28 +02:00
Viktor Szakats
3ea0f71ffa
build: stop checking for sys/stat.h
It has been used unconditionally in `src` and `tests` since at least
2011-09-19 via fdecb56cbf. There are
earlier unguarded references in `tests`.

Also de-duplicate to include it just once.

Ref: https://github.com/curl/curl/pull/17717#issuecomment-2996631026

Closes #17724
2025-06-24 09:44:28 +02:00
Viktor Szakats
c4f9487089
tidy-up: replace <memdebug.h> with "memdebug.h" (src, units)
Closes #17722
2025-06-24 09:44:28 +02:00
Daniel Stenberg
c0cb3485fe
unit1302: expand the base64 encode/decode tests
Closes #17726
2025-06-24 07:55:16 +02:00
Viktor Szakats
bb50dee510
tests/server: de-dupe/merge three sockdaemon() clones into one
Also: tidy up `if()` expressions here and there.

Follow-up to f4f25505df #15000

Closes #17719
2025-06-23 17:02:43 +02:00
Viktor Szakats
1a70977a83
build: drop explicit curlx from hdr paths, refer headers with curlx/ prefix
To make all src and test code refer to curlx headers the same way.

Also:
- src: move `curlx.h` include to `tool_setup.h`.
- src/tool_setup.h: drop stray `curlx/timeval.h`.
- servers: de-duplicate `curlx.h` and `curl_setup.h` includes.
- libtests, units: drop stray curlx sub-headers in favor of
  `<curlx/curlx.h>`.
- tests: include `curlx.h` with `<>` instead of `""`. To match
  other parts of the codebase.

Closes #17680
2025-06-23 17:02:43 +02:00
Daniel Stenberg
63011ac638
tests: use %b64[] to base64 data
... instead of storing the data base64 encoded.

Closes #17721
2025-06-23 16:47:14 +02:00