Commit Graph

29013 Commits

Author SHA1 Message Date
Viktor Szakats
76172511e7
windows: improve random source
- Use the Windows API to seed the fallback random generator.

  This ensures to always have a random seed, even when libcurl is built
  with a vtls backend lacking a random generator API, such as rustls
  (experimental), GSKit and certain mbedTLS builds, or, when libcurl is
  built without a TLS backend. We reuse the Windows-specific random
  function from the Schannel backend.

- Implement support for `BCryptGenRandom()` [1] on Windows, as a
  replacement for the deprecated `CryptGenRandom()` [2] function.

  It is used as the secure random generator for Schannel, and also to
  provide entropy for libcurl's fallback random generator. The new
  function is supported on Vista and newer via its `bcrypt.dll`. It is
  used automatically when building for supported versions. It also works
  in UWP apps (the old function did not).

- Clear entropy buffer before calling the Windows random generator.

  This avoids using arbitrary application memory as entropy (with
  `CryptGenRandom()`) and makes sure to return in a predictable state
  when an API call fails.

[1] https://docs.microsoft.com/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
[2] https://docs.microsoft.com/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom

Closes #9027
2022-07-04 09:38:24 +00:00
Daniel Stenberg
e6f8445ede
setopt: add CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR
... as replacements for deprecated CURLOPT_PROTOCOLS and
CURLOPT_REDIR_PROTOCOLS as these new ones do not risk running into the
32 bit limit the old ones are facing.

CURLINFO_PROTCOOL is now deprecated.

The curl tool is updated to use the new options.

Added test 1597 to verify the libcurl protocol parser.

Closes #8992
2022-07-04 08:35:09 +02:00
Daniel Stenberg
193215db3c
digest: simplify a switch() to a simple if 2022-07-04 08:27:21 +02:00
Daniel Stenberg
a44c9ba799
digest: provide a special bit for "sess" algos
Also shortened the names and moved them to the .c file since they are
private for this source file only. Also made them #defines instead of
enum.

Closes #9079
2022-07-04 08:27:15 +02:00
Thomas Weißschuh
52e822173a select: do not return fatal error on EINTR from poll()
The same was done for select() in 5912da25 but poll() was missed.

Bug: https://bugs.archlinux.org/task/75201
Reported-by: Alexandre Bury (gyscos at archlinux)

Ref: https://github.com/curl/curl/issues/8921
Ref: https://github.com/curl/curl/pull/8961
Ref: https://github.com/curl/curl/commit/5912da25#r77584294

Closes https://github.com/curl/curl/pull/9091
2022-07-04 00:58:07 -04:00
Kai Pastor
e584b1c044 cmake: fix build for mingw cross compile
- Change normaliz lib name to all lowercase.

This is from a standing patch in vcpkg:
Mingw has libnormaliz.a. For case-sensitive file systems (e.g. cross
builds from Linux), the spelling must match exactly.

Closes https://github.com/curl/curl/pull/9084
2022-07-03 00:04:57 -04:00
Jay Satiro
bbffb8c285 easy_lock: fix build for mingw
- Define SRWLOCK symbols missing in some mingw environments.

Closes https://github.com/curl/curl/pull/8997
2022-07-02 23:52:07 -04:00
Daniel Stenberg
0defae2fe5
tool_progress: avoid division by zero in parallel progress meter
Reported-by: Brian Carpenter
Fixes #9082
Closes #9083
2022-07-02 00:45:58 +02:00
Daniel Stenberg
4d4c2274d0
http_aws_sigv4.c: remove two unusued includes
Closes #9080
2022-07-01 23:33:42 +02:00
Daniel Stenberg
a8e02881ec
.mailmap: additional edit
Follow-up to 861e2a8aca so that Evgeny appears with the same in git
logs even when using old email.
2022-07-01 09:57:04 +02:00
Daniel Stenberg
804fb71bed
RELEASE-NOTES: synced
bumped to 7.84.1
2022-07-01 09:53:08 +02:00
Evgeny Grin (Karlson2k)
861e2a8aca
.mailmap: updated 2022-07-01 09:49:14 +02:00
Evgeny Grin (Karlson2k)
5a11aa790f
THANKS: merged two entries for Evgeny Grin
Also updated THANKS-filter file

Closes #9076
2022-07-01 09:49:14 +02:00
Jilayne Lovejoy
28971bd453
lib/curl_path.c: add ISC to license expression
THe text of the ISC license is in this file, so the SPDX license
expression should be updated

Closes #9073
2022-07-01 09:40:31 +02:00
Sean McArthur
be8d2b037d
hyper: use wakers for curl pause/resume
Closes #9070
2022-06-30 10:19:08 +02:00
Viktor Szakats
c7f53b7493
Makefile.m32: do not set the libcurl.rc debug flag [ci skip]
Delete `-DDEBUGBUILD=0` windres option. This was likely meant to
disable VS_FF_DEBUG in FILEFLAGS, but any assigned value enabled
it instead. Delete this unnecessary option and thus sync up with
how CMake compiles libcurl.rc by default.

Reviewed-by: Jay Satiro
Closes #9069
2022-06-30 08:14:29 +00:00
Daniel Stenberg
1dda49a1d3
curl.h: CURLE_CONV_FAILED is obsoleted
The last use was removed in 7.82.0. Updated some docs too to reflect the
current error code situation.

Closes #9067
2022-06-29 16:03:02 +02:00
Daniel Stenberg
f57f96dedc
curl: output warning when a cookie is dropped due to size
Dropped from the request, that is.

Closes #9064
2022-06-29 08:48:03 +02:00
Daniel Stenberg
8ab4499552
curl_mime_data.3: polish the wording
Closes #9063
2022-06-28 17:00:00 +02:00
Daniel Stenberg
a68074b5db
configure: check for the stdatomic.h header in configure
... and only set HAVE_ATOMIC if that header exists since we use
typedefes set in it.

Reported-by: Ryan Schmidt
Fixes #9059
Closes #9060
2022-06-28 16:58:12 +02:00
Daniel Stenberg
33fd57b8ff
easy_lock: fix the #ifdef conditional for ia32_pause
To work better with new and old clang compilers.

Reported-by: Ryan Schmidt
Assisted-by: Joshua Root

Fixes #9058
Closes #9062
2022-06-28 16:56:50 +02:00
Daniel Stenberg
50efb0822a
easy_lock: switch to using atomic_int instead of bool
To work with more compilers without requiring separate libs to
link. Like with gcc-12 for RISC-V on Linux.

Reported-by: Adam Sampson
Fixes #9055
Closes #9061
2022-06-28 12:45:47 +02:00
vvb2060
e631f6e10e
ngtcp2: fix incompatible function pointer types
Closes #9056
2022-06-28 00:02:36 +02:00
vvb2060
5a1a892565
easy_lock.h: use __asm__ instead of asm to fix build
Closes #9056
2022-06-28 00:02:26 +02:00
Samuel Henrique
aa34135e8f
libcurl-security.3: fix typo on macro "SH_"
During the packaging of the latest curl release for Debian, Lintian
warned me about a typo which causes the section name "Secrets in memory"
to not be rendered in the manpage due to "SH_" not being recognized as a
header.

Closes #9057
2022-06-27 23:59:18 +02:00
Daniel Stenberg
e2e7f54b7b
easy_lock.h: include sched.h if available to fix build
Patched-by: Harry Sintonen

Closes #9054
2022-06-27 10:59:52 +02:00
Daniel Stenberg
45ac4d0194
RELEASE-NOTES: synced
Version 7.84.0 release
2022-06-27 08:07:28 +02:00
Daniel Stenberg
4924875726
THANKS: contributors from 7.84.0 release notes 2022-06-27 08:07:28 +02:00
Daniel Stenberg
d64115d7bb
hsts: use Curl_fopen() 2022-06-26 11:04:02 +02:00
Daniel Stenberg
fab970a5d1
altsvc: use Curl_fopen() 2022-06-26 11:04:02 +02:00
Daniel Stenberg
20f9dd6bae
fopen: add Curl_fopen() for better overwriting of files
Bug: https://curl.se/docs/CVE-2022-32207.html
CVE-2022-32207
Reported-by: Harry Sintonen
Closes #9050
2022-06-26 11:03:57 +02:00
Daniel Stenberg
46f8911d39
test444: test many received Set-Cookie:
The amount of sent cookies in the test is limited to 80 because hyper
has its own strict limits in how many headers it allows to be received
which triggers at some point beyond this number.
2022-06-26 11:01:56 +02:00
Daniel Stenberg
ff2b2bcf68
test442/443: test cookie caps
442 - verify that only 150 cookies are sent
443 - verify that the cookie: header remains less than 8K in size
2022-06-26 11:01:01 +02:00
Daniel Stenberg
48d7064a49
cookie: apply limits
- Send no more than 150 cookies per request
- Cap the max length used for a cookie: header to 8K
- Cap the max number of received Set-Cookie: headers to 50

Bug: https://curl.se/docs/CVE-2022-32205.html
CVE-2022-32205
Reported-by: Harry Sintonen
Closes #9048
2022-06-26 11:00:48 +02:00
Daniel Stenberg
7230b19a2e
test387: verify rejection of compression chain attack 2022-06-25 22:14:32 +02:00
Daniel Stenberg
3a09fbb7f2
content_encoding: return error on too many compression steps
The max allowed steps is arbitrarily set to 5.

Bug: https://curl.se/docs/CVE-2022-32206.html
CVE-2022-32206
Reported-by: Harry Sintonen
Closes #9049
2022-06-25 22:14:21 +02:00
Daniel Stenberg
6ecdf5136b
krb5: return error properly on decode errors
Bug: https://curl.se/docs/CVE-2022-32208.html
CVE-2022-32208
Reported-by: Harry Sintonen
Closes #9051
2022-06-25 22:13:09 +02:00
Daniel Stenberg
2b67a0a112
easy_lock.h: remove use of the deprecated ATOMIC_VAR_INIT macro
clang 14 warns about its use. It is being deprecated by the working
group for the programming language C: "The macro ATOMIC_VAR_INIT is
basically useless for the purpose for which it was designed"

Ref: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2886.htm

Reported-by: Tatsuhiro Tsujikawa
Fixes #9041
Closes #9042
2022-06-23 16:17:09 +02:00
Stefan Eissing
8135d420ee
ngtcp2: avoid supplying 0 length msg_control to sendmsg()
Testing on macOS 12.4, sendmsg() fails with EINVAL when a msg_control
buffer is provided in sengmsg(), even though msg_controllen was set to
0.

Initialize msg.msg_controllen just as needed and also perform the size
assertion only when needed.

Closes #9039
2022-06-23 16:11:32 +02:00
Tom Eccles
71bbabb167
ftp: restore protocol state after http proxy CONNECT
connect_init() (lib/http_proxy.c) swaps out the protocol state while
working on the proxy connection, this is then restored by
Curl_connect_done() after the connection completes.

ftp_do_more() extracted the protocol state pointer to a local variable
at the start of the function then calls Curl_proxy_connect(). If the proxy
connection completes, Curl_proxy_connect() will call Curl_connect_done()
(via Curl_proxyCONNECT()), which restores data->req.p to point to the ftp
protocol state instead of the http proxy protocol state, but the local
variable in ftp_do_more still pointed to the old value.

Ultimately this meant that the state worked on by ftp_do_more() was the
http proxy state not the ftp state initialised by ftp_connect(), but
subsequent calls to any ftp_ function would use the original state.

For my use-case, the visible consequence was that ftp->downloadsize was
never set and so downloaded data was never returned to the application.

This commit updates the ftp protocol state pointer in ftp_do_more() after
Curl_proxy_connect() returns, ensuring that the correct state pointer is
used.

Fixes #8737
Closes #9043
2022-06-23 16:07:20 +02:00
Jay Satiro
f3a7781594 THANKS: add contributor missing from aea8ac1
aea8ac1 fixed #8980 which was reported by Sgharat on github, but that
info was not included in the commit message.
2022-06-23 04:06:23 -04:00
Jay Satiro
3733717509 curl_setup: include _mingw.h
Prior to this change _mingw.h needed to be included in each unit before
evaluating __MINGW{32,64}_xxx_VERSION macros since it defines them. It
is included only in some mingw headers (eg stdio.h) and not others
(eg windows.h) so it's better to explicitly include it once.

Closes https://github.com/curl/curl/pull/9036
2022-06-23 03:34:51 -04:00
Viktor Szakats
70adb81c6f
rand: stop detecting /dev/urandom in cross-builds
- Prevent CMake to auto-detect /dev/urandom when cross-building.
  Before this patch, it would detect it in a cross-build scenario on *nix
  hosts with this device present. This was a problem for example with
  Windows builds, but it could affect any target system with this device
  missing. This also syncs detection behaviour with autotools, which also
  skips it for cross-builds.
- Also, make sure to never use the file RANDOM_FILE as entropy for libcurl's
  fallback random number generator on Windows. Windows does not have the
  concept of reading a random stream from a filename, nor any guaranteed
  non-world-writable path on disk. With this, a manual misconfiguration or
  an overeager auto-detection can no longer result in a user-controllable
  seed source.

Reviewed-by: Daniel Stenberg
Closes #9038
2022-06-22 09:35:46 +00:00
Emanuele Torre
79f915e8ec
ci: avoid cmake -Hpath
This is an undocumented option similar to the `-Spath' option introduced
in cmake 3.13.
Replace all instances of `-Hpath' with `-Spath' in macos workflow.
Replace `-H. -Bpath' with `mkdir path; cd ./path; cmake ..' in zuul
scripts since it runs an older version of cmake.

Fixes #9008
Closes #9014
2022-06-22 10:43:07 +02:00
Daniel Stenberg
8b83fbfe82
INTERNALS: bring back the "Library symbols" section
Most contents was moved, but this text should remain here.

Follow-up to: d324ac8
Reported-by: Viktor Szakats
Bug: https://github.com/curl/curl/pull/9027#discussion_r903382326
Closes #9037
2022-06-22 10:38:03 +02:00
Viktor Szakats
6c501cb624
Makefile.m32: stop forcing XP target with ipv6 enabled [ci skip]
Since this [1] commit in 2011, `_WIN32_WINNT` was set fixed to Windows
XP when the `-ipv6` option is selected. Maybe this was added to support
pre-XP Windows versions (?). These days libcurl builds fine for both XP
and post-XP versions with IPv6 support enabled. The relevance of pre-XP
version is also low by now. Other build methods also do not impose such
limitation for a similar configuration. So, drop this hard-wired
`_WIN32_WINNT` limit from `Makefile.m32`, thus building for the default
Windows version set by the compiler. This is Vista for recent MinGW
versions.

Old behaviour can be restored by setting this envvar:
export CURL_CFLAG_EXTRAS=-D_WIN32_WINNT=0x0501

[1] 98a61d8e2e

Closes #9035
2022-06-22 00:06:48 +00:00
Daniel Stenberg
c717975eaa
CONTRIBUTE: mention how we maintain REUSE compliance
for copyright and license information of all files stored in git

Closes #9032
2022-06-21 23:48:57 +02:00
Daniel Stenberg
d56dbf0a16
CURLOPT_ALTSVC.3: document the file format
Closes #9033
2022-06-21 23:48:00 +02:00
Jay Satiro
51e0b8fc60 runtests: add "threadsafe" to detected features
Follow-up to recent commits which added thread-safety support.

Bug: https://github.com/curl/curl/pull/9012#discussion_r902018782
Reported-by: Marc Hörsken

Closes https://github.com/curl/curl/pull/9030
2022-06-21 03:17:56 -04:00
Daniel Stenberg
d5dc3629eb
easy: remove dead code
Follow-up from 5912da253b

Detected by Coverity (CID 1506519)

Closes #9029
2022-06-20 10:44:28 +02:00