Commit graph

14905 commits

Author SHA1 Message Date
Daniel Stenberg
613436dbbb
netrc: avoid NULL deref on weird input
A dynbuf that never gets populated might return a NULL, and Coverity
could find a way through like that.

Closes #17275
2025-05-07 17:15:39 +02:00
Stefan Eissing
412d3c3dc9
ldap: move easy handle protocol struct into meta hash
Removing the member of data->req.p

Closes #17269
2025-05-07 17:13:03 +02:00
Daniel Stenberg
3a2689712a
vtls: avoid NULL deref on bad PEM input
Spotted by Coverity

Closes #17274
2025-05-07 17:08:06 +02:00
Stefan Eissing
7b92844639
smtp: use easy handle/connectin meta for proto structs
Move `struct smtp_conn` and `struct STMP` into the meta data at easy
handle/connection. Remove it from the unions at connectdata and request.

Closes #17257
2025-05-07 16:01:05 +02:00
Daniel Stenberg
cf38e0067c
metahash: add asserts to help analyzers
Where NULL pointers are not acceptable input.

Closes #17268
2025-05-07 11:25:14 +02:00
Daniel Stenberg
255aac56f9
curlx: move into to curlx/
Move curlx_ functions into its own subdir.

The idea is to use the curlx_ prefix proper on these functions, and use
these same function names both in tool, lib and test suite source code.
Stop the previous special #define setup for curlx_ names.

The printf defines are now done for the library alone. Tests no longer
use the printf defines. The tool code sets its own defines. The printf
functions are not curlx, they are publicly available.

The strcase defines are not curlx_ functions and should not be used by
tool or server code.

dynbuf, warnless, base64, strparse, timeval, timediff are now proper
curlx functions.

When libcurl is built statically, the functions from the library can be
used as-is. The key is then that the functions must work as-is, without
having to be recompiled for use in tool/tests. This avoids symbol
collisions - when libcurl is built statically, we use those functions
directly when building the tool/tests. When libcurl is shared, we
build/link them separately for the tool/tests.

Assisted-by: Jay Satiro

Closes #17253
2025-05-07 11:01:15 +02:00
Stefan Eissing
17e13cba62
imap: use easy handle/connection meta for proto structs
Remove the imap protocol structs from connectdata->proto union
and data->req.p and use the easy handle/connection meta hash
for keeping them.

Closes #17261
2025-05-07 10:25:18 +02:00
Stefan Eissing
2e49965126
rtsp: move easy handle/connection protoocol structs into meta data
Remove the connectdata proto and data->req.p member for rtsp and manage
the structs as meta data at easy handle/connection.

Closes #17254
2025-05-06 17:13:24 +02:00
Daniel Stenberg
f7c544d867
pop3: add null pointer check
Pointed out by Coverity. A precaution to catch internal errors.

Follow-up to 76d13c721b

Closes #17255
2025-05-06 17:11:25 +02:00
Stefan Eissing
a30830db78
ftp: fix bug in failed init
torture tests revealed that memory was not released correctly when FTP's
connection setup failed an allocation.

Follow-up from a2d90d4ba5

Closes #17258
2025-05-06 13:22:12 +02:00
Stefan Eissing
777c5209df
smb: use easy handle/connection meta hash to keep structs
Keep easy/connection related protoocl structs in the meta hash instead
of the unions at request and connectdata.

Closes #17238
2025-05-06 09:10:07 +02:00
Stefan Eissing
cd3be116b6
rtmp: use connection meta for RTMP* instance
Keep RTMP* instance at connection meta hash.

Closes #17237
2025-05-06 09:09:21 +02:00
Stefan Eissing
76d13c721b
pop3: use meta hashes at easy handle and connection
Keep the pop3 related protocol information in the meta hashes at easy
handle and connection.

Move the struct definitions inside pop3.c

Closes #17236
2025-05-06 09:08:47 +02:00
Stefan Eissing
a2d90d4ba5
ftp: use easy handle and connectin meta data for protocol structs
- remove data->req.p.ftp and store `struct FTP` as easy meta data
- place `struct ftp_conn` instance in connection meta data

Closes #17249
2025-05-06 09:07:43 +02:00
Stefan Eissing
378aa011e6
tftp: use connections meta hash
Use connection meta hash for state struct instead of union pointer at
connectdata.

Closes #17235
2025-05-06 09:05:27 +02:00
Stefan Eissing
d57bdbf830
openldap: use connection meta for context struct
Remove member of conn->proto union.

Closes #17224
2025-05-06 09:04:01 +02:00
Viktor Szakats
838dc53bb7
spacecheck.pl: check for non-ASCII chars, fix fallouts
Reported-by: James Fuller
Assisted-by: Dan Fandrich

Closes #17247
2025-05-04 17:26:11 +02:00
Andrei Florea
a638828c88
TLS: add CURLOPT_SSL_SIGNATURE_ALGORITHMS and --sigalgs
Fixes #12982
Closes #16964
2025-04-30 17:47:22 +02:00
Viktor Szakats
3fcddc835c
scripts: fix perl indentation, whitespace, semicolons
Ref: #17116

Closes #17209
2025-04-29 19:35:55 +02:00
Corinna Brandt
ea897fddfc
openssl: set the cipher string before doing private cert
... as this allows a set string to affect how OpenSSL deals with the
private keys/certs.

Closes #17227
2025-04-29 16:17:48 +02:00
Stefan Eissing
47b2300192
mqtt: use conn/easy meta hash
Remove mqtt structs from the unions at connectdata and
easy handle requests. Use meta hash at easy/connnection.

Make mqtt structs private to mqtt.c

Closes #17221
2025-04-29 14:25:25 +02:00
Daniel Stenberg
e383ba53eb
multi_ev: remove redundant check for data
Pointed out by CodeSonar

Closes #17226
2025-04-29 14:22:31 +02:00
Stefan Eissing
f0824d1ed7
meta data handling for easy/conn fixes
- return error when adding to hash fails
- do not free passed in data, as ownership is taken by call

Closes #17219
2025-04-29 13:57:16 +02:00
Daniel Stenberg
2fa3d528ae
openssl: first unload the provider, then free the context
Doing it in the reversed order causes bad problems inside OpenSSL.

Closes #17223
2025-04-29 12:45:23 +02:00
Daniel Stenberg
f2ce6c46b9
openssl: enable builds for *both* engines and providers
OpenSSL3 can in fact have both enabled at once. Load the provider and
key/cert appropriately. When loading a provider, the user can now also
set an associated "property string".

Work on this was sponsored by Valantic.

Closes #17165
2025-04-29 10:44:21 +02:00
Daniel Stenberg
e0ebc3ff13
lib: provide a getaddrinfo wrapper
This uses c-ares under the hood and supports the CURL_DNS_SERVER
environment variable - for debug builds only. The getaddrinfo()
replacement function is only used if CURL_DNS_SERVER is set to make a
debug build work more like a release version without the variable set.

'override-dns' is a new feature for the test suite when curl can be told
to use a dedicated DNS server, and test 2102 is the first to require
this.

Requires c-ares 1.26.0 or later.

Closes #17134
2025-04-28 23:48:02 +02:00
Daniel Stenberg
da33c1e349
cfilters: remove assert
The OSS-fuzz probe reaches this, so it can apparently in run-time. There
is already a run-time handling of the situation.

Closes #17211
2025-04-28 22:45:41 +02:00
Jay Satiro
4a70b9823b progress: fix integer overflow check
- Fix logic typo.

Prior to this change the overflow check was reversed, meaning it did
not stop an overflow condition and also if there wasn't an overflow it
erroneously set the total expected transfer size to the maximum value.

Follow-up to 69ce9a7f from earlier today.

Closes https://github.com/curl/curl/pull/17213
2025-04-28 14:07:32 -04:00
Daniel Stenberg
69ce9a7feb
progress: avoid integer overflow when gathering total transfer size
Reported by OSS-fuzz

Closes #17207
2025-04-28 15:31:30 +02:00
Daniel Stenberg
771c15b603
smb: avoid integer overflow on weird input date
Found by OSS-fuzz

Closes #17206
2025-04-28 15:29:59 +02:00
Stefan Eissing
daa0601614
ws: store protocol context as connection meta data
Eliminates union member on struct connectdata. Sample of how
other procotols can handle their connection related data.

This avoids potention mix-ups of the `proto` union of a
connection with other protocol instances.

Removed ws "disconnect" callback as meta data is automatically
destroyed when a connection is destroyed.

Closes #17146
2025-04-28 09:15:05 +02:00
sftcd
460ead61b6
tests: add basic ECH tests
Test 4000 and 4001

Closes #17192
2025-04-27 17:38:27 +02:00
Daniel Stenberg
e9a35ded8a
curl_osslq: remove a leftover debug fprintf() call
Reported-by: xiadnoring on github
Fixes #17198
Closes #17202
2025-04-26 23:43:07 +02:00
Daniel Stenberg
991c30d0d6
ws: fix the header replace check
It passed in the wrong header length to the check function, which made
it do duplicated headers in cases where the user provides its own set.

Reported-by: sbernatsky on github
Fixes #17170
Closes #17194
Closes #16178
2025-04-26 23:21:04 +02:00
Viktor Szakats
f9eb9e5e23
cmake: use LIB_NAME in curl-config.cmake.in
Cherry-picked from #16973
Closes #17195
2025-04-26 12:59:53 +02:00
Daniel Stenberg
15839450be
urlapi: redirecting to "" is considered fine
If the CURLU handle already holds a proper URL, otherwise it is an
error.

Verified by test 1560

Fixes #17188
Reported-by: zopsicle on github
Closes #17189
2025-04-25 22:38:04 +02:00
Viktor Szakats
d7914f75aa
sectransp: fix building for macOS Sierra and older
Reported-by: Eric Knibbe
Bug: https://github.com/curl/curl/pull/16581#issuecomment-2830837500
Regression from 2d94439eaa #16581

Closes #17193
2025-04-25 21:06:22 +02:00
Andreas Westin
cc884c08a8
cf-socket: fix FTP accept connect
When cf_tcp_accept_connect() is called and it sets up a connection it
never indicates to the caller that the it's done.

Closes #17186
2025-04-25 17:39:27 +02:00
Daniel Stenberg
2ab6b9d405
aws-sigv4: allow a blank string
make sure a zero length sigv4 gets the default value

Reported-by: Arian van Putten
Fixes #17176
Closes #17178
2025-04-25 09:32:57 +02:00
Viktor Szakats
ae0ff69f7a
build: tidy up internal feature detection variables for wolfSSL
Sync them with the function name they detect, and sync them between
cmake and autotools.

- rename `HAVE_WOLFSSL_BIO` to `HAVE_WOLFSSL_BIO_NEW`.
- rename `HAVE_WOLFSSL_FULL_BIO` to `HAVE_WOLFSSL_BIO_SET_SHUTDOWN`.
- autotools: rename `WOLFSSL_NTLM` to `HAVE_WOLFSSL_DES_ECB_ENCRYPT`
  (to sync with cmake).
- autotools: rename `WOLFSSL_BIO` to `HAVE_WOLFSSL_BIO_NEW`
  (to sync with cmake).
- autotools: simplify `HAVE_WOLFSSL_DES_ECB_ENCRYPT` detection.

Cherry-picked from #17082

Closes #17175
2025-04-24 23:44:33 +02:00
Viktor Szakats
4bfc379b90
cmake: tidy up and document feature detections in dependencies
- update text on dependency feature detection variables, and move it
  to its own section in `docs/INSTALL-CMAKE.md`.
  Ref: #17032 (Discussion)

- tidy up descriptions/comments, alpha-sort.

- move comment to its own section in `docs/INSTALL-CMAKE.md`.

- split `HAVE_SSL_SET_QUIC_USE_LEGACY_CODEPOINT` to distinct names for
  each TLS backend API. To make the names more stable and to sync them
  with autotools.
  Follow-up to 07cc50f8eb #17018
  Follow-up to 342a654ef3 #15873

- drop redundant condition while detecting QUICTLS API.
  Follow-up to 07cc50f8eb #17018

- add config-comparison exception for `HAVE_SSL_SET_QUIC_TLS_CBS`.
  Follow-up to 5eefdd71a3 #17027

- detect `wolfSSL_get_peer_certificate` like autotools does.

- detect `wolfSSL_UseALPN` like autotools does.

Closes #17082
2025-04-24 19:46:27 +02:00
Stefan Eissing
7bf576064c
c-ares: really lazy init channel
Only initialize the c-ares channel when we start resolving and not
alreads when the application sets `CURLOPT_DNS_SERVERS` and friends.

Creating an ares channel takes considerable time and when we have the
DNS information for a transfer already cached, we do not need it.

Closes #17167
2025-04-24 14:07:01 +02:00
Daniel Stenberg
437c72fbba
mbedtls: TLS 1.3 is max when mbedtls has 1.3 support
Co-authored-by: Viktor Szakats
Reported-by: kkalganov on github
Fixes #17048
Closes #17137
2025-04-24 14:02:56 +02:00
Jochen Sprickerhof
82606325e3
openssl-quic: Add missing include
uint_hash, Curl_uint_hash_init and others are used in the file.

Regression from 657aae79c0

Closes #17156
2025-04-24 08:45:35 +02:00
Stefan Eissing
5e95556fc2
multi: init_do(): check result
Calls to `Curl_init_do()` did not check on result and missed failures to
properly and completely initialize a transfer request.

The main cause of such an init failure is the need to rewind the
READFUNCTION without a SEEKFUNCTION registered. Check the failure to
"rewind" the upload data immediately make test cases 1576 and friends
fail.

Reported-by: Travis Lane
Fixes #17139
Closes #17150
2025-04-24 08:43:03 +02:00
Daniel Stenberg
39f5e7cb69
asyn-base: remove the HTTPSRR_WORKS define
It is done in asyn-ares.c since 179aeeaf22

Closes #17161
2025-04-24 08:40:52 +02:00
Niall
179aeeaf22
ares: add definition for HTTPSRR_WORKS
Closes #17157
2025-04-23 23:39:41 +02:00
Daniel Stenberg
b993f2871b
doh: make sure CURLOPT_PROTOCOLS is set a with a "long" arg
Closes #17142
2025-04-23 08:52:49 +02:00
Viktor Szakats
d60c9aec42
openssl-quic: avoid potential -Wnull-dereference, add assert
Seen with curl-for-win, OpenSSL QUIC, gcc 14.2.0, cmake unity mode.

Silences:
```
In file included from _x86-win-ucrt-bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_5_c.c:55:
In function 'cf_osslq_check_and_unblock',
    inlined from 'cf_progress_egress' at lib/vquic/curl_osslq.c:1730:12:
lib/vquic/curl_osslq.c:1581:11: error: potential null pointer dereference [-Werror=null-dereference]
 1581 |           nghttp3_conn_unblock_stream(ctx->h3.conn, stream->s.id);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/vquic/curl_osslq.c:1582:34: error: potential null pointer dereference [-Werror=null-dereference]
 1582 |           stream->s.send_blocked = FALSE;
      |                                  ^
```

Co-authored-by: Daniel Stenberg
Co-authored-by: Stefan Eissing

Closes #17107
2025-04-22 16:50:12 +02:00
Stefan Eissing
657aae79c0
lib: add meta_hash to connection, eliminate hash_offt
With a meta_hash at each connection (similar to easy handle, let
multi_ev.c store its pollsets as meta data, no longer needing its own
hashes.

This eliminates the last use of Curl_hash_offt. Remove it.

Closes #17095
2025-04-22 15:57:18 +02:00