]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ftp: per direction tx progress
authorVictor Julien <vjulien@oisf.net>
Thu, 1 May 2025 21:47:00 +0000 (23:47 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 2 May 2025 18:10:07 +0000 (20:10 +0200)
For request side, having a tx means the request is done.

For response, wait for tx to be marked complete.

Remove unused states.

rust/src/ftp/constant.rs
src/app-layer-ftp.c

index f9ea4fde8f7b0c94f7ccae5caf35b86d63f51f79..94bea4f5c84a80a4eed3e6fcb34a030648de10e1 100644 (file)
@@ -19,9 +19,7 @@
 #[repr(u8)]
 #[allow(non_camel_case_types)]
 pub enum FtpStateValues {
-    FTP_STATE_NONE,
     FTP_STATE_IN_PROGRESS,
-    FTP_STATE_PORT_DONE,
     FTP_STATE_FINISHED,
 }
 // FTP Data progress values
index 4823b5a2d6b742d6e40c23cf499715315dd6ff16..1265355ed8efd8e19a818d392206c11190d10d02 100644 (file)
@@ -889,11 +889,11 @@ static int FTPGetAlstateProgress(void *vtx, uint8_t direction)
     SCLogDebug("tx %p", vtx);
     FTPTransaction *tx = vtx;
 
+    /* having a tx implies request side is done */
+    if (direction == STREAM_TOSERVER) {
+        return FTP_STATE_FINISHED;
+    }
     if (!tx->done) {
-        if (direction == STREAM_TOSERVER &&
-                tx->command_descriptor.command_code == FTP_COMMAND_PORT) {
-            return FTP_STATE_PORT_DONE;
-        }
         return FTP_STATE_IN_PROGRESS;
     }