From ef3b7903aa7cc45cf012a3f222f102414e4c5037 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Thu, 7 May 2026 10:00:10 +0200 Subject: [PATCH] ftp: remove bits.ftp_use_control_ssl It's not needed since we can check the connection for SSL use. Closes #21521 --- lib/ftp.c | 9 ++++----- lib/urldata.h | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/ftp.c b/lib/ftp.c index ccc171837c..691578699b 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -2905,7 +2905,7 @@ static CURLcode ftp_state_loggedin(struct Curl_easy *data, { CURLcode result = CURLE_OK; - if(data->conn->bits.ftp_use_control_ssl) { + if(Curl_conn_is_ssl(data->conn, FIRSTSOCKET)) { /* PBSZ = PROTECTION BUFFER SIZE. The 'draft-murray-auth-ftp-ssl' (draft 12, page 7) says: @@ -3117,7 +3117,7 @@ static CURLcode ftp_wait_resp(struct Curl_easy *data, if(ftpcode == 230) { /* 230 User logged in - already! Take as 220 if TLS required. */ if(data->set.use_ssl <= CURLUSESSL_TRY || - conn->bits.ftp_use_control_ssl) + Curl_conn_is_ssl(conn, FIRSTSOCKET)) return ftp_state_user_resp(data, ftpc, ftpcode); } else if(ftpcode != 220) { @@ -3126,7 +3126,7 @@ static CURLcode ftp_wait_resp(struct Curl_easy *data, return CURLE_WEIRD_SERVER_REPLY; } - if(data->set.use_ssl && !conn->bits.ftp_use_control_ssl) { + if(data->set.use_ssl && !Curl_conn_is_ssl(conn, FIRSTSOCKET)) { /* We do not have an SSL/TLS control connection yet, but FTPS is requested. Try an FTPS connection now */ @@ -3204,10 +3204,10 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data, return CURLE_USE_SSL_FAILED; } } + /* BLOCKING */ result = Curl_conn_connect(data, FIRSTSOCKET, TRUE, &done); if(!result) { conn->bits.ftp_use_data_ssl = FALSE; /* clear-text data */ - conn->bits.ftp_use_control_ssl = TRUE; /* SSL on control */ result = ftp_state_user(data, ftpc, conn); } } @@ -3527,7 +3527,6 @@ static CURLcode ftp_connect(struct Curl_easy *data, result = Curl_conn_connect(data, FIRSTSOCKET, TRUE, done); if(result) return result; - conn->bits.ftp_use_control_ssl = TRUE; } Curl_pp_init(pp, Curl_pgrs_now(data)); /* once per transfer */ diff --git a/lib/urldata.h b/lib/urldata.h index 8dec816a16..c06865feee 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -275,7 +275,6 @@ struct ConnectBits { EPRT does not work we disable it for the forthcoming requests */ BIT(ftp_use_data_ssl); /* Enabled SSL for the data connection */ - BIT(ftp_use_control_ssl); /* Enabled SSL for the control connection */ #endif #ifndef CURL_DISABLE_NETRC BIT(netrc); /* name+password provided by netrc */