1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

Bug 2023: Response from ProFTPD FTP checksum commands is not recognized

https://winscp.net/tracker/2023
(cherry picked from commit 5e5921f3de)

Source commit: 76d9a2be927c0b2ca29667f6049ee04e719edede
This commit is contained in:
Martin Prikryl
2021-09-03 12:46:09 +00:00
parent c083c35e6b
commit 37c0decbaf

View File

@@ -1155,7 +1155,17 @@ UnicodeString __fastcall TFTPFileSystem::DoCalculateFileChecksum(
UnicodeString Command = FORMAT(L"%s %s", (CommandName, FileName));
SendCommand(Command);
UnicodeString ResponseText = GotReply(WaitForCommandReply(), REPLY_2XX_CODE | REPLY_SINGLE_LINE);
TStrings * Response;
GotReply(WaitForCommandReply(), REPLY_2XX_CODE, EmptyStr, NULL, &Response);
UnicodeString ResponseText;
if (DebugAlwaysTrue(Response->Count > 0))
{
// ProFTPD response has this format:
// 213-Computing MD5 digest
// 213 MD5 0-687104 b359479cfda703b7fd473c7e09f39049 filename
ResponseText = Response->Strings[Response->Count - 1];
}
delete Response;
UnicodeString Hash;
if (UsingHashCommand)
@@ -1204,7 +1214,7 @@ UnicodeString __fastcall TFTPFileSystem::DoCalculateFileChecksum(
if (Hash.IsEmpty())
{
throw Exception(FMTLOAD(FTP_RESPONSE_ERROR, (CommandName, ResponseText)));
throw Exception(FMTLOAD(FTP_RESPONSE_ERROR, (CommandName, FLastResponse->Text)));
}
return LowerCase(Hash);