From a8e693eb5915fc9b6a9c4831956910652c62f4ce Mon Sep 17 00:00:00 2001 From: "huheng@kylinos.cn" Date: Wed, 26 Oct 2022 14:04:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(ftp):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加被删除的消息处理 --- .../ftpserver/fineftp-server/src/ftp_session.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/filetransfer/ftpserver/fineftp-server/src/ftp_session.cpp b/filetransfer/ftpserver/fineftp-server/src/ftp_session.cpp index f86b438..46b6d7a 100755 --- a/filetransfer/ftpserver/fineftp-server/src/ftp_session.cpp +++ b/filetransfer/ftpserver/fineftp-server/src/ftp_session.cpp @@ -347,12 +347,6 @@ void FtpSession::handleFtpCommandPASV(const std::string & /*param*/) auto ip_bytes = command_socket_.local_endpoint().address().to_v4().to_bytes(); auto port = data_acceptor_.local_endpoint().port(); - // Form reply string - std::stringstream stream; - stream << "("; - for (size_t i = 0; i < 4; i++) { - stream << static_cast(ip_bytes[i]) << ","; - } std::ifstream file; file.open(DEVICEID_FILE_LOACLPATH, std::ios_base::in); @@ -370,6 +364,14 @@ void FtpSession::handleFtpCommandPASV(const std::string & /*param*/) } file.close(); + // Form reply string + std::stringstream stream; + stream << "("; + for (size_t i = 0; i < 4; i++) { + stream << static_cast(ip_bytes[i]) << ","; + } + stream << ((port >> 8) & 0xff) << "," << (port & 0xff) << ")"; + sendFtpMessage(FtpReplyCode::ENTERING_PASSIVE_MODE, "Entering passive mode " + stream.str()); return; } // namespace fineftp