mirror of
https://github.com/OISF/suricata.git
synced 2026-10-11 22:09:53 +00:00
smtp: apply max-tx to live txs
Instead of the cumulative tx count Ticket: 9038
This commit is contained in:
committed by
Victor Julien
parent
8461e3f3e7
commit
04c066977a
@@ -549,7 +549,7 @@ static void SMTPSetEvent(SMTPState *s, uint8_t e)
|
||||
|
||||
static SMTPTransaction *SMTPTransactionCreate(SMTPState *state)
|
||||
{
|
||||
if (state->tx_cnt > smtp_config.max_tx) {
|
||||
if (state->nb_live_tx >= smtp_config.max_tx) {
|
||||
return NULL;
|
||||
}
|
||||
SMTPTransaction *tx = SCCalloc(1, sizeof(*tx));
|
||||
@@ -1333,6 +1333,7 @@ static int SMTPProcessRequest(
|
||||
return -1;
|
||||
state->curr_tx = tx;
|
||||
TAILQ_INSERT_TAIL(&state->tx_list, tx, next);
|
||||
state->nb_live_tx++;
|
||||
tx->tx_id = state->tx_cnt++;
|
||||
|
||||
/* keep track of the start of the tx */
|
||||
@@ -2009,6 +2010,7 @@ static void SMTPStateTransactionFree (void *state, uint64_t tx_id)
|
||||
if (tx == smtp_state->curr_tx)
|
||||
smtp_state->curr_tx = NULL;
|
||||
TAILQ_REMOVE(&smtp_state->tx_list, tx, next);
|
||||
smtp_state->nb_live_tx--;
|
||||
SMTPTransactionFree(tx, state);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@ typedef struct SMTPState_ {
|
||||
AppLayerStateData state_data;
|
||||
SMTPTransaction *curr_tx;
|
||||
TAILQ_HEAD(, SMTPTransaction_) tx_list; /**< transaction list */
|
||||
uint64_t nb_live_tx;
|
||||
uint64_t tx_cnt;
|
||||
uint64_t toserver_data_count;
|
||||
uint64_t toserver_last_data_stamp;
|
||||
|
||||
Reference in New Issue
Block a user