]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smtp: fix tx handling
authorVictor Julien <victor@inliniac.net>
Mon, 5 Jan 2015 12:17:51 +0000 (13:17 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 6 Jan 2015 13:01:16 +0000 (14:01 +0100)
Fix issue where SMTPStateGetTxCnt would return the actual active tx'.

The 'GetCnt' API call is not named correctly. It should be 'GetMaxId',
as this is actually the expected behavior.

src/app-layer-smtp.c

index 414a6e6721b6eddbb36c55ec0e07e04224d8bae5..91dd244c203f66d61d8dc07deb9709e6001f488c 100644 (file)
@@ -1254,20 +1254,13 @@ static void SMTPStateTransactionFree (void *state, uint64_t tx_id)
 
 }
 
-/** \todo slow */
+/** \retval cnt highest tx id */
 static uint64_t SMTPStateGetTxCnt(void *state)
 {
     uint64_t cnt = 0;
     SMTPState *smtp_state = state;
     if (smtp_state) {
-        SMTPTransaction *tx = NULL;
-
-        if (smtp_state->curr_tx == NULL)
-            return 0ULL;
-
-        TAILQ_FOREACH(tx, &smtp_state->tx_list, next) {
-            cnt++;
-        }
+        cnt = smtp_state->tx_cnt;
     }
     SCLogDebug("returning %"PRIu64, cnt);
     return cnt;