]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
4 years agohttp2: fix resource leaks in set_transfer_url()
Kamil Dudka [Fri, 30 Apr 2021 16:14:45 +0000 (18:14 +0200)] 
http2: fix resource leaks in set_transfer_url()

... detected by Coverity:

Error: RESOURCE_LEAK (CWE-772):
lib/http2.c:480: alloc_fn: Storage is returned from allocation function "curl_url". [Note: The source code implementation of the function has been overridden by a builtin model.]
lib/http2.c:480: var_assign: Assigning: "u" = storage returned from "curl_url()".
lib/http2.c:486: noescape: Resource "u" is not freed or pointed-to in "curl_url_set". [Note: The source code implementation of the function has been overridden by a builtin model.]
lib/http2.c:488: leaked_storage: Variable "u" going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK (CWE-772):
lib/http2.c:480: alloc_fn: Storage is returned from allocation function "curl_url". [Note: The source code implementation of the function has been overridden by a builtin model.]
lib/http2.c:480: var_assign: Assigning: "u" = storage returned from "curl_url()".
lib/http2.c:493: noescape: Resource "u" is not freed or pointed-to in "curl_url_set". [Note: The source code implementation of the function has been overridden by a builtin model.]
lib/http2.c:495: leaked_storage: Variable "u" going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK (CWE-772):
lib/http2.c:480: alloc_fn: Storage is returned from allocation function "curl_url". [Note: The source code implementation of the function has been overridden by a builtin model.]
lib/http2.c:480: var_assign: Assigning: "u" = storage returned from "curl_url()".
lib/http2.c:500: noescape: Resource "u" is not freed or pointed-to in "curl_url_set". [Note: The source code implementation of the function has been overridden by a builtin model.]
lib/http2.c:502: leaked_storage: Variable "u" going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK (CWE-772):
lib/http2.c:480: alloc_fn: Storage is returned from allocation function "curl_url". [Note: The source code implementation of the function has been overridden by a builtin model.]
lib/http2.c:480: var_assign: Assigning: "u" = storage returned from "curl_url()".
lib/http2.c:505: noescape: Resource "u" is not freed or pointed-to in "curl_url_get". [Note: The source code implementation of the function has been overridden by a builtin model.]
lib/http2.c:507: leaked_storage: Variable "u" going out of scope leaks the storage it points to.

Closes #6986

4 years agorustls: use ALPN
Jacob Hoffman-Andrews [Sun, 25 Apr 2021 01:02:24 +0000 (18:02 -0700)] 
rustls: use ALPN

Update required rustls to 0.5.0

Closes #6960

4 years agogskit: fix CURL_DISABLE_PROXY build
MAntoniak [Thu, 29 Apr 2021 11:25:35 +0000 (13:25 +0200)] 
gskit: fix CURL_DISABLE_PROXY build

Removed localfd and remotefd from ssl_backend_data (ued only with proxy
connection). Function pipe_ssloverssl return always 0, when proxy is not
used.

Closes #6981

4 years agogskit: fix undefined reference to 'conn'
MAntoniak [Thu, 29 Apr 2021 11:23:03 +0000 (13:23 +0200)] 
gskit: fix undefined reference to 'conn'

Closes #6980

4 years agotls: add USE_HTTP2 define
Jacob Hoffman-Andrews [Sun, 25 Apr 2021 01:05:15 +0000 (18:05 -0700)] 
tls: add USE_HTTP2 define

This abstracts across the two HTTP/2 backends: nghttp2 and Hyper.

Add our own define for the "h2" ALPN protocol, so TLS backends can use
it without depending on a specific HTTP backend.

Closes #6959

4 years agolib: fix 0-length Curl_client_write calls
Jacob Hoffman-Andrews [Tue, 27 Apr 2021 22:48:01 +0000 (15:48 -0700)] 
lib: fix 0-length Curl_client_write calls

Closes #6954

4 years agolib: remove strlen call from Curl_client_write
Jacob Hoffman-Andrews [Sat, 24 Apr 2021 17:33:56 +0000 (10:33 -0700)] 
lib: remove strlen call from Curl_client_write

At all call sites with an explicit 0 len, pass an appropriate nonzero
len.

Closes #6954

4 years agodocs: camelcase it like GitHub everywhere
Ayushman Singh Chauhan [Tue, 27 Apr 2021 17:53:43 +0000 (23:23 +0530)] 
docs: camelcase it like GitHub everywhere

Closes #6979

4 years agodocs: fix typo in fail-with-body doc
Lucas Servén Marín [Tue, 27 Apr 2021 15:53:39 +0000 (17:53 +0200)] 
docs: fix typo in fail-with-body doc

This commit fixes a small typo in the documentation for the
--fail-with-body flag.

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

4 years agolib: fix some misuse of curlx_convert_UTF8_to_tchar
Jay Satiro [Fri, 23 Apr 2021 04:21:16 +0000 (00:21 -0400)] 
lib: fix some misuse of curlx_convert_UTF8_to_tchar

curlx_convert_UTF8_to_tchar must be freed by curlx_unicodefree, but
prior to this change some uses mistakenly called free.

I've reviewed all other uses of curlx_convert_UTF8_to_tchar and
curlx_convert_tchar_to_UTF8.

Bug: https://github.com/curl/curl/pull/6602#issuecomment-825236763
Reported-by: sergio-nsk@users.noreply.github.com
Closes https://github.com/curl/curl/pull/6938

4 years agontlm: precaution against super huge type2 offsets
Daniel Stenberg [Tue, 27 Apr 2021 09:12:23 +0000 (11:12 +0200)] 
ntlm: precaution against super huge type2 offsets

... which otherwise caused an integer overflow and circumvented the if()
conditional size check.

Detected by OSS-Fuzz
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33720
Assisted-by: Max Dymond
Closes #6975

4 years agoc-hyper: fix unused variable ‘wrote’
Daniel Stenberg [Tue, 27 Apr 2021 14:00:48 +0000 (16:00 +0200)] 
c-hyper: fix unused variable ‘wrote’

4 years agolibcurl-security.3: be careful of setuid
Daniel Stenberg [Mon, 26 Apr 2021 09:15:55 +0000 (11:15 +0200)] 
libcurl-security.3: be careful of setuid

Reported-by: Harry Sintonen
Closes #6970

4 years agoc-hyper: don't write to set.writeheader if null
Kevin Burke [Mon, 26 Apr 2021 22:04:02 +0000 (15:04 -0700)] 
c-hyper: don't write to set.writeheader if null

Previously if a caller set CURLOPT_WRITEFUNCTION but did not set a
CURLOPT_HEADERDATA buffer, Hyper would still attempt to write headers to
the data->set.writeheader header buffer, even though it is null.  This
led to NPE segfaults attempting to use libcurl+Hyper with Git, for
example.

Instead, process the client write for the status line using the same
logic we use to process the client write for the later HTTP headers,
which contains the appropriate guard logic. As a side benefit,
data->set.writeheader is now only read in one file instead of two.

Fixes #6619
Fixes abetterinternet/crustls#49
Fixes hyperium/hyper#2438
Closes #6971

4 years agowolfssl: handle SSL_write() returns 0 for error
Daniel Stenberg [Mon, 26 Apr 2021 09:11:59 +0000 (11:11 +0200)] 
wolfssl: handle SSL_write() returns 0 for error

Reported-by: Timo Lange
Closes #6967

4 years agoeasy: ignore sigpipe in curl_easy_send
Daniel Stenberg [Mon, 26 Apr 2021 07:58:23 +0000 (09:58 +0200)] 
easy: ignore sigpipe in curl_easy_send

Closes #6965

4 years agosigpipe: ignore SIGPIPE when using wolfSSL as well
Daniel Stenberg [Mon, 26 Apr 2021 07:57:44 +0000 (09:57 +0200)] 
sigpipe: ignore SIGPIPE when using wolfSSL as well

Closes #6966

4 years agolibcurl-security.3: don't try to filter IPv4 hosts based on the URL
Daniel Stenberg [Fri, 23 Apr 2021 14:32:19 +0000 (16:32 +0200)] 
libcurl-security.3: don't try to filter IPv4 hosts based on the URL

Closes #6942

4 years agonss_set_blocking: avoid static for sock_opt
Harry Sintonen [Fri, 23 Apr 2021 21:53:42 +0000 (00:53 +0300)] 
nss_set_blocking: avoid static for sock_opt

Reviewed-by: Kamil Dudka
Closes #6945

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 26 Apr 2021 06:30:44 +0000 (08:30 +0200)] 
RELEASE-NOTES: synced

4 years agodocs/HTTP3.md: fix nghttp2's HTTP/3 server port
Yusuke Nakamura [Mon, 26 Apr 2021 02:29:10 +0000 (11:29 +0900)] 
docs/HTTP3.md: fix nghttp2's HTTP/3 server port

Port 8443 does not work now.
Correct origin is in the quicwg's wiki.
https://github.com/quicwg/base-drafts/wiki/Implementations#ngtcp2

Closes #6964

4 years agokrb5: don't use 'static' to store PBSZ size response
Daniel Stenberg [Sun, 25 Apr 2021 21:02:27 +0000 (23:02 +0200)] 
krb5: don't use 'static' to store PBSZ size response

... because it makes the knowledge and usage cross-transfer in funny and
unexpected ways.

Reported-by: Harry Sintonen
Closes #6963

4 years agom4: add security frameworks on Mac when compiling rustls
Kevin Burke [Sat, 24 Apr 2021 21:20:08 +0000 (14:20 -0700)] 
m4: add security frameworks on Mac when compiling rustls

Previously compiling rustls on Mac would only complete if you also
compiled the SecureTransport TLS backend, which curl would prefer to
the Rust backend.

Appending these flags to LDFLAGS makes it possible to compile the
Rustls backend on Mac without the SecureTransport backend, which means
this patch will make it possible for Mac users to use the Rustls
backend for TLS.

Reviewed-by: Jacob Hoffman-Andrews
Fixes #6955
Cloes #6956

4 years agokrb5: remove the unused 'overhead' function
Daniel Stenberg [Fri, 23 Apr 2021 21:47:45 +0000 (23:47 +0200)] 
krb5: remove the unused 'overhead' function

Closes #6947

4 years agocurl_url_set.3: add memory management information
Johann150 [Sat, 24 Apr 2021 15:13:07 +0000 (17:13 +0200)] 
curl_url_set.3: add memory management information

wording taken from man page for CURLOPT_URL.3

As far as I can see, the URL part is either malloc'ed before due to
encoding or it is strdup'ed.

Closes #6953

4 years agoc-hpyer: fix handling of zero-byte chunk from hyper
Jacob Hoffman-Andrews [Sat, 24 Apr 2021 03:24:30 +0000 (20:24 -0700)] 
c-hpyer: fix handling of zero-byte chunk from hyper

Closes #6951

4 years agoCURLOPT_POSTFIELDS.3: clarify how it gets the size of the data
Daniel Stenberg [Fri, 23 Apr 2021 15:14:58 +0000 (17:14 +0200)] 
CURLOPT_POSTFIELDS.3: clarify how it gets the size of the data

Ref: https://curl.se/mail/lib-2021-04/0085.html
Closes #6943

4 years agocmake: make libcurl output filename configurable
Ralph Langendam [Thu, 22 Apr 2021 15:29:45 +0000 (17:29 +0200)] 
cmake: make libcurl output filename configurable

Reviewed-by: Jakub Zakrzewski
Closes #6933

4 years agovtls: reset ssl use flag upon negotiation failure
Patrick Monnerat [Thu, 22 Apr 2021 22:33:46 +0000 (00:33 +0200)] 
vtls: reset ssl use flag upon negotiation failure

Fixes the segfault in ldaps disconnect.

Reported-by: Illarion Taev
Fixes #6934
Closes #6937

4 years agoconfigure: fix typo in TLS error message
Daniel Stenberg [Fri, 23 Apr 2021 07:21:02 +0000 (09:21 +0200)] 
configure: fix typo in TLS error message

Reported-by: Pontus Lundkvist
4 years agoREADME: link to the commercial support option
Daniel Stenberg [Fri, 23 Apr 2021 06:59:08 +0000 (08:59 +0200)] 
README: link to the commercial support option

4 years agoversion: add gsasl_version to curl_version_info_data
Martin Halle [Sat, 3 Apr 2021 04:42:01 +0000 (06:42 +0200)] 
version: add gsasl_version to curl_version_info_data

- Add gsasl_version string and bump to CURLVERSION_TENTH.

Ref: https://curl.se/mail/lib-2021-04/0003.html

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

4 years agoschannel: Support strong crypto option
Morten Minde Neergaard [Fri, 12 Mar 2021 11:40:22 +0000 (12:40 +0100)] 
schannel: Support strong crypto option

- Support enabling strong crypto via optional user cipher list when
  USE_STRONG_CRYPTO or SCH_USE_STRONG_CRYPTO is in the list.

MSDN says SCH_USE_STRONG_CRYPTO "Instructs Schannel to disable known
weak cryptographic algorithms, cipher suites, and SSL/TLS protocol
versions that may be otherwise enabled for better interoperability."

Ref: https://curl.se/mail/lib-2021-02/0066.html
Ref: https://curl.se/docs/manpage.html#--ciphers
Ref: https://curl.se/libcurl/c/CURLOPT_SSL_CIPHER_LIST.html
Ref: https://docs.microsoft.com/en-us/windows/win32/api/schannel/ns-schannel-schannel_cred

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

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 22 Apr 2021 21:37:12 +0000 (23:37 +0200)] 
RELEASE-NOTES: synced

4 years agoci: adapt to configure requiring an explicit TLS choice
Daniel Stenberg [Thu, 15 Apr 2021 07:21:40 +0000 (09:21 +0200)] 
ci: adapt to configure requiring an explicit TLS choice

4 years agoconfigure: split out each TLS library detector into its own function
Daniel Stenberg [Thu, 15 Apr 2021 09:17:29 +0000 (11:17 +0200)] 
configure: split out each TLS library detector into its own function

... and put those functions in separate m4 files per TLS library.

4 years agoconfigure: make the TLS library choice(s) explicit
Daniel Stenberg [Thu, 15 Apr 2021 07:04:30 +0000 (09:04 +0200)] 
configure: make the TLS library choice(s) explicit

configure no longer tries to find a TLS library by default, but all
libraries are now equal: the user needs to explicitly ask what TLS
library or libraries to use.

If no TLS library is selected, configure will error out unless
--without-ssl is explicitly used to request a built without TLS (as that
is very rare these days).

Removes: --with-winssl, --with-darwinssl and all --without-* options for
TLS libraries.

Closes #6897

4 years agotests/disable-scan.pl: also scan all m4 files
Daniel Stenberg [Thu, 15 Apr 2021 10:11:41 +0000 (12:11 +0200)] 
tests/disable-scan.pl: also scan all m4 files

Fixes test 1165 when functions are moved from configure.ac to files in
m4/

4 years agoschannel: Disable auto credentials; add an option to enable it
Jay Satiro [Sat, 27 Feb 2021 21:27:31 +0000 (16:27 -0500)] 
schannel: Disable auto credentials; add an option to enable it

- Disable auto credentials by default. This is a breaking change
  for clients that are using it, wittingly or not.

- New libcurl ssl option value CURLSSLOPT_AUTO_CLIENT_CERT tells libcurl
  to automatically locate and use a client certificate for
  authentication, when requested by the server.

- New curl tool options --ssl-auto-client-cert and
  --proxy-ssl-auto-client-cert map to CURLSSLOPT_AUTO_CLIENT_CERT.

This option is only supported for Schannel (the native Windows SSL
library). Prior to this change Schannel would, with no notification to
the client, attempt to locate a client certificate and send it to the
server, when requested by the server. Since the server can request any
certificate that supports client authentication in the OS certificate
store it could be a privacy violation and unexpected.

Fixes https://github.com/curl/curl/issues/2262
Reported-by: Jeroen Ooms
Assisted-by: Wes Hinsley
Assisted-by: Rich FitzJohn
Ref: https://curl.se/mail/lib-2021-02/0066.html
Reported-by: Morten Minde Neergaard
Closes https://github.com/curl/curl/pull/6673

4 years agovtls: deduplicate some DISABLE_PROXY ifdefs
Michał Antoniak [Thu, 25 Feb 2021 19:47:35 +0000 (20:47 +0100)] 
vtls: deduplicate some DISABLE_PROXY ifdefs

continue from #5735

- using SSL_HOST_NAME, SSL_HOST_DISPNAME, SSL_PINNED_PUB_KEY for other
  tls backend

- create SSL_HOST_PORT

Closes #6660

4 years agoOS400: fix typo
Jay Satiro [Thu, 22 Apr 2021 20:18:01 +0000 (16:18 -0400)] 
OS400: fix typo

CURLVERSION_HEIGHTH -> CURLVERSION_EIGHTH

4 years agochecksrc: complain on == NULL or != 0 checks in conditions 6912/head
Daniel Stenberg [Mon, 19 Apr 2021 08:45:29 +0000 (10:45 +0200)] 
checksrc: complain on == NULL or != 0 checks in conditions

... to make them all consistenly use if(!var) and if(var)

Also added a few missing warnings to the documentation.

Closes #6912

4 years agotidy-up: make conditional checks more consistent
Daniel Stenberg [Mon, 19 Apr 2021 08:46:11 +0000 (10:46 +0200)] 
tidy-up: make conditional checks more consistent

... remove '== NULL' and '!= 0'

Closes #6912

4 years agovauth: factor base64 conversions out of authentication procedures
Patrick Monnerat [Wed, 17 Mar 2021 19:09:55 +0000 (20:09 +0100)] 
vauth: factor base64 conversions out of authentication procedures

Input challenges and returned messages are now in binary.
Conversions from/to base64 are performed by callers (currently curl_sasl.c
and http_ntlm.c).

Closes #6654

4 years agobufref: buffer reference support
Patrick Monnerat [Tue, 23 Mar 2021 01:02:18 +0000 (02:02 +0100)] 
bufref: buffer reference support

A struct bufref holds a buffer pointer, a data size and a destructor.
When freed or its contents are changed, the previous buffer is implicitly
released by the associated destructor. The data size, although not used
internally, allows binary data support.

A unit test checks its handling methods: test 1661

Closes #6654

4 years agoos400: additional support for options metadata
Patrick Monnerat [Sun, 11 Apr 2021 17:33:09 +0000 (19:33 +0200)] 
os400: additional support for options metadata

New functions curl_easy_option_by_name_ccsid() and
curl_easy_option_get_name_ccsid() allows accessing metadata in alternate
character encoding.

This commit also updates curl_version_info_ccsid() to handle info version 9
and adds recent definitions to the ILE/RPG include file.

Documentation updated accordingly.

Reviewed-by: Jon Rumsey
Closes #6574

4 years agotest server: take care of siginterrupt() deprecation
Patrick Monnerat [Tue, 26 Jan 2021 02:10:48 +0000 (03:10 +0100)] 
test server: take care of siginterrupt() deprecation

Closes #6529

4 years agolib1564.c: enable last wakeup test part on Windows
Marc Hoersken [Thu, 25 Feb 2021 21:18:46 +0000 (22:18 +0100)] 
lib1564.c: enable last wakeup test part on Windows

Suggested-by: Gergely Nagy
Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
Closes #6245

4 years agomulti: fix slow write/upload performance on Windows
Marc Hoersken [Tue, 15 Dec 2020 06:22:13 +0000 (07:22 +0100)] 
multi: fix slow write/upload performance on Windows

Reset FD_WRITE by sending zero bytes which is permissible
and will be treated by implementations as successful send.

Without this we won't be notified in case a socket is still
writable if we already received such a notification and did
not send any data afterwards on the socket. This would lead
to waiting forever on a writable socket being writable again.

Assisted-by: Tommy Odom
Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
Tested-by: tmkk on github
Bug: #6146
Closes #6245

4 years agomulti: reduce Win32 API calls to improve performance
Marc Hoersken [Sun, 6 Dec 2020 16:28:26 +0000 (17:28 +0100)] 
multi: reduce Win32 API calls to improve performance

1. Consolidate pre-checks into a single Curl_poll call:

This is an attempt to restructure the code in Curl_multi_wait
in such a way that less syscalls are made by removing individual
calls to Curl_socket_check via SOCKET_READABLE/SOCKET_WRITABLE.

2. Avoid resetting the WinSock event multiple times:

We finally call WSAResetEvent anyway, so specifying it as
an optional parameter to WSAEnumNetworkEvents is redundant.

3. Wakeup directly in case no sockets are being monitoring:

Fix the WinSock based implementation to skip extra waiting by
not sleeping in case no sockets are to be waited on and just
the WinSock event is being monitored for wakeup functionality.

Assisted-by: Tommy Odom
Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
Bug: #6146
Closes #6245

4 years agoRevert "Revert 'multi: implement wait using winsock events'"
Marc Hoersken [Wed, 9 Dec 2020 06:25:15 +0000 (07:25 +0100)] 
Revert "Revert 'multi: implement wait using winsock events'"

This reverts commit 2260e0ebe6d45529495231b3e37a0c58fb92a6a2,
also restoring previous follow up changes which were reverted.

Authored-by: rcombs on github
Authored-by: Marc Hörsken
Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
Restores #5634
Reverts #6281
Part of #6245

4 years agoRevert "cmake: make libcurl library output name configurable"
Daniel Stenberg [Wed, 21 Apr 2021 13:03:04 +0000 (15:03 +0200)] 
Revert "cmake: make libcurl library output name configurable"

This reverts commit 1cba36d2166c396f987eea587cf92671b27acb92.

CMake provides properties that can be set on a target to rename the
output artifact without changing the name of a target.

Ref: #6899

4 years agosectransp: allow cipher name to be specified
Michael Kolechkin [Fri, 15 Jan 2021 20:32:04 +0000 (12:32 -0800)] 
sectransp: allow cipher name to be specified

Add parser for CURLOPT_SSL_CIPHER_LIST option for Secure Transport (ST)
back-end. Similar to NSS and GSKit back-ends, new code parses string
value and configures ST library to use those ciphers for communication.
Create cipher spec data structure and initialize the array of specs with
cipher number, name, alias, and 'weak' flag.

Mark triple-DES ciphers as 'weak', and exclude them from the default
ciphers list.

Closes #6464

4 years agoNSS: add ciphers to map
Michael Kolechkin [Fri, 26 Feb 2021 18:27:49 +0000 (10:27 -0800)] 
NSS: add ciphers to map

Add cipher names to the `cipherlist` map, based on the list of ciphers
implemented by the NSS in the source code file
https://github.com/nss-dev/nss/blob/master/lib/ssl/sslenum.c

Closes #6670

4 years agohttp2: remove DEBUG_HTTP2
Daniel Stenberg [Wed, 21 Apr 2021 09:34:10 +0000 (11:34 +0200)] 
http2: remove DEBUG_HTTP2

Accidentally committed in 605e84235

4 years agocmake: make libcurl library output name configurable
Ralph Langendam [Thu, 15 Apr 2021 14:54:23 +0000 (16:54 +0200)] 
cmake: make libcurl library output name configurable

Closes #6899

4 years agosws: #ifdef S_IFSOCK use
Daniel Stenberg [Tue, 20 Apr 2021 07:29:23 +0000 (09:29 +0200)] 
sws: #ifdef S_IFSOCK use

SCO OpenServer 5.0.7 does not define S_IFSOCK.

Reported-by: Kevin R. Bulgrien
Bug: https://curl.se/mail/lib-2021-04/0074.html
Closes #6926

4 years agocurl_setup: provide the shutdown flags wider
Daniel Stenberg [Tue, 20 Apr 2021 07:21:09 +0000 (09:21 +0200)] 
curl_setup: provide the shutdown flags wider

By using #ifdef on the symbol names to work on anything that don't
provide them. SCO OpenServer 5.0.7, sys/socket.h does not define either
SHUT_RDWR, SHUT_RD, and SHUT_WR.

Reported-by: Kevin R. Bulgrien
Bug: https://curl.se/mail/lib-2021-04/0073.html
Closes #6925

4 years agoconnect: use CURL_SA_FAMILY_T for portability
Daniel Stenberg [Mon, 19 Apr 2021 21:28:12 +0000 (23:28 +0200)] 
connect: use CURL_SA_FAMILY_T for portability

Reported-by: Kevin R. Bulgrien
Bug: https://curl.se/mail/lib-2021-04/0071.html

Closes #6918

4 years agourlapi: make sure no +/- signs are accepted in IPv4 numericals
Daniel Stenberg [Mon, 19 Apr 2021 20:58:54 +0000 (22:58 +0200)] 
urlapi: make sure no +/- signs are accepted in IPv4 numericals

Follow-up to 56a037cc0ad1b2. Extends test 1560 to verify.

Reported-by: Tuomas Siipola
Fixes #6916
Closes #6917

4 years agoConnectionExists: respect requests for h1 connections better
Daniel Stenberg [Tue, 20 Apr 2021 08:44:12 +0000 (10:44 +0200)] 
ConnectionExists: respect requests for h1 connections better

... for situations when multiplexing isn't enabled on the h2 connection
and h1 is explicitly requested for the transfer.

Assisted-by: Gergely Nagy
4 years agomulti: don't close connection HTTP_1_1_REQUIRED
Daniel Stenberg [Mon, 19 Apr 2021 12:49:21 +0000 (14:49 +0200)] 
multi: don't close connection HTTP_1_1_REQUIRED

The ConnectionExists() function will note that the new transfer wants
less then h2 and that it can't multiplex it and therefor opt to open a
new connection instead.

4 years agohttp2: move the stream error field to the per-transfer storage
Daniel Stenberg [Mon, 19 Apr 2021 11:15:05 +0000 (13:15 +0200)] 
http2: move the stream error field to the per-transfer storage

Storing a stream error in the per-connection struct was an error that lead to
race conditions as subsequent stream handling could overwrite the error code
before it was used for the stream with the actual problem.

Closes #6910

4 years agohttp2: call the handle-closed function correctly on closed stream
Daniel Stenberg [Mon, 19 Apr 2021 11:13:47 +0000 (13:13 +0200)] 
http2: call the handle-closed function correctly on closed stream

This was this one condition where the stream could be closed due to an
error and the function would still wrongly just return 0 for it.

Reported-by: Gergely Nagy
Fixes #6862
Closes #6910

4 years agotest1660: check the created HSTS file as text mode
Daniel Stenberg [Tue, 20 Apr 2021 22:18:59 +0000 (00:18 +0200)] 
test1660: check the created HSTS file as text mode

Closes #6922

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 20 Apr 2021 09:51:53 +0000 (11:51 +0200)] 
RELEASE-NOTES: synced

4 years agotest 493: require https in curl to run
Daniel Stenberg [Tue, 20 Apr 2021 07:38:31 +0000 (09:38 +0200)] 
test 493: require https in curl to run

Closes #6927

4 years agotool_operate: don't discard failed parallel transfer result 6921/head
Jay Satiro [Tue, 20 Apr 2021 05:51:56 +0000 (01:51 -0400)] 
tool_operate: don't discard failed parallel transfer result

- Save a parallel transfer's result code only when it fails and the
  transfer is not being retried.

Prior to this change the result code was always set which meant that a
failed result could be erroneously discarded if a different transfer
later had a successful result (CURLE_OK).

Before:

> curl --fail -Z https://httpbin.org/status/404 https://httpbin.org/delay/10
> echo %ERRORLEVEL%
0

After:

> curl --fail -Z https://httpbin.org/status/404 https://httpbin.org/delay/10
> echo %ERRORLEVEL%
22

Closes #xxxx

4 years agoopenssl: fix build error with OpenSSL < 1.0.2
Georeth Zhou [Tue, 20 Apr 2021 03:11:56 +0000 (11:11 +0800)] 
openssl: fix build error with OpenSSL < 1.0.2

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

4 years agoREADME.md: delete Codacy UTM parameters & follow permanent redirect [ci skip]
Viktor Szakats [Mon, 19 Apr 2021 22:26:48 +0000 (22:26 +0000)] 
README.md: delete Codacy UTM parameters & follow permanent redirect [ci skip]

UTM parameters leak referrer and various marketing/tracking information
even if these would normally be stripped by website or client policy.
This link also works fine without them. Also took the opportunity to
update the URL to the one pointed to by the previous one via permanent
redirect.

Reviewed-by: Daniel Stenberg
Closes #6919

4 years agourlapi: "normalize" numerical IPv4 host names
Daniel Stenberg [Mon, 19 Apr 2021 06:34:52 +0000 (08:34 +0200)] 
urlapi: "normalize" numerical IPv4 host names

When the host name in a URL is given as an IPv4 numerical address, the
address can be specified with dotted numericals in four different ways:
a32, a.b24, a.b.c16 or a.b.c.d and each part can be specified in
decimal, octal (0-prefixed) or hexadecimal (0x-prefixed).

Instead of passing on the name as-is and leaving the handling to the
underlying name functions, which made them not work with c-ares but work
with getaddrinfo, this change now makes the curl URL API itself detect
and "normalize" host names specified as IPv4 numericals.

The WHATWG URL Spec says this is an okay way to specify a host name in a
URL. RFC 3896 does not allow them, but curl didn't prevent them before
and it seems other RFC 3896-using tools have not either. Host names used
like this are widely supported by other tools as well due to the
handling being done by getaddrinfo and friends.

I decided to add the functionality into the URL API itself so that all
users of these functions get the benefits, when for example wanting to
compare two URLs. Also, it makes curl built to use c-ares now support
them as well and make curl builds more consistent.

The normalization makes HTTPS and virtual hosted HTTP work fine even
when curl gets the address specified using one of the "obscure" formats.

Test 1560 is extended to verify.

Fixes #6863
Closes #6871

4 years agolibssh: fix "empty expression statement has no effect" warnings
Daniel Stenberg [Sat, 17 Apr 2021 17:00:15 +0000 (19:00 +0200)] 
libssh: fix "empty expression statement has no effect" warnings

... by fixing macros to do-while constructs and moving out the calls to
"break" outside of the actual macro. It also fixes the problem where the
macro was used witin a loop and the break didn't do right.

Reported-by: Emil Engler
Fixes #6847
Closes #6909

4 years agohsts: enable by default
Daniel Stenberg [Mon, 8 Mar 2021 07:30:32 +0000 (08:30 +0100)] 
hsts: enable by default

No longer considered experimental.

Closes #6700

4 years agovtls: refuse setting any SSL version
Daniel Stenberg [Mon, 22 Mar 2021 12:39:37 +0000 (13:39 +0100)] 
vtls: refuse setting any SSL version

... previously they were supported if a TLS library would (unexpectedly)
still support them, but from this change they will be refused already in
curl_easy_setopt(). SSLv2 and SSLv3 have been known to be insecure for
many years now.

Closes #6773

4 years agocurl: ignore options asking for SSLv2 or SSLv3
Daniel Stenberg [Mon, 22 Mar 2021 10:55:27 +0000 (11:55 +0100)] 
curl: ignore options asking for SSLv2 or SSLv3

Instead output a warning about it and continue with the defaults.

These SSL versions are typically not supported by the TLS libraries since a
long time back already since they are inherently insecure and broken. Asking
for them to be used will just cause an error to be returned slightly later.

In the unlikely event that a user's TLS library actually still supports these
protocol versions, this change might make the request a little less insecure.

Closes #6772

4 years agotest972: verify the json output with jsonlint 6906/head
Daniel Stenberg [Fri, 16 Apr 2021 21:53:22 +0000 (23:53 +0200)] 
test972: verify the json output with jsonlint

Make sure one of the azure jobs has jsonlint installed so that the test
runs there.

Ref: #6905

4 years agotool_writeout: fix the HTTP_CODE json output
Jay Satiro [Fri, 16 Apr 2021 22:34:48 +0000 (00:34 +0200)] 
tool_writeout: fix the HTTP_CODE json output

Update test 970 accordingly.

Reported-by: Michal Rus
Fixes #6905
Closes #6906

4 years agoopenldap: protect SSL-specific code with proper #ifdef
Daniel Stenberg [Thu, 15 Apr 2021 20:47:09 +0000 (22:47 +0200)] 
openldap: protect SSL-specific code with proper #ifdef

Closes #6901

4 years agolibssh2: fix Value stored to 'sshp' is never read
Daniel Stenberg [Thu, 15 Apr 2021 15:46:24 +0000 (17:46 +0200)] 
libssh2: fix Value stored to 'sshp' is never read

Pointed out by scan-build

Closes #6900

4 years agotool_getparam: replace (in-place) '%20' by '+' according to RFC1866
Victor Vieux [Thu, 15 Apr 2021 04:45:21 +0000 (21:45 -0700)] 
tool_getparam: replace (in-place) '%20' by '+' according to RFC1866

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Closes #6895

4 years agoconfigure: provide --with-openssl, deprecate --with-ssl
Daniel Stenberg [Tue, 13 Apr 2021 16:11:43 +0000 (18:11 +0200)] 
configure: provide --with-openssl, deprecate --with-ssl

Makes the option more explicit.

Closes #6887

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 15 Apr 2021 06:23:42 +0000 (08:23 +0200)] 
RELEASE-NOTES: synced

and bumped curlver to 7.77.0

4 years agorustls: only return CURLE_AGAIN when TLS session is fully drained
Javier Blazquez [Wed, 14 Apr 2021 21:55:12 +0000 (14:55 -0700)] 
rustls: only return CURLE_AGAIN when TLS session is fully drained

The code in cr_recv was returning prematurely as soon as the socket
reported no more data to read. However, this could be leaving some
unread plaintext data in the rustls session from a previous call,
causing causing the transfer to hang if the socket never receives
further data.

We need to ensure that the session is fully drained of plaintext data
before returning CURLE_AGAIN to the caller.

Reviewed-by: Jacob Hoffman-Andrews
Closes #6894

4 years agocookie: CURLOPT_COOKIEFILE set to NULL switches off cookies
Daniel Stenberg [Wed, 14 Apr 2021 07:15:19 +0000 (09:15 +0200)] 
cookie: CURLOPT_COOKIEFILE set to NULL switches off cookies

Add test 676 to verify that setting CURLOPT_COOKIEFILE to NULL again clears
the cookiejar from memory.

Reported-by: Stefan Karpinski
Fixes #6889
Closes #6891

4 years agoRELEASE-NOTES: synced curl-7_76_1
Daniel Stenberg [Fri, 9 Apr 2021 13:30:43 +0000 (15:30 +0200)] 
RELEASE-NOTES: synced

curl 7.76.1 release

4 years agoTHANKS: add names from 7.76.1
Daniel Stenberg [Tue, 13 Apr 2021 05:53:32 +0000 (07:53 +0200)] 
THANKS: add names from 7.76.1

4 years agomisc: update copyright year ranges to match latest updates
Daniel Stenberg [Sat, 10 Apr 2021 09:45:23 +0000 (11:45 +0200)] 
misc: update copyright year ranges to match latest updates

4 years agongtcp2: Use ALPN h3-29 for now
Tatsuhiro Tsujikawa [Tue, 13 Apr 2021 12:01:20 +0000 (21:01 +0900)] 
ngtcp2: Use ALPN h3-29 for now

Fixes #6864
Cloes #6886

4 years agoTODO: remove 18.22 --fail-with-body
Jay Satiro [Sun, 11 Apr 2021 04:36:13 +0000 (00:36 -0400)] 
TODO: remove 18.22 --fail-with-body

--fail-with-body was added in 8a964cb (precedes curl-7_76_0).

4 years agosrc/tool_vms.c: remove duplicated word in comment
Jürgen Gmach [Sat, 10 Apr 2021 08:15:29 +0000 (10:15 +0200)] 
src/tool_vms.c: remove duplicated word in comment

Closes #6881

4 years agoconfigure: fix CURL_DARWIN_CFLAGS use
Daniel Stenberg [Fri, 9 Apr 2021 14:08:32 +0000 (16:08 +0200)] 
configure: fix CURL_DARWIN_CFLAGS use

The macro name change was not completely done.

Follow-up to 5d2c384452543c
Bug: https://github.com/curl/curl/commit/5d2c384452543c7b6c9fb02eaa0afc84fd5ab941#commitcomment-49315187
Reported-by: Marcel Raad
Closes #6878

4 years agogithub/workflow: add "security-extended" to codeql-analysis.yml
Anthony Shaw [Tue, 30 Mar 2021 23:06:03 +0000 (10:06 +1100)] 
github/workflow: add "security-extended" to codeql-analysis.yml

Extends the CodeQL code scan.

Closes #6815

4 years agoexamples/hiperfifo.c: check event_initialized before delete
Jochem Broekhoff [Fri, 9 Apr 2021 09:03:30 +0000 (11:03 +0200)] 
examples/hiperfifo.c: check event_initialized before delete

If event_del is called with the event struct (still) zeroed out, a
segmentation fault may occur.  event_initialized checks whether the
event struct is nonzero.

Closes #6876

4 years agontlm: fix negotiated flags usage
Patrick Monnerat [Tue, 6 Apr 2021 17:32:21 +0000 (19:32 +0200)] 
ntlm: fix negotiated flags usage

According to Microsoft document MS-NLMP, current flags usage is not
accurate: flag NTLMFLAG_NEGOTIATE_NTLM2_KEY controls the use of
extended security in an NTLM authentication message and NTLM version 2
cannot be negotiated within the protocol.

The solution implemented here is: if the extended security flag is set,
prefer using NTLM version 2 (as a server featuring extended security
should also support version 2). If version 2 has been disabled at
compile time, use extended security.

Tests involving NTLM are adjusted to this new behavior.

Fixes #6813
Closes #6849

4 years agontlm: support version 2 on 32-bit platforms
Patrick Monnerat [Tue, 6 Apr 2021 17:31:03 +0000 (19:31 +0200)] 
ntlm: support version 2 on 32-bit platforms

Closes #6849

4 years agocurl_ntlm_core.h: simplify conditionals for USE_NTLM2SESSION
Patrick Monnerat [Fri, 2 Apr 2021 23:22:28 +0000 (01:22 +0200)] 
curl_ntlm_core.h: simplify conditionals for USE_NTLM2SESSION

... as !defined(CURL_DISABLE_CRYPTO_AUTH) is a prerequisite for the
whole NTLM.

Closes #6849

4 years agolib: remove unused HAVE_INET_NTOA_R* defines
Daniel Stenberg [Wed, 7 Apr 2021 22:36:57 +0000 (00:36 +0200)] 
lib: remove unused HAVE_INET_NTOA_R* defines

Closes #6867

4 years agoconfigure: include <time.h> unconditionally
Michael Forney [Wed, 7 Apr 2021 07:32:47 +0000 (00:32 -0700)] 
configure: include <time.h> unconditionally

In 2682e5f5, several instances of AC_HEADER_TIME were removed since
it is a deprecated autoconf macro. However, this was the macro that
defined TIME_WITH_SYS_TIME, which was used to indicate that <time.h>
can be included alongside <sys/time.h>. TIME_WITH_SYS_TIME is still
used in the configure test body and since it is no longer defined,
<time.h> is *not* included on systems that have <sys/time.h>.

In particular, at least on musl libc and glibc, <sys/time.h> does
not implicitly include <time.h> and does not declare clock_gettime,
gmtime_r, or localtime_r. This causes configure to fail to detect
those functions.

The AC_HEADER_TIME macro deprecation text says

> All current systems provide time.h; it need not be checked for.
> Not all systems provide sys/time.h, but those that do, all allow
> you to include it and time.h simultaneously.

So, to fix this issue, simply include <time.h> unconditionally when
testing for time-related functions and in libcurl, and don't bother
checking for it.

Closes #6859

4 years agoconfigure: remove use of RETSIGTYPE
Michael Forney [Wed, 7 Apr 2021 09:37:15 +0000 (02:37 -0700)] 
configure: remove use of RETSIGTYPE

This was previously defined by the obsolete AC_TYPE_SIGNAL macro,
which was removed in 2682e5f5. The deprecation text says

> Your code may safely assume C89 semantics that RETSIGTYPE is void.

So, remove it and just use void instead.

Closes #6861

4 years agoinstall: add instructions for Apple Darwin platforms
Muhammed Yavuz Nuzumlalı [Wed, 7 Apr 2021 09:05:47 +0000 (12:05 +0300)] 
install: add instructions for Apple Darwin platforms

Closes #6860