]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
4 years agohttp: introduce AWS HTTP v4 Signature
Matthias Gatto [Thu, 9 Jul 2020 11:58:37 +0000 (13:58 +0200)] 
http: introduce AWS HTTP v4 Signature

It is a security process for HTTP.

It doesn't seems to be standard, but it is used by some cloud providers.

Aws:
https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
Outscale:
https://wiki.outscale.net/display/EN/Creating+a+Canonical+Request
GCP (I didn't test that this code work with GCP though):
https://cloud.google.com/storage/docs/access-control/signing-urls-manually

most of the code is in lib/http_v4_signature.c

Information require by the algorithm:
- The URL
- Current time
-  some prefix that are append to some of the signature parameters.

The data extracted from the URL are: the URI, the region,
the host and the API type

example:
https://api.eu-west-2.outscale.com/api/latest/ReadNets
        ~~~ ~~~~~~~~               ~~~~~~~~~~~~~~~~~~~
        ^       ^                          ^
       /         \                        URI
   API type     region

Small description of the algorithm:
- make canonical header using content type, the host, and the date
- hash the post data
- make canonical_request using custom request, the URI,
  the get data, the canonical header, the signed header
  and post data hash
- hash canonical_request
- make str_to_sign using one of the prefix pass in parameter,
  the date, the credential scope and the canonical_request hash
- compute hmac from date, using secret key as key.
- compute hmac from region, using above hmac as key
- compute hmac from api_type, using above hmac as key
- compute hmac from request_type, using above hmac as key
- compute hmac from str_to_sign using above hmac as key
- create Authorization header using above hmac, prefix pass in parameter,
  the date, and above hash

Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
Closes #5703

4 years agohttp: add hmac support for sha256
Matthias Gatto [Fri, 3 Jul 2020 13:12:57 +0000 (15:12 +0200)] 
http: add hmac support for sha256

It seems current hmac implementation use md5 for the hash,
V4 signature require sha256, so I've added the needed struct in
this commit.

I've added the functions that do the hmac in v4 signature file
as a static function ,in the next patch of the serie,
because it's used only by this file.

Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
4 years agoconnect: on linux, enable reporting of all ICMP errors on UDP sockets
Cristian Rodríguez [Thu, 17 Dec 2020 14:27:03 +0000 (11:27 -0300)] 
connect: on linux, enable reporting of all ICMP errors on UDP sockets

The linux kernel does not report all ICMP errors back to userspace due
to historical reasons.

IP*_RECVERR sockopt must be turned on to have the correct behaviour
which is to pass all ICMP errors to userspace.

See https://bugzilla.kernel.org/show_bug.cgi?id=202355

Closes #6341

4 years agocurl: add --create-file-mode [mode]
Daniel Stenberg [Sun, 20 Dec 2020 17:44:20 +0000 (18:44 +0100)] 
curl: add --create-file-mode [mode]

This option sets the (octal) mode to use for the remote file when one is
created, using the SFTP, SCP or FILE protocols. When not set, the
default is 0644.

Closes #6244

4 years agoc-hyper: fix compiler warnings
Daniel Stenberg [Sun, 20 Dec 2020 17:33:54 +0000 (18:33 +0100)] 
c-hyper: fix compiler warnings

Identified by clang on windows.

Reported-by: Gisle Vanem
Bug: 58974d25d8173aec154e593ed9d866da566c9811

Closes #6351

4 years agoKNOWN_BUGS: Remote recursive folder creation with SFTP
Daniel Stenberg [Sun, 20 Dec 2020 21:49:36 +0000 (22:49 +0100)] 
KNOWN_BUGS: Remote recursive folder creation with SFTP

Closes #5204

4 years agobadsymbols.pl: Add verbose mode -v
Jay Satiro [Sun, 20 Dec 2020 07:48:07 +0000 (02:48 -0500)] 
badsymbols.pl: Add verbose mode -v

Use -v as the first option to enable verbose mode which will show source
input, extracted symbol and line info. For example:

Source: ./../include/curl/typecheck-gcc.h
Symbol: curlcheck_socket_info(info)
Line #423: #define curlcheck_socket_info(info)                     \

Ref: https://curl.se/mail/lib-2020-12/0084.html

Closes https://github.com/curl/curl/pull/6349

4 years agoKNOWN_BUGS: Secure Transport disabling hostname validation also disables SNI
Jay Satiro [Sat, 19 Dec 2020 22:40:03 +0000 (17:40 -0500)] 
KNOWN_BUGS: Secure Transport disabling hostname validation also disables SNI

That behavior is a limitation of Apple's Secure Transport.

Reported-by: Cory Benfield
Reported-by: Ian Spence
Confirmed-by: Nick Zitzmann
Ref: https://github.com/curl/curl/issues/998

Closes https://github.com/curl/curl/issues/6347
Closes https://github.com/curl/curl/pull/6348

4 years agoTODO: alt-svc should fallback if alt-svc doesn't work
Daniel Stenberg [Fri, 18 Dec 2020 22:39:22 +0000 (23:39 +0100)] 
TODO: alt-svc should fallback if alt-svc doesn't work

Closes #4908

4 years agotravis: restrict the openssl3 job to only run https and ftps tests
Daniel Stenberg [Fri, 18 Dec 2020 14:59:56 +0000 (15:59 +0100)] 
travis: restrict the openssl3 job to only run https and ftps tests

... as it runs too long otherwise and the other tests are verified in
other builds anyway.

Closes #6345

4 years agobuild: repair http disabled but mqtt enabled build
Daniel Stenberg [Fri, 18 Dec 2020 12:18:14 +0000 (13:18 +0100)] 
build: repair http disabled but mqtt enabled build

... as the mqtt code reuses the "method" originally used for HTTP.

Closes #6344

4 years agocookie: avoid the C1001 internal compiler error with MSVC 14
Jon Wilkes [Tue, 27 Oct 2020 19:47:57 +0000 (12:47 -0700)] 
cookie: avoid the C1001 internal compiler error with MSVC 14

Fixes #6112
Closes #6135

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 18 Dec 2020 12:02:40 +0000 (13:02 +0100)] 
RELEASE-NOTES: synced

4 years agomqtt: handle POST/PUBLISH without a set POSTFIELDSIZE
Daniel Stenberg [Thu, 17 Dec 2020 12:34:38 +0000 (13:34 +0100)] 
mqtt: handle POST/PUBLISH without a set POSTFIELDSIZE

Detected by OSS-Fuzz
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28735

Added test 1916 and 1917 to verify.

Closes #6338

4 years agotravis: add CI job for Hyper build
Daniel Stenberg [Mon, 14 Dec 2020 13:10:33 +0000 (14:10 +0100)] 
travis: add CI job for Hyper build

4 years agotests: updated tests for Hyper
Daniel Stenberg [Mon, 14 Dec 2020 13:10:33 +0000 (14:10 +0100)] 
tests: updated tests for Hyper

4 years agolib: introduce c-hyper for using Hyper
Daniel Stenberg [Mon, 14 Dec 2020 13:10:33 +0000 (14:10 +0100)] 
lib: introduce c-hyper for using Hyper

... as an alternative HTTP backend within libcurl.

4 years agotool_setopt: provide helper output in debug builds
Daniel Stenberg [Mon, 14 Dec 2020 13:10:33 +0000 (14:10 +0100)] 
tool_setopt: provide helper output in debug builds

... for when setopt() returns error.

4 years agosetopt: adjust to Hyper and disabled HTTP builds
Daniel Stenberg [Mon, 14 Dec 2020 13:10:33 +0000 (14:10 +0100)] 
setopt: adjust to Hyper and disabled HTTP builds

4 years agortsp: disable if Hyper is used
Daniel Stenberg [Mon, 14 Dec 2020 13:10:33 +0000 (14:10 +0100)] 
rtsp: disable if Hyper is used

4 years agogetinfo: build with disabled HTTP support
Daniel Stenberg [Mon, 14 Dec 2020 13:10:33 +0000 (14:10 +0100)] 
getinfo: build with disabled HTTP support

4 years agoversion: include hyper version
Daniel Stenberg [Mon, 14 Dec 2020 13:10:33 +0000 (14:10 +0100)] 
version: include hyper version

4 years agodocs: add HYPER.md
Daniel Stenberg [Mon, 14 Dec 2020 13:10:32 +0000 (14:10 +0100)] 
docs: add HYPER.md

4 years agoconfigure: add --with-hyper
Daniel Stenberg [Mon, 14 Dec 2020 13:10:32 +0000 (14:10 +0100)] 
configure: add --with-hyper

As the first (optional) HTTP backend alternative instead of native

Close #6110

4 years agotest1522: add debug tracing
Daniel Stenberg [Wed, 16 Dec 2020 09:39:41 +0000 (10:39 +0100)] 
test1522: add debug tracing

I used this to track down some issues and I figured I could just as well
keep this extra logging in here for future needs.

Closes #6331

4 years agohttp: show the request as headers even when split-sending
Daniel Stenberg [Tue, 15 Dec 2020 15:53:04 +0000 (16:53 +0100)] 
http: show the request as headers even when split-sending

When the initial request isn't possible to send in its entirety, the
remainder of request would be delivered to the debug callback as data
and would wrongly be counted internally as body-bytes sent.

Extended test 1295 to verify.

Closes #6328

4 years agomulti: when erroring in TOOFAST state, act as for PERFORM
Daniel Stenberg [Thu, 17 Dec 2020 10:17:55 +0000 (11:17 +0100)] 
multi: when erroring in TOOFAST state, act as for PERFORM

When failing in TOOFAST, the multi_done() wasn't called so the same
cleanup and handling wasn't done like when it fails in PERFORM, which in
the case of FTP could mean that the control connection wouldn't be
marked as "dead" for the CURLE_ABORTED_BY_CALLBACK case. Which caused
ftp_disconnect() to use it to send "QUIT", which could end up waiting
for a response a long time before giving up!

Reported-by: Tomas Berger
Fixes #6333
Closes #6337

4 years agocmake: enable gophers correctly in curl-config
Daniel Stenberg [Thu, 17 Dec 2020 09:38:27 +0000 (10:38 +0100)] 
cmake: enable gophers correctly in curl-config

Closes #6336

4 years agotest1198/9: add two mqtt publish tests without payload lengths
Daniel Stenberg [Thu, 17 Dec 2020 09:14:14 +0000 (10:14 +0100)] 
test1198/9: add two mqtt publish tests without payload lengths

Closes #6335

4 years agotests/mqttd: extract the client id from the correct offset 6334/head
Daniel Stenberg [Thu, 17 Dec 2020 09:15:31 +0000 (10:15 +0100)] 
tests/mqttd: extract the client id from the correct offset

Closes #6334

4 years agoTODO: Prevent terminal injection when writing to terminal
Daniel Stenberg [Wed, 16 Dec 2020 22:38:20 +0000 (23:38 +0100)] 
TODO: Prevent terminal injection when writing to terminal

Closes #6150

4 years agoRevert "CI/github: work-around for brew breakage on macOS"
Daniel Stenberg [Wed, 16 Dec 2020 09:44:29 +0000 (10:44 +0100)] 
Revert "CI/github: work-around for brew breakage on macOS"

This reverts commit 4cbb17a2cbbbe6337142d39479e21c3990b9c22f.

... as the work-around now causes failures.

Closes #6332

4 years agoexamples: remove superfluous asterisk uses
Daniel Stenberg [Wed, 16 Dec 2020 08:24:16 +0000 (09:24 +0100)] 
examples: remove superfluous asterisk uses

... for function pointers. Breaks in ancient compilers.

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 16 Dec 2020 07:21:48 +0000 (08:21 +0100)] 
RELEASE-NOTES: synced

4 years agotest1272: fix line ending
Daniel Stenberg [Tue, 15 Dec 2020 16:38:17 +0000 (17:38 +0100)] 
test1272: fix line ending

Follow-up to f24784f9143

4 years agoURL-SYNTAX: add gophers details
Daniel Stenberg [Tue, 15 Dec 2020 11:56:36 +0000 (12:56 +0100)] 
URL-SYNTAX: add gophers details

4 years agotest1272: test gophers
Daniel Stenberg [Mon, 16 Nov 2020 16:55:44 +0000 (17:55 +0100)] 
test1272: test gophers

4 years agoruntests: add support for gophers, gopher over TLS
Daniel Stenberg [Mon, 16 Nov 2020 16:54:07 +0000 (17:54 +0100)] 
runtests: add support for gophers, gopher over TLS

4 years agogopher: Implement secure gopher protocol.
parazyd [Sun, 15 Nov 2020 17:46:06 +0000 (18:46 +0100)] 
gopher: Implement secure gopher protocol.

This commit introduces a "gophers" handler inside the gopher protocol if
USE_SSL is defined. This protocol is no different than the usual gopher
prococol, with the added TLS encapsulation upon connecting. The protocol
has been adopted in the gopher community, and many people have enabled
TLS in their gopher daemons like geomyidae(8), and clients, like clic(1)
and hurl(1).

I have not implemented test units for this protocol because my knowledge
of Perl is sub-par. However, for someone more knowledgeable it might be
fairly trivial, because the same test that tests the plain gopher
protocol can be used for "gophers" just by adding a TLS listener.

Signed-off-by: parazyd <parazyd@dyne.org>
Closes #6208

4 years agoTODO: Package curl for Windows in a signed installer
Daniel Stenberg [Tue, 15 Dec 2020 11:02:14 +0000 (12:02 +0100)] 
TODO: Package curl for Windows in a signed installer

Closes #5424

4 years agomqtt: deal with 0 byte reads correctly
Daniel Stenberg [Tue, 15 Dec 2020 07:51:33 +0000 (08:51 +0100)] 
mqtt: deal with 0 byte reads correctly

OSS-Fuzz found it
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28676

Closes #6327

4 years agoBUG-BOUNTY: minor language update
Daniel Stenberg [Mon, 14 Dec 2020 09:08:05 +0000 (10:08 +0100)] 
BUG-BOUNTY: minor language update

... and remove the wording about entries from before 2019 as the "within
12 months" is still there and covers that.

Closes #6318

4 years agotooĺ_writeout: fix the -w time output units
Daniel Stenberg [Tue, 15 Dec 2020 07:09:29 +0000 (08:09 +0100)] 
tooĺ_writeout: fix the -w time output units

Fix regression from commit fc813f80e1bcac (#6248) that changed the unit
to microseconds instead of seconds with fractions

Reported-by: 不确定
Fixes #6321
Closes #6322

4 years agoquiche: remove fprintf() leftover
Daniel Stenberg [Mon, 14 Dec 2020 10:19:48 +0000 (11:19 +0100)] 
quiche: remove fprintf() leftover

4 years agoKNOWN_BUGS: SHA-256 digest not supported in Windows SSPI builds
Jay Satiro [Mon, 14 Dec 2020 06:08:15 +0000 (01:08 -0500)] 
KNOWN_BUGS: SHA-256 digest not supported in Windows SSPI builds

Closes https://github.com/curl/curl/issues/6302

4 years agodigest_sspi: Show InitializeSecurityContext errors in verbose mode
Jay Satiro [Sun, 13 Dec 2020 08:30:23 +0000 (03:30 -0500)] 
digest_sspi: Show InitializeSecurityContext errors in verbose mode

The error is shown with infof rather than failf so that the user will
see the extended error message information only in verbose mode, and
will still see the standard CURLE_AUTH_ERROR message. For example:

---

* schannel: InitializeSecurityContext failed: SEC_E_QOP_NOT_SUPPORTED
(0x8009030A) - The per-message Quality of Protection is not supported by
the security package
* multi_done
* Connection #1 to host 127.0.0.1 left intact
curl: (94) An authentication function returned an error

---

Ref: https://github.com/curl/curl/issues/6302

Closes https://github.com/curl/curl/pull/6315

4 years agoURL-SYNTAX: add default port numbers and IDNA details
Daniel Stenberg [Sun, 13 Dec 2020 11:31:14 +0000 (12:31 +0100)] 
URL-SYNTAX: add default port numbers and IDNA details

Closes #6316

4 years agoURL-SYNTAX: mention how FILE:// access can access network on windows
Daniel Stenberg [Sat, 12 Dec 2020 21:23:19 +0000 (22:23 +0100)] 
URL-SYNTAX: mention how FILE:// access can access network on windows

Closes #6314

4 years agoURL-SYNTAX: Document default SMTP port 25
Jay Satiro [Sat, 12 Dec 2020 00:12:18 +0000 (19:12 -0500)] 
URL-SYNTAX: Document default SMTP port 25

Note that ports 25 and 587 are common ports for smtp, the former being
the default.

Closes https://github.com/curl/curl/pull/6310

4 years agoCURLOPT_URL.3: remove scheme specific details
Daniel Stenberg [Fri, 11 Dec 2020 23:03:25 +0000 (00:03 +0100)] 
CURLOPT_URL.3: remove scheme specific details

... that are now found in URL-SYNTAX.md

Closes #6307

4 years agodocs: Fix some typos
Dan Fandrich [Sat, 12 Dec 2020 17:59:10 +0000 (09:59 -0800)] 
docs: Fix some typos

[skip ci]

4 years agoURL-SYNTAX: mention all supported schemes
Daniel Stenberg [Sat, 12 Dec 2020 10:44:49 +0000 (11:44 +0100)] 
URL-SYNTAX: mention all supported schemes

Closes #6311

4 years agoURL-SYNTAX.md: minor language improvements
Douglas R. Reno [Fri, 11 Dec 2020 23:23:50 +0000 (17:23 -0600)] 
URL-SYNTAX.md: minor language improvements

Closes #6308

4 years agodocs/URL-SYNTAX: the URL syntax curl accepts and works with
Daniel Stenberg [Mon, 7 Dec 2020 12:58:55 +0000 (13:58 +0100)] 
docs/URL-SYNTAX: the URL syntax curl accepts and works with

Closes #6285

4 years agodocs: enable syntax highlighting in several docs files
0xflotus [Mon, 7 Dec 2020 17:09:37 +0000 (18:09 +0100)] 
docs: enable syntax highlighting in several docs files

... for better readability

Closes #6286

4 years agotest1564/1565: require the 'wakeup' feature to run
Daniel Stenberg [Fri, 11 Dec 2020 08:07:00 +0000 (09:07 +0100)] 
test1564/1565: require the 'wakeup' feature to run

Fixes #6299
Fixes #6300
Closes #6301

4 years agoruntests: add 'wakeup' as a feature
Daniel Stenberg [Fri, 11 Dec 2020 08:06:36 +0000 (09:06 +0100)] 
runtests: add 'wakeup' as a feature

4 years agotests/server/disabled: add "wakeup"
Daniel Stenberg [Fri, 11 Dec 2020 08:05:47 +0000 (09:05 +0100)] 
tests/server/disabled: add "wakeup"

To allow the test suite to know if wakeup support is disabled in the
build.

4 years agolib1564/5: verify that curl_multi_wakeup returns OK
Daniel Stenberg [Thu, 10 Dec 2020 23:35:15 +0000 (00:35 +0100)] 
lib1564/5: verify that curl_multi_wakeup returns OK

4 years agotests: make --libcurl tests only test FTP options if ftp enabled
Daniel Stenberg [Fri, 11 Dec 2020 12:55:00 +0000 (13:55 +0100)] 
tests: make --libcurl tests only test FTP options if ftp enabled

Adjust six --libcurl tests to only check the FTP option if FTP is
actually present in the build.

Fixes #6303
Closes #6305

4 years agoruntests.pl: fix "uninitialized value" warning
Daniel Stenberg [Fri, 11 Dec 2020 12:52:59 +0000 (13:52 +0100)] 
runtests.pl: fix "uninitialized value" warning

follow-up to e12825c642a88774

4 years agoruntests: add support for %if [feature] conditions
Daniel Stenberg [Fri, 11 Dec 2020 09:26:06 +0000 (10:26 +0100)] 
runtests: add support for %if [feature] conditions

... to make tests run differently or expect different results depending
on what features that are present or not in curl.

Bonus: initial minor 'Hyper' awareness but nothing is using that yet

Closes #6304

4 years agoOS400: update ccsidcurl.c
Jon Rumsey [Thu, 10 Dec 2020 09:56:36 +0000 (09:56 +0000)] 
OS400: update ccsidcurl.c

Add 'struct' to cast and declaration of cfcdata to fix compilation
error.

Fixes #6292
Closes #6297

4 years agongtcp2: make it build it current master again
Daniel Stenberg [Wed, 9 Dec 2020 22:31:23 +0000 (23:31 +0100)] 
ngtcp2: make it build it current master again

Closes #6296

4 years agoconnect: defer port selection until connect() time
Cristian Rodríguez [Wed, 9 Dec 2020 19:30:29 +0000 (16:30 -0300)] 
connect: defer port selection until connect() time

If supported, defer port selection until connect() time
if --interface is given and source port is 0.

Reproducer:

* start fast webserver on port 80
* starve system of ephemeral ports
$  sysctl net.ipv4.ip_local_port_range="60990 60999"

* start a curl/libcurl "crawler"
$curl --keepalive --parallel --parallel-immediate --head --interface
127.0.0.2 "http://127.0.0.[1-254]/file[001-002].txt"

current result:
(possible some successful data)
curl: (45) bind failed with errno 98: Address already in use

result after patch:
(complete success or few connections failing, higlhy depending on load)

Fail only when all the possible 4-tuple combinations are exhausted,
which is impossible to do when port is selected at bind() time becuse
the kernel does not know if socket will be listen()'ed on or connect'ed
yet.

Closes #6295

4 years agoconnect: zero variable on stack to silence valgrind complaint
Hans-Christian Noren Egtvedt [Wed, 9 Dec 2020 09:42:59 +0000 (10:42 +0100)] 
connect: zero variable on stack to silence valgrind complaint

Valgrind will complain that ssrem buffer usage if not explicit
initialized, hence initialize it to zero.

This completes the change intially started in commit 2c0d7212151 ('ftp:
retry getpeername for FTP with TCP_FASTOPEN') where the ssloc buffer has
a similar memset to zero.

Signed-off-by: Hans-Christian Noren Egtvedt <hegtvedt@cisco.com>
Closes #6289

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 9 Dec 2020 21:57:47 +0000 (22:57 +0100)] 
RELEASE-NOTES: synced

start over on the next release cycle

4 years agoRELEASE-NOTES: synced curl-7_74_0
Daniel Stenberg [Wed, 9 Dec 2020 06:38:24 +0000 (07:38 +0100)] 
RELEASE-NOTES: synced

for 7.74.0

4 years agourldata: restore comment on ssl_connect_data.use
Jacob Hoffman-Andrews [Mon, 7 Dec 2020 23:04:42 +0000 (15:04 -0800)] 
urldata: restore comment on ssl_connect_data.use

This comment was originally on the `use` field, but was separated from
its field in 62a2534.

Closes https://github.com/curl/curl/pull/6287

4 years agoVERSIONS: refreshed
Daniel Stenberg [Mon, 7 Dec 2020 12:23:04 +0000 (13:23 +0100)] 
VERSIONS: refreshed

We always use the patch number these days: all releases are
"major.minor.patch"

4 years agocmake: don't use reserved target name 'test'
Jakub Zakrzewski [Fri, 27 Nov 2020 20:06:03 +0000 (21:06 +0100)] 
cmake: don't use reserved target name 'test'

CMake up to 3.10 always reserves this name

Fixes #6257
Closes #6258

4 years agoopenssl: make the OCSP verification verify the certificate id
Daniel Stenberg [Wed, 2 Dec 2020 22:01:11 +0000 (23:01 +0100)] 
openssl: make the OCSP verification verify the certificate id

CVE-2020-8286

Reported by anonymous

Bug: https://curl.se/docs/CVE-2020-8286.html

4 years agoftp: make wc_statemach loop instead of recurse
Daniel Stenberg [Fri, 27 Nov 2020 23:27:21 +0000 (00:27 +0100)] 
ftp: make wc_statemach loop instead of recurse

CVE-2020-8285

Fixes #6255
Bug: https://curl.se/docs/CVE-2020-8285.html
Reported-by: xnynx on github
4 years agoftp: CURLOPT_FTP_SKIP_PASV_IP by default
Daniel Stenberg [Tue, 24 Nov 2020 13:56:57 +0000 (14:56 +0100)] 
ftp: CURLOPT_FTP_SKIP_PASV_IP by default

The command line tool also independently sets --ftp-skip-pasv-ip by
default.

Ten test cases updated to adapt the modified --libcurl output.

Bug: https://curl.se/docs/CVE-2020-8284.html
CVE-2020-8284

Reported-by: Varnavas Papaioannou
4 years agourlapi: don't accept blank port number field without scheme
Daniel Stenberg [Fri, 4 Dec 2020 16:27:57 +0000 (17:27 +0100)] 
urlapi: don't accept blank port number field without scheme

... as it makes the URL parser accept "very-long-hostname://" as a valid
host name and we don't want that. The parser now only accepts a blank
(no digits) after the colon if the URL starts with a scheme.

Reported-by: d4d on hackerone
Closes #6283

4 years agoRevert "multi: implement wait using winsock events"
Daniel Stenberg [Sat, 5 Dec 2020 16:56:35 +0000 (17:56 +0100)] 
Revert "multi: implement wait using winsock events"

This reverts commit d2a7d7c185f98df8f3e585e5620cbc0482e45fac.

This commit also reverts the subsequent follow-ups to that commit, which
were all done within windows #ifdefs that are removed in this
change. Marc helped me verify this.

Fixes #6146
Closes #6281

4 years agoftp: retry getpeername for FTP with TCP_FASTOPEN
Klaus Crusius [Sat, 28 Nov 2020 17:17:11 +0000 (18:17 +0100)] 
ftp: retry getpeername for FTP with TCP_FASTOPEN

In the case of TFO, the remote host name is not resolved at the
connetion time.

For FTP that has lead to missing hostname for the secondary connection.
Therefore the name resolution is done at the time, when FTP requires it.

Fixes #6252
Closes #6265
Closes #6282

4 years agoscripts/completion.pl: parse all opts
Thomas Danielsson [Sat, 5 Dec 2020 15:21:53 +0000 (15:21 +0000)] 
scripts/completion.pl: parse all opts

For tab-completion it may be preferable to include all the
available options.

Closes #6280

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 4 Dec 2020 15:27:35 +0000 (16:27 +0100)] 
RELEASE-NOTES: synced

4 years agoopenssl: use OPENSSL_init_ssl() with >= 1.1.0
Daniel Stenberg [Sat, 28 Nov 2020 15:42:52 +0000 (16:42 +0100)] 
openssl: use OPENSSL_init_ssl() with >= 1.1.0

Reported-by: Kovalkov Dmitrii and Per Nilsson
Fixes #6254
Fixes #6256
Closes #6260

4 years agoSECURITY-PROCESS: disclose on hackerone
Daniel Stenberg [Thu, 3 Dec 2020 13:18:51 +0000 (14:18 +0100)] 
SECURITY-PROCESS: disclose on hackerone

Once a vulnerability has been published, the hackerone issue should be
disclosed. For tranparency.

Closes #6275

4 years agotests/util.py: fix compatibility with Python 2
Marc Hoersken [Mon, 30 Nov 2020 21:16:21 +0000 (22:16 +0100)] 
tests/util.py: fix compatibility with Python 2

Backporting the Python 3 implementation of setStream
to ClosingFileHandler as a fallback within Python 2.

Reported-by: Jay Satiro
Fixes #6259
Closes #6270

4 years agodocs: fix typos and markup in ETag manpage sections
Daniel Gustafsson [Thu, 3 Dec 2020 12:25:42 +0000 (13:25 +0100)] 
docs: fix typos and markup in ETag manpage sections

Reported-by: emanruse on github
Fixes #6273

4 years agoquiche: close the connection
Daniel Stenberg [Wed, 18 Nov 2020 13:06:07 +0000 (14:06 +0100)] 
quiche: close the connection

Reported-by: Junho Choi
Fixes #6213
Closes #6217

4 years agongtcp2: Fix build error due to symbol name change
Jay Satiro [Wed, 2 Dec 2020 07:56:56 +0000 (02:56 -0500)] 
ngtcp2: Fix build error due to symbol name change

- NGTCP2_CRYPTO_LEVEL_APP -> NGTCP2_CRYPTO_LEVEL_APPLICATION

ngtcp2/ngtcp2@76232e9 changed the name.

ngtcp2 master is required to build curl with http3 support.

Closes https://github.com/curl/curl/pull/6271

4 years agocmake: check for linux/tcp.h
Klaus Crusius [Sat, 28 Nov 2020 17:17:11 +0000 (18:17 +0100)] 
cmake: check for linux/tcp.h

The HAVE_LINUX_TCP_H define was not set by cmake.

Closes #6252

4 years agoNEW-PROTOCOL: document what needs to be done to add one
Daniel Stenberg [Sat, 28 Nov 2020 21:03:54 +0000 (22:03 +0100)] 
NEW-PROTOCOL: document what needs to be done to add one

Closes #6263

4 years agosplay: rename Curl_splayremovebyaddr to Curl_splayremove
Daniel Stenberg [Mon, 30 Nov 2020 16:51:26 +0000 (17:51 +0100)] 
splay: rename Curl_splayremovebyaddr to Curl_splayremove

... and remove the old unused proto for the old Curl_splayremove
version.

Closes #6269

4 years agoopenssl: free mem_buf in error path
Daniel Stenberg [Mon, 30 Nov 2020 16:36:42 +0000 (17:36 +0100)] 
openssl: free mem_buf in error path

To fix a memory-leak.

Closes #6267

4 years agoopenssl: remove #if 0 leftover
Daniel Stenberg [Mon, 30 Nov 2020 16:47:24 +0000 (17:47 +0100)] 
openssl: remove #if 0 leftover

Follow-up to 4c9768565ec3a9 (from Sep 2008)

Closes #6268

4 years agontlm: avoid malloc(0) on zero length user and domain
Daniel Stenberg [Sat, 28 Nov 2020 21:29:59 +0000 (22:29 +0100)] 
ntlm: avoid malloc(0) on zero length user and domain

... and simplify the too-long checks somewhat.

Detected by OSS-Fuzz

Closes #6264

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Sat, 28 Nov 2020 22:21:00 +0000 (23:21 +0100)] 
RELEASE-NOTES: synced

4 years agotests/server/tftpd.c: close upload file in case of abort
Marc Hoersken [Tue, 24 Nov 2020 19:49:09 +0000 (20:49 +0100)] 
tests/server/tftpd.c: close upload file in case of abort

Commit c353207 removed the closing right after do_tftp
which covered the case of abort. This handles that case.

Reviewed-by: Jay Satiro
Reviewed-by: Daniel Stenberg
Follow up to #6209
Closes #6234

4 years agongtcp2: use the minimal version of QUIC supported by ngtcp2
Daiki Ueno [Thu, 26 Nov 2020 08:47:02 +0000 (09:47 +0100)] 
ngtcp2: use the minimal version of QUIC supported by ngtcp2

Closes #6250

4 years agongtcp2: advertise h3 ALPN unconditionally
Daiki Ueno [Thu, 26 Nov 2020 08:45:48 +0000 (09:45 +0100)] 
ngtcp2: advertise h3 ALPN unconditionally

Closes #6250

4 years agovquic/ngtcp2.h: define local_addr as sockaddr_storage
Daiki Ueno [Thu, 26 Nov 2020 08:37:03 +0000 (09:37 +0100)] 
vquic/ngtcp2.h: define local_addr as sockaddr_storage

This field needs to be wide enough to hold sockaddr_in6 when
connecting via IPv6.  Otherwise, ngtcp2_conn_read_pkt will drop the
packets because of the address mismatch:
  I00000022 [...] con ignore packet from unknown path

We can safely assume that struct sockaddr_storage is available, as it
is used in the public interface of ngtcp2.

Closes #6250

4 years agosocks: check for DNS entries with the right port number
Daniel Stenberg [Thu, 26 Nov 2020 16:28:39 +0000 (17:28 +0100)] 
socks: check for DNS entries with the right port number

The resolve call is done with the right port number, but the subsequent
check used the wrong one, which then could find a previous resolve which
would return and leave the fresh resolve "incomplete" and leaking
memory.

Fixes #6247
Closes #6253

4 years agocurl_setup: USE_RESOLVE_ON_IPS is for Apple native resolver use
Daniel Stenberg [Thu, 26 Nov 2020 16:26:59 +0000 (17:26 +0100)] 
curl_setup: USE_RESOLVE_ON_IPS is for Apple native resolver use

... so don't define it when instructed to use c-ares!

4 years agotest506: make it not run in c-ares builds
Daniel Stenberg [Thu, 26 Nov 2020 16:24:55 +0000 (17:24 +0100)] 
test506: make it not run in c-ares builds

As the asynch nature of it may trigger events in another order. A c-ares
upgrade made it break.

Reported-by: Marc Hörsken
Fixes #6247

4 years agoruntests: make 'c-ares' a "feature" to depend on
Daniel Stenberg [Thu, 26 Nov 2020 16:24:24 +0000 (17:24 +0100)] 
runtests: make 'c-ares' a "feature" to depend on

... also added to the docs.