summaryrefslogtreecommitdiff
path: root/lib/vtls/schannel.c
diff options
context:
space:
mode:
authorChris Araman <chris.araman@fuze.com>2019-02-05 21:56:36 -0800
committerJay Satiro <raysatiro@yahoo.com>2019-02-06 13:33:21 -0500
commit927a5bd1b4f95fe2331c9d9923c620ba8e274d6c (patch)
tree1f60698f8a8f6c7da3d69d45e48a0c5721483e62 /lib/vtls/schannel.c
parentfef38a0898322f285401c5ff2f5e7c90dbf3be63 (diff)
downloadcurl-927a5bd1b4f95fe2331c9d9923c620ba8e274d6c.tar.gz
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
Diffstat (limited to 'lib/vtls/schannel.c')
-rw-r--r--lib/vtls/schannel.c8
1 files changed, 4 insertions, 4 deletions
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;
}