ftp: remove bits.ftp_use_control_ssl

It's not needed since we can check the connection for SSL use.

Closes #21521
This commit is contained in:
Stefan Eissing 2026-05-07 10:00:10 +02:00 committed by Daniel Stenberg
parent fdd27a538c
commit ef3b7903aa
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 4 additions and 6 deletions

View file

@ -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 */

View file

@ -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 */