]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ftp: FTPGetAlstateProgress for done port commands
authorPhilippe Antoine <contact@catenacyber.fr>
Mon, 16 Mar 2020 13:48:40 +0000 (14:48 +0100)
committerJeff Lucovsky <jeff@lucovsky.org>
Wed, 22 Apr 2020 11:53:28 +0000 (07:53 -0400)
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)

src/app-layer-ftp.c

index ee17f24d46036a3d3fb0d975fb0ac1a655903064..782ea691b1e5a61f2e6749b435330432a0243444 100644 (file)
@@ -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;
 }