aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-05 16:51:36 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-05 16:51:36 +0000
commit988cb2cc8399b16042f06108954af9abf4cf46a5 (patch)
tree6f4bddad48882ea75770855211c9ab42ad43861a /src
parent875f14fae4c720d255f90562c4ecdbb2827ac00b (diff)
downloadrspamd-988cb2cc8399b16042f06108954af9abf4cf46a5.tar.gz
rspamd-988cb2cc8399b16042f06108954af9abf4cf46a5.zip
Implement match.
Diffstat (limited to 'src')
-rw-r--r--src/libutil/regexp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 57515703e..06555f57f 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -327,7 +327,7 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len,
*start = mt + ovec[0];
}
if (end) {
- *end = mt + ovec[1];
+ *end = mt + ovec[0] + ovec[1];
}
return TRUE;
@@ -340,9 +340,17 @@ gboolean
rspamd_regexp_match (rspamd_regexp_t *re, const gchar *text, gsize len,
gboolean raw)
{
+ const gchar *start = NULL, *end = NULL;
+
g_assert (re != NULL);
g_assert (text != NULL);
+ if (rspamd_regexp_search (re, text, len, &start, &end, raw)) {
+ if (start == text && end == text + len) {
+ return TRUE;
+ }
+ }
+
return FALSE;
}