int match = 0;
int store_de_state = 0;
uint8_t direction = (flags & STREAM_TOSERVER) ? 0 : 1;
+ /* this was introduced later to allow protocols that had both app
+ * keywords with transaction keywords. Without this we would
+ * assume that we have an alert if engine == NULL */
+ int total_matches = 0;
int alert_cnt = 0;
tx_id = AppLayerTransactionGetInspectId(f, flags);
total_txs = AppLayerGetTxCnt(alproto, htp_state);
for (; tx_id < total_txs; tx_id++) {
+ total_matches = 0;
tx = AppLayerGetTx(alproto, alstate, tx_id);
if (tx == NULL)
continue;
if (match == 1) {
inspect_flags |= engine->inspect_flags;
engine = engine->next;
+ total_matches++;
continue;
} else if (match == 2) {
inspect_flags |= DE_STATE_FLAG_SIG_CANT_MATCH;
/* all the engines seem to be exhausted at this point. If we
* didn't have a match in one of the engines we would have
* broken off and engine wouldn't be NULL. Hence the alert. */
- if (engine == NULL)
+ if (engine == NULL && total_matches > 0)
alert_cnt++;
if (tx_id == (total_txs - 1)) {
uint64_t total_txs = 0;
uint8_t alproto_supports_txs = 0;
uint8_t reset_de_state = 0;
+ /* this was introduced later to allow protocols that had both app
+ * keywords with transaction keywords. Without this we would
+ * assume that we have an alert if engine == NULL */
+ uint8_t total_matches = 0;
uint8_t direction = (flags & STREAM_TOSERVER) ? 0 : 1;
DeStateResetFileInspection(f, alproto, alstate, flags);
store_cnt < DE_STATE_CHUNK_SIZE && state_cnt < dir_state->cnt;
store_cnt++, state_cnt++)
{
+ total_matches = 0;
DeStateStoreItem *item = &store->store[store_cnt];
Signature *s = de_ctx->sig_array[item->sid];
if (match == 1) {
inspect_flags |= engine->inspect_flags;
engine = engine->next;
+ total_matches++;
continue;
} else if (match == 2) {
inspect_flags |= DE_STATE_FLAG_SIG_CANT_MATCH;
}
engine = engine->next;
}
- if (engine == NULL || inspect_flags & DE_STATE_FLAG_SIG_CANT_MATCH) {
+ if (total_matches > 0 && (engine == NULL || inspect_flags & DE_STATE_FLAG_SIG_CANT_MATCH)) {
if (engine == NULL)
alert = 1;
inspect_flags |= DE_STATE_FLAG_FULL_INSPECT;