mirror of
https://github.com/kingk85/uFTP.git
synced 2025-07-25 13:16:12 +03:00
fix: CCC Command RFC
This commit is contained in:
@ -447,20 +447,29 @@ int parseCommandCcc(ftpDataType *data, int socketId)
|
|||||||
int returnCode;
|
int returnCode;
|
||||||
|
|
||||||
#ifdef OPENSSL_ENABLED
|
#ifdef OPENSSL_ENABLED
|
||||||
|
if (!data->clients[socketId].tlsIsEnabled) {
|
||||||
|
returnCode = socketPrintf(data, socketId, "s", "533 Control connection not encrypted\r\n");
|
||||||
|
if (returnCode <= 0) {
|
||||||
|
LOG_ERROR("socketPrintfError");
|
||||||
|
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
||||||
|
}
|
||||||
|
return FTP_COMMAND_PROCESSED;
|
||||||
|
}
|
||||||
|
|
||||||
returnCode = socketPrintf(data, socketId, "s", "200 TLS connection aborted\r\n");
|
returnCode = socketPrintf(data, socketId, "s", "200 Control connection switched to plaintext\r\n");
|
||||||
SSL_set_shutdown(data->clients[socketId].ssl, SSL_SENT_SHUTDOWN);
|
|
||||||
data->clients[socketId].tlsIsEnabled = 0;
|
|
||||||
|
|
||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
{
|
{
|
||||||
LOG_ERROR("socketPrintfError");
|
LOG_ERROR("socketPrintfError");
|
||||||
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SSL_shutdown(data->clients[socketId].ssl); // Clean shutdown
|
||||||
|
data->clients[socketId].tlsIsEnabled = 0; // Mark as plaintext
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_ENABLED
|
#ifndef OPENSSL_ENABLED
|
||||||
returnCode = socketPrintf(data, socketId, "s", "502 command not supported\r\n");
|
returnCode = socketPrintf(data, socketId, "s", "502 Command not supported\r\n");
|
||||||
|
|
||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user