Commit Graph

35949 Commits

Author SHA1 Message Date
Viktor Szakats
7afbc39173
cmake: make libpsl required by default
As done earlier in `./configure`:

To force users to explictily disable it if they really don't want it
used and make it harder to accidentally miss it.

`-DCURL_USE_LIBPSL=OFF` is the option to use if PSL is not wanted.

Follow-up to 2998874bb6 #12661

Closes #15464
2024-12-16 19:39:46 +01:00
Viktor Szakats
49f2a23d50
cmake: add LDAP Find module
Move LDAP detection to its own Find module.

It supports `pkg-config` and the standard detection method used for
other dependencies, with version detection.

In curl CI it fixes LDAP detection in the OpenBSD job.

Closes #15273
2024-12-16 19:36:43 +01:00
Viktor Szakats
ae3ca135d1
lib: replace inline redefine with CURL_INLINE macro
Instead of redefining the `inline` keyword, introduce curl's own
`CURL_INLINE` macro and set it depending on the compiler's capabilities,
or use its value set via custom C flags.

Also keep honoring a custom `inline` macro, if set.

Closes #15523
2024-12-16 19:26:22 +01:00
Viktor Szakats
3dbd4362fd
cmake: use CMAKE_REQUIRED_LINK_DIRECTORIES
Use `CMAKE_REQUIRED_LINK_DIRECTORIES` with CMake 3.31.0 and upper,
in local macro `curl_required_libpaths()`.

9e95bd49f2
9e95bd49f2
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9795
https://cmake.org/cmake/help/v3.31/module/CheckSymbolExists.html

Tested OK with cmake 3.31.0-rc1.

Follow-up to 01a8157997 #15271
Follow-up to 7bab201abe #15193

Closes #15280
2024-12-16 18:35:34 +01:00
Viktor Szakats
05ba353435
cmake: drop redundant FOUND checks (libgsasl, libssh, libuv)
With `find_package(... REQUIRED)` the configuration fails and exits
if the package is not found. The `..._FOUND` check afterwards always
evaluates true and safe to delete.

Also true for brotli and zstd, but those are addressed differently
via #15431.

Closes #15465
2024-12-16 18:11:15 +01:00
Viktor Szakats
f58342ae21
cmake: improve curl_dumpvars() and move to Utilities.cmake
Also:
- dump variable types.
- show which variables are marked as advanced.
- use `IN ITEMS`.

Closes #15562
2024-12-16 18:08:13 +01:00
Viktor Szakats
dc874d4369
build: drop unused feature macros, update exception list
- cmp-config.pl: add remaining exceptions. Sort list.

- drop unused `HAVE_SYS_WAIT_H`.
  Follow-up to 50def7c881 #13249

- drop unused `HAVE_FCHMOD`.
  Follow-up to 03cb1ff4d6 #12395

- autotools: stop promoting variables to macros:
  `USE_NGTCP2_CRYPTO_*`, `USE_NGTCP2_H3`, `USE_OPENSSL_H3`,
  `HAVE_LIBRESSL`.
  They are not used in the source.

- cmake: drop unused `HAVE_O_NONBLOCK`,
  `HAVE_DISABLED_NONBLOCKING`.

- lib: drop `NEED_MALLOC_H`.
  It was used in manual-build cases for Amiga/MS-DOS/Windows/WinCE, but
  never by autotools/cmake, thus apparently unnecessary.

- lib: drop unused `NEED_MEMORY_H`.

- lib: simplify classic mac feature guards,
  drop `HAVE_EXTRA_STRICMP_H` and `HAVE_EXTRA_STRDUP_H`.

- autotools: drop unused `HAVE_GETHOSTBYNAME` detection.

- autotools: drop unused OpenSSL feature tests:
  `HAVE_ERR_H`, `HAVE_PEM_H`, `HAVE_RSA_H`

- autotools: drop unused OpenSSL feature tests:
  `HAVE_X509_H`, `HAVE_CRYPTO_H`, `HAVE_SSL_H`.

  They performed a fallback check when the primary check missed
  `openssl/x509.h`. Though if any other prefixed headers were found,
  OpenSSL is already assumed detected.

  The fallback check was looking for 3 unprefixed OpenSSL headers, and
  if all found, marked OpenSSL found internally, but did not promote
  it to `curl_config.h` via `USE_OPENSSL`. Meaning it either didn't do
  anything or may have continued with an inconsistent state.
  Added in d99c20f628 (2008)

  At the time, there was an extra `AC_DEFINE(USE_SSLEAY, 1 ...` logic
  after this code, which kicked in in the fallback case, but that code
  was deleted in 709cf76f6b (2015)

  Follow-up to 709cf76f6b

- autotools: drop `AC_SUBST()` where the value is explicitly set anyway
  and the macro is unused.

- autotools: replace `AC_SUBST(VAR, 1)` with local variable assigments,
  where the `@VAR@` macro is unused. Also dedupe the local variable if
  there was a parallel one used for the same purpose.

- autotools: drop local feature variables that were never used.

- autotools: drop unused `CURL_CHECK_OPTION_NTLM_WB`,
  `CURL_CHECK_NTLM_WB`.
  Also stop setting unused `NTLM_WB_ENABLED` macro for VMS.
  Follow-up to 50def7c881 #13249

- autotools: drop unused `PKGADD_*`.
  Follow-up to bae0d473f5 #3331

- autotools: drop unused `CURL_NETWORK_LIBS`.
  Follow-up to 3af75e18d6 #14697

Closes #15577
2024-12-16 18:05:24 +01:00
Viktor Szakats
ba9fe58d43
GHA: set persist-credentials: false
Suggested by zizmor GHA analysis tool.

Also:
- Move GH variables within single-quotes.
- Prefer single-quotes in shell code. (tidy-up)

Ref: https://github.com/actions/checkout/issues/485
Ref: https://github.com/actions/checkout/pull/1687
Ref: https://woodruffw.github.io/zizmor/

Closes #15746
2024-12-16 18:00:22 +01:00
Daniel Stenberg
9991f255dd
RELEASE-NOTES: synced 2024-12-16 10:09:22 +01:00
Daniel Stenberg
0af5ce162f
variable.md: mention --expand-variable for variables to variables
To assign a variable using contents from another variable.

Closes #15752
2024-12-16 08:17:22 +01:00
Hermes Zhang
fc5c9ed253 tool_getparam: fix memory leak on error in parse_ech
- Free tmpcfg memory before returning an error code if aprintf failed.

Closes https://github.com/curl/curl/pull/15753
2024-12-16 00:56:11 -05:00
Daniel Stenberg
6eb86e428d
ws-docs: remove the outdated texts saying ws support is experimental
It stopped being experimental in 8.10.0

Fixes #15749
Reported-by: Mohammed Sadiq
Closes #15751
2024-12-15 18:14:52 +01:00
Daniel Stenberg
c3857eca70
altsvc: avoid integer overflow in expire calculation
A bad value here just makes for a bad alt-svc experience, not a security
problem.

Detected by OSS-Fuzz

Bug: https://issues.oss-fuzz.com/issues/383911309

Closes #15745
2024-12-15 00:11:24 +01:00
Viktor Szakats
f7cd713d38
cmake/FindMbedTLS: drop lib duplicates early
When de-duplicating the list of raw libs, make sure to drop duplicates
from the beginning of the list.

Reported-by: Kai Pastor
Ref: https://github.com/curl/curl/pull/15273#pullrequestreview-2417191841
Closes #15495
2024-12-14 23:43:02 +01:00
Daniel Stenberg
9294ca8916
variable.md: show function use with examples
Closes #15743
2024-12-14 17:00:23 +01:00
Daniel Stenberg
cd80716cb6
docs/BUGS.md: remove leading space from a link 2024-12-14 14:22:38 +01:00
Daniel Stenberg
62515e8e9d
scripts/mdlinkcheck: markdown link checker
This script parses all markdown files in the repository, extracts all
links and verifies that they work.

It makes sure to only check the URLs once, even if used in multiple
links. There is a whitelist for URLs we deem unnecessary to check.

It uses curl to do the checks.

As a bonus, this makes it easy to run this check locally.

Closes #15742
2024-12-14 14:22:30 +01:00
Daniel Stenberg
6bb76d92e1
tool_getparam: fix the ECH parser
The pn: and ecl: prefixes were not handled correctly.

CodeSonar helped me realize as it poined out an "Unreachable Data Flow"

Closes #15741
2024-12-14 11:51:30 +01:00
Daniel Stenberg
cffbbc693e
tool_getparam: fix "Ignored Return Value"
Follow-up from a300879b63

Pointed out by CodeSonar

Closes #15740
2024-12-14 11:50:23 +01:00
Daniel Stenberg
7347ddc9e2
tool_operate: make --etag-compare always accept a non-existing file
Consider it a blank etag. It allows for more use cases when the file
just might not have been created yet.

Closes #15737
2024-12-13 15:48:27 +01:00
Daniel Stenberg
c64c3527e5
RELEASE-NOTES: synced 2024-12-13 11:50:43 +01:00
renovate[bot]
97866f1620
GHA: pin dependencies
For recently added actions in checkdocs.yml and windows.yml

Closes #15722
2024-12-13 10:52:40 +01:00
Daniel Stenberg
a300879b63
curl: return error if etag options are used with multiple URLs
And document it.

Add tests 484 and 485

Fixes #15729
Reported-by: Tamir Duberstein
Closes #15731
2024-12-13 10:11:26 +01:00
Kevin Sun
0439499170
netrc: restore _netrc fallback logic
Regression from 05977f4f75fd08837a877, shipped in 8.11.0

Fixes #15734
Closes #15735
2024-12-13 10:08:00 +01:00
Daniel Stenberg
c2ac9ea1ee
checksrc: ban use of sscanf()
Using sscanf() is not a (security) problem in itself, but we strongly
discorage using it for parsing input since it is hard to use right, easy
to mess up and often makes for sloppy error checking.

Allow it in examples and tests

Closes #15687
2024-12-13 09:43:05 +01:00
Daniel Stenberg
d5c738c608
strparse: string parsing helper functions
Designed to aid converting off from sscanf parsers. sscanf is hard to
use right, easy to mess up and often makes for sloppy error checking.

The new parsers allow more exact and pedandic parsing.

This new set of functions should be possible to use (and extend) and
switch over other libcurl parser code to use going forward.

Adapts the following to use the new functions:

- altsvc.c
- hsts.c
- http_aws_sigv4.c

Bonus: fewer memory copies, fewer stack buffers.

Test: Unit test1664

Docs: docs/internals/STRPARSE.md

Closes #15692
2024-12-12 16:00:52 +01:00
Andy Pan
ff5091aa9f
async-thread: avoid closing eventfd twice
When employing eventfd for socketpair, there is only one file
descriptor. Closing that fd twice might result in fd corruption.
Thus, we should avoid closing the eventfd twice, following the
pattern in lib/multi.c.

Fixes #15725
Closes #15727
Reported-by: Christian Heusel
2024-12-12 15:58:47 +01:00
Randall S. Becker
aed732acb1
tests/http/clients: use proper sleep() call on NonStop
This fix impacts ws-data.c and ws-pingpong.c. sleep() replaced with
system PROCESS_DELAY_() having the same resolution as usleep().

Fixes #15711
Closes #15712

Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
2024-12-12 14:30:28 +01:00
Randall S. Becker
ae4ec1d2ec
system.h: add 64-bit curl_off_t definitions for NonStop
Fixes #15723
Closes #15724

Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
2024-12-12 14:27:40 +01:00
Christian Schmitz
df1d08ec0d
sectransp: free certificate on error
Otherwise the certificate memory was leaked.

Closes #15721
2024-12-11 13:09:44 +01:00
Christian Schmitz
017e6440ce
conncache: result_cb comment removed from function docs
result_cb doesn't exist anymore

Closes #15720
2024-12-11 13:07:18 +01:00
Daniel Stenberg
a8397643f3
GHA/checkdocs: change markdown link checker to linkspector
Fixes #15717
Closes #15719
2024-12-11 13:05:11 +01:00
Daniel Stenberg
6907638631
RELEASE-NOTES: synced
Start working on the next release
2024-12-11 11:16:48 +01:00
Daniel Stenberg
98b30eda79
RELEASE-PROCEDURE.md: mention how to publish security advisories
As they are releated to the release procedure

Closes #15714
2024-12-11 11:11:32 +01:00
Daniel Stenberg
a8c852b9a5
cookie: parse only the exact expire date
The date parser function is very forgiving and skips most "irrelevant"
characters in its hunt for a date to figure out. Therefore it is
important to make sure the date string is properly null terminated so
that it does not accidentally parse a piece of whatever text follows
after the date.

Add test483: test (overly) long expire dates in cookies

Closes #15709
2024-12-11 09:31:53 +01:00
Daniel Stenberg
75f0835513
lib517: extend the getdate test with quotes and leading "junk"
Closes #15708
2024-12-11 09:19:50 +01:00
Daniel Stenberg
75a2079d5c
RELEASE: synced
curl 8.11.1 release
2024-12-11 08:05:13 +01:00
Daniel Stenberg
cff5a7b641
THANKS: contributors from 8.11.1 2024-12-11 08:05:13 +01:00
Viktor Szakats
2d4852af83
build: fix tests when documentation/manual is disabled
- build: fix to exclude 'documentation' tests when building
  the documentation is explicitly disabled. Both for cmake
  and `./configure`.

  Reported-by: Daniel Engberg
  Fixes #15703

- test481, test482: fix for builds with no manual.

  Reported-by: Daniel Engberg
  Fixes #15703

- configure: fix to always detect Perl. Running tests require
  it when run. Before this patch Perl wasn't detected when
  documentation/manual/embedded-CA were all disabled,
  making tests fail to start.

- test1177: add keyword `documentation`. It depends no
  `curl_version_info.3`.

- GHA/linux: test cmake and `./configure` with docs and
  manual disabled and tests run.

Closes #15704
2024-12-09 12:45:29 +01:00
renovate[bot]
72266a3e9f
GHA: update four depencencies
- github/codeql-action digest to aa57810
- cross-platform-actions/action action to v0.26.0
- actions/cache digest to 1bd1e32
- msys2/setup-msys2 digest to d44ca8e

Closes #15674
Closes #15686
Closes #15696
Closes #15702
2024-12-09 10:31:24 +01:00
Daniel Stenberg
96ffb57040
docs: bring back ALTSVC.md and HSTS.md
This partly reverts 0e06603b23

These file formats are not properly documented elsewhere, plus the
website uses these files to populate the documentation pages to which
users end up via the URLs that are mentioned within the alt-svc and hsts
files.

Fixes #15705
Reported-by: Jeffrey Bosboom
Closes #15706
2024-12-09 09:32:19 +01:00
Marcel Raad
ebce0e7e4a
test2086: disable MSYS2's POSIX path conversion
Older MSYS2 versions treat the URL as paths list and convert them from
UNIX to Windows format. There's no path here that needs to be
converted, so disable path conversion for this test as done for others.

Fixes https://github.com/curl/curl/pull/15644#issuecomment-2511313206
Closes https://github.com/curl/curl/pull/15677
2024-12-08 23:03:23 +01:00
Daniel Stenberg
59fec5ac43
mprintf: fix the integer overflow checks
When a floating point precision or string width are provided as a
base-10 number, the code could miss to detect integer overflows if the
provided value was exactly 2147483648 or 2147483649 (2147483647 being
the maxium value a signed integer can hold).

The chance that such values would actually ever be used is slim.

This change fixes the detection to also cover those edge cases.

Closes #15699
2024-12-06 16:38:30 +01:00
Daniel Stenberg
ec14be6a4d
RELEASE-NOTES: synced 2024-12-06 09:24:45 +01:00
Daniel Stenberg
8d926c653b
tool_getparam: remove Redundant Condition
Pointed out by CodeSonar

Closes #15698
2024-12-06 09:20:05 +01:00
Jay Satiro
a4458c7ee3 hostip: don't use the resolver for FQDN localhost
- Treat `[<any>.]localhost.` (ie localhost with FQDN period terminator)
  as fixed value 127.0.0.1 and ::1 instead of querying the resolver.

Prior to this change, b5c0fe20 (precedes 7.85.0) did the same for
non-FQDN `<any>.localhost`.

Prior to this change, 1a0ebf66 (precedes 7.78.0) did the same for
non-FQDN `localhost`.

Ref: https://github.com/curl/curl/issues/15628#issuecomment-2515540315

Closes https://github.com/curl/curl/pull/15676
2024-12-05 17:16:34 -05:00
Daniel Stenberg
6755ba593c
http_negotiate: allow for a one byte larger channel binding buffer
The channel binding data dynbuf was not set correctly making it fail with
CURLE_TOO_LARGE too easily.

Reported-by: galen11 on github
Fixes #15685
Closes #15694
2024-12-05 23:09:28 +01:00
chemodax
b6aecd4a98
cmake: set CURL_STATICLIB for static lib when SHARE_LIB_OBJECT=OFF
When compiled with BUILD_STATIC_LIBS=ON and SHARE_LIB_OBJECT=OFF compile
definition CURL_STATICLIB was not set for static library. It seems to be
copy-paste error in the lib/CMakeLists.txt.

This pull request fixes it.

Closes #15695
2024-12-05 20:52:01 +01:00
Stefan Eissing
ce949ba1dc
mime: fix reader stall on small read lengths
The base64 mime encoder stalls when it cannot encode a full 3 byte input
set into the read buffer. The workaround for this limitation was
incomplete and could lead to stalled transfers when the last chunk to
upload was smaller than 4 bytes.

Use a tmp buffer on small reads to allow mime encoders more space to put
their things.

Add test case reproducing the issue and fix.

Reported-by: Alexis Savin
Fixes #15688
Closes #15691
2024-12-05 15:44:51 +01:00
andrewkirillov-ibm
4bba14c35d
dmaketgz: use --no-cache when building docker image
Fixes #15689
Closes #15690
2024-12-05 15:41:53 +01:00