]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
4 years agotool_getparam: handle failure of curlx_convert_tchar_to_UTF8() 7023/head
Kamil Dudka [Thu, 6 May 2021 12:26:58 +0000 (14:26 +0200)] 
tool_getparam: handle failure of curlx_convert_tchar_to_UTF8()

Reported by GCC analyzer:

Error: GCC_ANALYZER_WARNING (CWE-476):
src/tool_getparam.c: scope_hint: In function 'parse_args'
src/tool_getparam.c:2318:38: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'orig_opt'
lib/curlx.h:56: included_from: Included from here.
src/tool_getparam.c:28: included_from: Included from here.
lib/curl_multibyte.h:70:51: note: in definition of macro 'curlx_convert_tchar_to_UTF8'
src/tool_getparam.c:2316:16: note: in expansion of macro 'curlx_convert_tchar_to_UTF8'

Reviewed-by: Marcel Raad
Reviewed-by: Daniel Stenberg
Closes #7023

4 years agoscripts/delta: also show total number of days
Daniel Stenberg [Thu, 6 May 2021 08:00:36 +0000 (10:00 +0200)] 
scripts/delta: also show total number of days

4 years agosockfilt: fix invalid increment of handles index variable nfd
Marc Hoersken [Sun, 2 May 2021 18:44:35 +0000 (20:44 +0200)] 
sockfilt: fix invalid increment of handles index variable nfd

Only increment the array index if we actually stored a handle.

Follow up to e917492048f4b85a0fd58a033d10072fc7666c3b
Closes #6992

4 years agosockfilt: avoid getting stuck waiting for writable socket
Marc Hoersken [Sun, 2 May 2021 18:42:11 +0000 (20:42 +0200)] 
sockfilt: avoid getting stuck waiting for writable socket

Reset FD_WRITE event using the same approach as in multi.c

Follow up to b36442b24305f3cda7c13cc64b46838995a4985b
Closes #6992

4 years agotest678: Fix for Windows multibyte builds
Jay Satiro [Wed, 5 May 2021 20:24:36 +0000 (16:24 -0400)] 
test678: Fix for Windows multibyte builds

Follow-up to 77fc385 from yesterday.

Bug: https://github.com/curl/curl/pull/6662#issuecomment-832966557
Reported-by: Marc Hörsken
4 years agobuild: fix compilation for Windows UWP platform
dmitrykos [Tue, 4 May 2021 14:54:21 +0000 (17:54 +0300)] 
build: fix compilation for Windows UWP platform

- Include afunix.h which is necessary for sockaddr_un when
  USE_UNIX_SOCKETS is defined on Windows.

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

4 years agognutls: make setting only the MAX TLS allowed version work
Daniel Stenberg [Tue, 4 May 2021 11:34:14 +0000 (13:34 +0200)] 
gnutls: make setting only the MAX TLS allowed version work

Previously, settting only the max allowed TLS version, leaving the
minimum one at default, didn't actually set it and left it to default
(TLS 1.3) too!

As a bonus, this change also removes the dead code handling of SSLv3
since that version can't be set anymore (since eff614fb0242cb).

Reported-by: Daniel Carpenter
Fixes #6998
Closes #7000

4 years agoopenldap: replace ldap_ prefix on private functions
Daniel Stenberg [Tue, 4 May 2021 14:14:13 +0000 (16:14 +0200)] 
openldap: replace ldap_ prefix on private functions

Since openldap itself uses that prefix and with OpenĹDAP 2.5.4 (at
least) there's a symbol collision because of that.

The private functions now use the 'oldap_' prefix where it previously
used 'ldap_'.

Reported-by: 3eka on github
Fixes #7004
Closes #7005

4 years agohttp2: fix potentially uninitialized variable
Jay Satiro [Wed, 5 May 2021 07:16:06 +0000 (03:16 -0400)] 
http2: fix potentially uninitialized variable

introduced several days ago in 3193170. caught by visual studio linker.

4 years agoSSL: support in-memory CA certs for some backends
Gilles Vollant [Mon, 13 Jul 2020 01:17:56 +0000 (03:17 +0200)] 
SSL: support in-memory CA certs for some backends

- New options CURLOPT_CAINFO_BLOB and CURLOPT_PROXY_CAINFO_BLOB to
  specify in-memory PEM certificates for OpenSSL, Schannel (Windows)
  and Secure Transport (Apple) SSL backends.

Prior to this change PEM certificates could only be imported from a file
and not from memory.

Co-authored-by: moparisthebest@users.noreply.github.com
Ref: https://github.com/curl/curl/pull/4679
Ref: https://github.com/curl/curl/pull/5677
Ref: https://github.com/curl/curl/pull/6109

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

4 years agotests: ignore case of chunked hex numbers in tests
David Cook [Tue, 4 May 2021 00:29:40 +0000 (19:29 -0500)] 
tests: ignore case of chunked hex numbers in tests

When hyper is used, it emits uppercase hexadecimal numbers for chunked
encoding lengths. Without hyper, lowercase hexadecimal numbers are used.
This change adds preprocessor statements to tests where this is an
issue, and adapts the fixtures to match.

Closes #6987

4 years agocmake: check for getppid and utimes
Daniel Stenberg [Tue, 4 May 2021 09:03:30 +0000 (11:03 +0200)] 
cmake: check for getppid and utimes

... as they're checked for in the configure script and are used by
source code.

Removed checks for perror, setvbuf and strlcat since those defines are
not checked for in source code.

Bonus: removed HAVE_STRLCPY from a few config-*.h files since that
symbol is not used in source code.

Closes #6997

4 years agolibtest: remove lib530.c
Daniel Stenberg [Tue, 4 May 2021 09:50:45 +0000 (11:50 +0200)] 
libtest: remove lib530.c

Follow up from e50a877df when test 530 was removed. Since then this
source file has not been used/needed.

Closes #6999

4 years agoFILEFORMAT: mention sectransp as a feature
Daniel Stenberg [Tue, 4 May 2021 12:07:01 +0000 (14:07 +0200)] 
FILEFORMAT: mention sectransp as a feature

Been supported since at least 40259ca65

Closes #7001

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 4 May 2021 08:27:35 +0000 (10:27 +0200)] 
RELEASE-NOTES: synced

4 years agolibssh2: ignore timeout during disconnect
Daniel Stenberg [Mon, 3 May 2021 11:21:15 +0000 (13:21 +0200)] 
libssh2: ignore timeout during disconnect

... to avoid memory leaks!

libssh2 is tricky as we have to deal with the non-blockiness even in
close and shutdown cases. In the cases when we shutdown after a timeout
already expired, it is crucial that curl doen't let the timeout abort
the shutdown process as that then leaks memory!

Reported-by: Benjamin Riefenstahl
Fixes #6990

4 years agoKNOWN_BUGS: add two HTTP/2 bugs
Daniel Stenberg [Mon, 3 May 2021 15:27:35 +0000 (17:27 +0200)] 
KNOWN_BUGS: add two HTTP/2 bugs

4 years agoKNOWN_BUGS: add three HTTP/3 issues
Daniel Stenberg [Mon, 3 May 2021 15:22:52 +0000 (17:22 +0200)] 
KNOWN_BUGS: add three HTTP/3 issues

... and moved the HTTP/2 issues to its own section

Closes #6606
Closes #6510
Closes #6494

4 years agoCURLcode: add CURLE_SSL_CLIENTCERT
ejanchivdorj [Thu, 11 Mar 2021 07:50:13 +0000 (23:50 -0800)] 
CURLcode: add CURLE_SSL_CLIENTCERT

When a TLS server requests a client certificate during handshake and
none can be provided, libcurl now returns this new error code
CURLE_SSL_CLIENTCERT

Only supported by Secure Transport and OpenSSL for TLS 1.3 so far.

Closes #6721

4 years ago.github/FUNDING: add link to GitHub sponsors
Tobias Gabriel [Fri, 30 Apr 2021 13:17:00 +0000 (15:17 +0200)] 
.github/FUNDING: add link to GitHub sponsors

Closes #6985

4 years agokrb5/name_to_level: replace checkprefix with curl_strequal
Harry Sintonen [Sun, 2 May 2021 21:13:41 +0000 (00:13 +0300)] 
krb5/name_to_level: replace checkprefix with curl_strequal

Closes #6993

4 years agoCurl_input_digest: require space after Digest
Harry Sintonen [Sun, 2 May 2021 21:07:57 +0000 (00:07 +0300)] 
Curl_input_digest: require space after Digest

Closes #6993

4 years agoCurl_http_header: check for colon when matching Persistent-Auth
Harry Sintonen [Sun, 2 May 2021 21:06:41 +0000 (00:06 +0300)] 
Curl_http_header: check for colon when matching Persistent-Auth

Closes #6993

4 years agoCurl_http_input_auth: require valid separator after negotiation type
Harry Sintonen [Sun, 2 May 2021 21:04:39 +0000 (00:04 +0300)] 
Curl_http_input_auth: require valid separator after negotiation type

Closes #6993

4 years agohttp: fix the check for 'Authorization' with Bearer
Daniel Stenberg [Sat, 1 May 2021 21:38:15 +0000 (23:38 +0200)] 
http: fix the check for 'Authorization' with Bearer

The code would wrongly check for it using an additional colon.

Reported-by: Blake Burkhart
Closes #6988

4 years agohttp2: fix a resource leak in push_promise()
Kamil Dudka [Fri, 30 Apr 2021 16:18:02 +0000 (18:18 +0200)] 
http2: fix a resource leak in push_promise()

... detected by Coverity:

Error: RESOURCE_LEAK (CWE-772):
lib/http2.c:532: alloc_fn: Storage is returned from allocation function "duphandle".
lib/http2.c:532: var_assign: Assigning: "newhandle" = storage returned from "duphandle(data)".
lib/http2.c:552: noescape: Resource "newhandle" is not freed or pointed-to in "set_transfer_url".
lib/http2.c:555: leaked_storage: Variable "newhandle" going out of scope leaks the storage it points to.

Closes #6986

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