diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/multipattern.c | 9 | ||||
-rw-r--r-- | src/libutil/multipattern.h | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c index 229ef2a9b..15c0d641b 100644 --- a/src/libutil/multipattern.c +++ b/src/libutil/multipattern.c @@ -392,7 +392,7 @@ rspamd_multipattern_add_pattern (struct rspamd_multipattern *mp, #ifdef WITH_HYPERSCAN gchar *np; - gint fl = 0; + gint fl = HS_FLAG_SOM_LEFTMOST; if (mp->flags & RSPAMD_MULTIPATTERN_ICASE) { fl |= HS_FLAG_CASELESS; @@ -501,7 +501,7 @@ rspamd_multipattern_hs_cb (unsigned int id, struct rspamd_multipattern_cbdata *cbd = ud; gint ret; - ret = cbd->cb (cbd->mp, id, to, cbd->in, cbd->len, cbd->ud); + ret = cbd->cb (cbd->mp, id, from, to, cbd->in, cbd->len, cbd->ud); cbd->nfound ++; cbd->ret = ret; @@ -514,8 +514,11 @@ rspamd_multipattern_acism_cb (int strnum, int textpos, void *context) { struct rspamd_multipattern_cbdata *cbd = context; gint ret; + ac_trie_pat_t pat; - ret = cbd->cb (cbd->mp, strnum, textpos, cbd->in, cbd->len, cbd->ud); + pat = g_array_index (cbd->mp->pats, ac_trie_pat_t, strnum); + ret = cbd->cb (cbd->mp, strnum, textpos - pat.len, + textpos, cbd->in, cbd->len, cbd->ud); cbd->nfound ++; cbd->ret = ret; diff --git a/src/libutil/multipattern.h b/src/libutil/multipattern.h index c27977159..345bfe33f 100644 --- a/src/libutil/multipattern.h +++ b/src/libutil/multipattern.h @@ -50,7 +50,8 @@ struct rspamd_multipattern; */ typedef gint (*rspamd_multipattern_cb_t) (struct rspamd_multipattern *mp, guint strnum, - gint textpos, + gint match_start, + gint match_pos, const gchar *text, gsize len, void *context); |