diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-07-29 12:54:05 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-07-29 12:54:05 +0000 |
commit | f1fa7b8ba469d9b8681e30f107b44004695b32e9 (patch) | |
tree | 80542fd7f33b8d77ecb6f66ae13d9f3e32ed2cc9 /lib/sslgen.c | |
parent | 86ff3194fa902e131c7a105a329202058327dcc7 (diff) | |
download | curl-f1fa7b8ba469d9b8681e30f107b44004695b32e9.tar.gz |
Bug report #1759542 (http://curl.haxx.se/bug/view.cgi?id=1759542). A bad use
of a socket after it has been closed, when the FTP-SSL data connection is taken
down.
Diffstat (limited to 'lib/sslgen.c')
-rw-r--r-- | lib/sslgen.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/lib/sslgen.c b/lib/sslgen.c index 56f626ac2..b452d504f 100644 --- a/lib/sslgen.c +++ b/lib/sslgen.c @@ -435,46 +435,43 @@ void Curl_ssl_close_all(struct SessionHandle *data) #endif /* USE_SSL */ } -void Curl_ssl_close(struct connectdata *conn) +void Curl_ssl_close(struct connectdata *conn, int sockindex) { - if(conn->ssl[FIRSTSOCKET].use) { + DEBUGASSERT((sockindex <= 1) && (sockindex >= -1)); + #ifdef USE_SSLEAY - Curl_ossl_close(conn); + Curl_ossl_close(conn, sockindex); #endif /* USE_SSLEAY */ #ifdef USE_GNUTLS - Curl_gtls_close(conn); + Curl_gtls_close(conn, sockindex); #endif /* USE_GNUTLS */ #ifdef USE_NSS - Curl_nss_close(conn); + Curl_nss_close(conn, sockindex); #endif /* USE_NSS */ #ifdef USE_QSOSSL - Curl_qsossl_close(conn); + Curl_qsossl_close(conn, sockindex); #endif /* USE_QSOSSL */ - conn->ssl[FIRSTSOCKET].use = FALSE; - } } CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex) { - if(conn->ssl[sockindex].use) { #ifdef USE_SSLEAY - if(Curl_ossl_shutdown(conn, sockindex)) - return CURLE_SSL_SHUTDOWN_FAILED; + if(Curl_ossl_shutdown(conn, sockindex)) + return CURLE_SSL_SHUTDOWN_FAILED; #else #ifdef USE_GNUTLS - if(Curl_gtls_shutdown(conn, sockindex)) - return CURLE_SSL_SHUTDOWN_FAILED; + if(Curl_gtls_shutdown(conn, sockindex)) + return CURLE_SSL_SHUTDOWN_FAILED; #else #ifdef USE_QSOSSL - if(Curl_qsossl_shutdown(conn, sockindex)) - return CURLE_SSL_SHUTDOWN_FAILED; -#else - (void)conn; - (void)sockindex; + if(Curl_qsossl_shutdown(conn, sockindex)) + return CURLE_SSL_SHUTDOWN_FAILED; #endif /* USE_QSOSSL */ #endif /* USE_GNUTLS */ #endif /* USE_SSLEAY */ - } + + conn->ssl[sockindex].use = FALSE; /* get back to ordinary socket usage */ + return CURLE_OK; } |