From fef38a0898322f285401c5ff2f5e7c90dbf3be63 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Wed, 6 Feb 2019 10:29:14 +0100 Subject: INTERNALS.md: fix subsection depth and link The Kerberos subsection was mistakenly a subsubsection under FTP, and the curlx subsection was missing an anchor for the TOC link. Closes #3529 Reviewed-by: Daniel Stenberg --- docs/INTERNALS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/INTERNALS.md b/docs/INTERNALS.md index 1633e59ff..69b92d4e2 100644 --- a/docs/INTERNALS.md +++ b/docs/INTERNALS.md @@ -314,7 +314,7 @@ FTP Kerberos --------- +======== Kerberos support is mainly in lib/krb5.c and lib/security.c but also `curl_sasl_sspi.c` and `curl_sasl_gssapi.c` for the email protocols and @@ -590,6 +590,7 @@ Asynchronous name resolves options that end with LARGE. The type is 64bit large on most modern platforms. + curlx ===== -- cgit v1.2.3 From 927a5bd1b4f95fe2331c9d9923c620ba8e274d6c Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Tue, 5 Feb 2019 21:56:36 -0800 Subject: url: close TLS before removing conn from cache - Fix potential crashes in schannel shutdown. Ensure any TLS shutdown messages are sent before removing the association between the connection and the easy handle. Reverts @bagder's previous partial fix for #3412. Fixes https://github.com/curl/curl/issues/3412 Fixes https://github.com/curl/curl/issues/3505 Closes https://github.com/curl/curl/pull/3531 --- lib/url.c | 9 ++++----- lib/vtls/schannel.c | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/url.c b/lib/url.c index d5a982008..73f7f861b 100644 --- a/lib/url.c +++ b/lib/url.c @@ -788,8 +788,11 @@ CURLcode Curl_disconnect(struct Curl_easy *data, /* This is set if protocol-specific cleanups should be made */ conn->handler->disconnect(conn, dead_connection); - /* unlink ourselves! */ infof(data, "Closing connection %ld\n", conn->connection_id); + Curl_ssl_close(conn, FIRSTSOCKET); + Curl_ssl_close(conn, SECONDARYSOCKET); + + /* unlink ourselves! */ Curl_conncache_remove_conn(data, conn, TRUE); free_idnconverted_hostname(&conn->host); @@ -797,10 +800,6 @@ CURLcode Curl_disconnect(struct Curl_easy *data, free_idnconverted_hostname(&conn->http_proxy.host); free_idnconverted_hostname(&conn->socks_proxy.host); - /* this assumes that the pointer is still there after the connection was - detected from the cache */ - Curl_ssl_close(conn, FIRSTSOCKET); - conn_free(conn); return CURLE_OK; } diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index c8574f56c..7e5d19b20 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -1960,6 +1960,8 @@ static int Curl_schannel_shutdown(struct connectdata *conn, int sockindex) char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name : conn->host.name; + DEBUGASSERT(data); + infof(data, "schannel: shutting down SSL/TLS connection with %s port %hu\n", hostname, conn->remote_port); @@ -2035,11 +2037,9 @@ static int Curl_schannel_shutdown(struct connectdata *conn, int sockindex) * might not have an associated transfer so the check for conn->data is * necessary. */ - if(conn->data) - Curl_ssl_sessionid_lock(conn); + Curl_ssl_sessionid_lock(conn); Curl_schannel_session_free(BACKEND->cred); - if(conn->data) - Curl_ssl_sessionid_unlock(conn); + Curl_ssl_sessionid_unlock(conn); BACKEND->cred = NULL; } -- cgit v1.2.3 From 91e397b24297055fdc49916b5ce901d63745dd5e Mon Sep 17 00:00:00 2001 From: Marcel Raad Date: Wed, 6 Feb 2019 14:59:15 +0100 Subject: tool_operate: fix typecheck warning Use long for CURLOPT_HTTP09_ALLOWED to fix the following warning: tool_operate.c: In function 'operate_do': ../include/curl/typecheck-gcc.h:47:9: error: call to '_curl_easy_setopt_err_long' declared with attribute warning: curl_easy_setopt expects a long argument for this option [-Werror] Closes https://github.com/curl/curl/pull/3534 --- src/tool_operate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tool_operate.c b/src/tool_operate.c index 4516c8e6a..7d58dde27 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -1006,7 +1006,8 @@ static CURLcode operate_do(struct GlobalConfig *global, if(config->tr_encoding) my_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1L); /* new in libcurl 7.64.0 */ - my_setopt(curl, CURLOPT_HTTP09_ALLOWED, config->http09_allowed); + my_setopt(curl, CURLOPT_HTTP09_ALLOWED, + config->http09_allowed ? 1L : 0L); } /* (built_in_protos & CURLPROTO_HTTP) */ -- cgit v1.2.3 From dbd32f3241b297b96ee11a51da1a661f528ca026 Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Tue, 5 Feb 2019 20:44:14 +0000 Subject: zsh.pl: update regex to better match curl -h output The current regex fails to match '<...>' arguments properly (e.g. those with spaces in them), which causes an completion script with wrong descriptions for some options. Here's a diff of the generated completion script, comparing the previous version to the one with this fix: --- /usr/share/zsh/vendor-completions/_curl 2019-01-15 20:47:40.000000000 +0000 +++ _curl 2019-02-05 20:57:29.453349040 +0000 @@ -9,48 +9,48 @@ _arguments -C -S \ --happy-eyeballs-timeout-ms'[How long to wait in milliseconds for IPv6 before trying IPv4]':'' \ + --resolve'[Resolve the host+port to this address]':'' \ {-c,--cookie-jar}'[Write cookies to after operation]':'':_files \ {-D,--dump-header}'[Write the received headers to ]':'':_files \ {-y,--speed-time}'[Trigger '\''speed-limit'\'' abort after this time]':'' \ --proxy-cacert'[CA certificate to verify peer against for proxy]':'':_files \ - --tls13-ciphers'[of TLS 1.3 ciphersuites> TLS 1.3 cipher suites to use]':'' \ {-E,--cert}'[Client certificate file and password]':'' \ --libcurl'[Dump libcurl equivalent code of this command line]':'':_files \ --proxy-capath'[CA directory to verify peer against for proxy]':'':_files \ - --proxy-negotiate'[HTTP Negotiate (SPNEGO) authentication on the proxy]':'Use' \ --proxy-pinnedpubkey'[FILE/HASHES public key to verify proxy with]':'' \ --crlfile'[Get a CRL list in PEM format from the given file]':'':_files \ - --proxy-insecure'[HTTPS proxy connections without verifying the proxy]':'Do' \ - --proxy-ssl-allow-beast'[security flaw for interop for HTTPS proxy]':'Allow' \ + --proxy-negotiate'[Use HTTP Negotiate (SPNEGO) authentication on the proxy]' \ --abstract-unix-socket'[Connect via abstract Unix domain socket]':'' \ --pinnedpubkey'[FILE/HASHES Public key to verify peer against]':'' \ + --proxy-insecure'[Do HTTPS proxy connections without verifying the proxy]' \ --proxy-pass'[Pass phrase for the private key for HTTPS proxy]':'' \ + --proxy-ssl-allow-beast'[Allow security flaw for interop for HTTPS proxy]' \ {-p,--proxytunnel}'[Operate through an HTTP proxy tunnel (using CONNECT)]' \ --socks5-hostname'[SOCKS5 proxy, pass host name to proxy]':'' \ --proto-default'[Use PROTOCOL for any URL missing a scheme]':'' \ - --proxy-tls13-ciphers'[list> TLS 1.3 proxy cipher suites]':'' \ --socks5-gssapi-service'[SOCKS5 proxy service name for GSS-API]':'' \ --ftp-alternative-to-user'[String to replace USER \[name\]]':'' \ - --ftp-ssl-control'[SSL/TLS for FTP login, clear for transfer]':'Require' \ {-T,--upload-file}'[Transfer local FILE to destination]':'':_files \ --local-port'[Force use of RANGE for local port numbers]':'' \ --proxy-tlsauthtype'[TLS authentication type for HTTPS proxy]':'' \ {-R,--remote-time}'[Set the remote file'\''s time on the local output]' \ - --retry-connrefused'[on connection refused (use with --retry)]':'Retry' \ - --suppress-connect-headers'[proxy CONNECT response headers]':'Suppress' \ - {-j,--junk-session-cookies}'[session cookies read from file]':'Ignore' \ - --location-trusted'[--location, and send auth to other hosts]':'Like' \ + --ftp-ssl-control'[Require SSL/TLS for FTP login, clear for transfer]' \ --proxy-cert-type'[Client certificate type for HTTPS proxy]':'' \ {-O,--remote-name}'[Write output to a file named as the remote file]' \ + --retry-connrefused'[Retry on connection refused (use with --retry)]' \ + --suppress-connect-headers'[Suppress proxy CONNECT response headers]' \ --trace-ascii'[Like --trace, but without hex output]':'':_files \ --connect-timeout'[Maximum time allowed for connection]':'' \ --expect100-timeout'[How long to wait for 100-continue]':'' \ {-g,--globoff}'[Disable URL sequences and ranges using {} and \[\]]' \ + {-j,--junk-session-cookies}'[Ignore session cookies read from file]' \ {-m,--max-time}'[Maximum time allowed for the transfer]':'' \ --dns-ipv4-addr'[IPv4 address to use for DNS requests]':'
' \ --dns-ipv6-addr'[IPv6 address to use for DNS requests]':'
' \ - --ignore-content-length'[the size of the remote resource]':'Ignore' \ {-k,--insecure}'[Allow insecure server connections when using SSL]' \ + --location-trusted'[Like --location, and send auth to other hosts]' \ --mail-auth'[Originator address of the original email]':'
' \ --noproxy'[List of hosts which do not use proxy]':'' \ --proto-redir'[Enable/disable PROTOCOLS on redirect]':'' \ @@ -62,18 +62,19 @@ --socks5-basic'[Enable username/password auth for SOCKS5 proxies]' \ --cacert'[CA certificate to verify peer against]':'':_files \ {-H,--header}'[Pass custom header(s) to server]':'
' \ + --ignore-content-length'[Ignore the size of the remote resource]' \ {-i,--include}'[Include protocol response headers in the output]' \ --proxy-header'[Pass custom header(s) to proxy]':'
' \ --unix-socket'[Connect through this Unix domain socket]':'' \ {-w,--write-out}'[Use output FORMAT after completion]':'' \ - --http2-prior-knowledge'[HTTP 2 without HTTP/1.1 Upgrade]':'Use' \ {-o,--output}'[Write to file instead of stdout]':'':_files \ - {-J,--remote-header-name}'[the header-provided filename]':'Use' \ + --preproxy'[\[protocol://\]host\[:port\] Use this proxy first]' \ --socks4a'[SOCKS4a proxy on given host + port]':'' \ {-Y,--speed-limit}'[Stop transfers slower than this]':'' \ {-z,--time-cond}'[Transfer based on a time condition]':'