ac_trie_t *t;
GArray *pats;
GArray *res;
+ unsigned int acism_id_offset; /* ID offset for ACISM patterns (for mixed multipatterns) */
gboolean compiled;
unsigned int cnt;
/* Create pats array on demand for ACISM fallback */
if (mp->pats == NULL) {
mp->pats = g_array_new(FALSE, TRUE, sizeof(ac_trie_pat_t));
+ /* Record ID offset: first TLD pattern gets current cnt as its ID */
+ mp->acism_id_offset = mp->cnt;
}
acism_pat.ptr = rspamd_multipattern_escape_tld_acism(pattern, patlen, &dlen);
return FALSE;
}
+ /* Register the file so it won't be cleaned up */
+ rspamd_hyperscan_notice_known(fp);
+
return TRUE;
}
struct rspamd_multipattern_cbdata *cbd = context;
int ret;
ac_trie_pat_t pat;
+ unsigned int actual_id;
pat = g_array_index(cbd->mp->pats, ac_trie_pat_t, strnum);
- ret = cbd->cb(cbd->mp, strnum, textpos - pat.len,
+ /* Adjust pattern ID by offset for mixed multipatterns */
+ actual_id = strnum + cbd->mp->acism_id_offset;
+ ret = cbd->cb(cbd->mp, actual_id, textpos - pat.len,
textpos, cbd->in, cbd->len, cbd->ud);
cbd->nfound++;