From: Philippe Antoine Date: Mon, 16 Mar 2020 13:48:40 +0000 (+0100) Subject: ftp: FTPGetAlstateProgress for done port commands X-Git-Tag: suricata-5.0.3~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b557972fb646c5a9edccc2a4fad81150f782c23e;p=thirdparty%2Fsuricata.git ftp: FTPGetAlstateProgress for done port commands For a done transaction with command PORT, we expect FTP_STATE_FINISHED and we got FTP_STATE_PORT_DONE instead which prevented logging of these transactions We change the order of the evaluations to get the right result (cherry picked from commit 6f36403219687b1bbcb667078a57c1c9d4aed185) --- diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index ee17f24d46..782ea691b1 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -997,13 +997,13 @@ static int FTPGetAlstateProgress(void *vtx, uint8_t direction) SCLogDebug("tx %p", vtx); FTPTransaction *tx = vtx; - if (direction == STREAM_TOSERVER && - tx->command_descriptor->command == FTP_COMMAND_PORT) { - return FTP_STATE_PORT_DONE; - } - - if (!tx->done) + if (!tx->done) { + if (direction == STREAM_TOSERVER && + tx->command_descriptor->command == FTP_COMMAND_PORT) { + return FTP_STATE_PORT_DONE; + } return FTP_STATE_IN_PROGRESS; + } return FTP_STATE_FINISHED; }