]> 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)
committerVictor Julien <victor@inliniac.net>
Mon, 20 Apr 2020 12:31:07 +0000 (14:31 +0200)
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

src/app-layer-ftp.c

index e294069b8e009b7f95a0d361c9e60892e8a79403..2a9c191ecb10177aeb04b051bee1b8782f4c54f0 100644 (file)
@@ -996,13 +996,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;
 }