aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-14 17:27:18 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-14 17:28:19 +0000
commitec6e8f945f6a1fb6a2efc2bd17b3545cd7b3b3b6 (patch)
treeda63a2729491dd1546a6b08ae473443d6e7d5ed1 /src
parent9b2e2d70a83c5c679f917253bcdb733d4bbbe705 (diff)
downloadrspamd-ec6e8f945f6a1fb6a2efc2bd17b3545cd7b3b3b6.tar.gz
rspamd-ec6e8f945f6a1fb6a2efc2bd17b3545cd7b3b3b6.zip
[Minor] Use new logic of regexp escaping
Diffstat (limited to 'src')
-rw-r--r--src/libutil/multipattern.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c
index e4a39d5fe..c1d0d6499 100644
--- a/src/libutil/multipattern.c
+++ b/src/libutil/multipattern.c
@@ -116,11 +116,11 @@ rspamd_multipattern_escape_tld_hyperscan (const gchar *pattern, gsize slen,
p ++;
}
- prefix = "\\..*\\.";
+ prefix = ".*";
}
else {
len = slen + 2;
- prefix = "\\.";
+ prefix = ".";
p = pattern;
}
@@ -200,11 +200,18 @@ rspamd_multipattern_pattern_filter (const gchar *pattern, gsize len,
}
if (flags & RSPAMD_MULTIPATTERN_TLD) {
- ret = rspamd_multipattern_escape_tld_hyperscan (pattern, len, dst_len);
+ gchar *tmp;
+ gsize tlen;
+ tmp = rspamd_multipattern_escape_tld_hyperscan (pattern, len, &tlen);
+
+ ret = rspamd_str_regexp_escape (tmp, tlen, dst_len,
+ gl_flags|RSPAMD_REGEXP_ESCAPE_GLOB);
+ g_free (tmp);
}
else if (flags & RSPAMD_MULTIPATTERN_RE) {
ret = malloc (len + 1);
- *dst_len = rspamd_strlcpy (ret, pattern, len + 1);
+ ret = rspamd_str_regexp_escape (pattern, len, dst_len, gl_flags |
+ RSPAMD_REGEXP_ESCAPE_RE);
}
else if (flags & RSPAMD_MULTIPATTERN_GLOB) {
ret = rspamd_str_regexp_escape (pattern, len, dst_len,