diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-13 14:50:38 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-13 14:50:38 +0100 |
commit | 2c866f828334a0291b5d90763a09952adcb56c13 (patch) | |
tree | 7cf9a91afa5d06f31776e06e865417fcbb6fa939 /src/libutil/multipattern.c | |
parent | 79e437a712efba0d901c9b9d7c8c82e4d1283260 (diff) | |
download | rspamd-2c866f828334a0291b5d90763a09952adcb56c13.tar.gz rspamd-2c866f828334a0291b5d90763a09952adcb56c13.zip |
[Feature] Match the beginning of pattern as well
Diffstat (limited to 'src/libutil/multipattern.c')
-rw-r--r-- | src/libutil/multipattern.c | 9 |
1 files changed, 6 insertions, 3 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; |