diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-02-25 17:01:00 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-02-25 17:01:00 +0000 |
commit | 4184776a1744bfa1e73eac80e8126573d8aae0f0 (patch) | |
tree | 918cbd83df5a16eb4d88ce0b493dc71a171b67e6 /src | |
parent | a8d97d481aea7fc2acc88055c82431d5e736c817 (diff) | |
download | rspamd-4184776a1744bfa1e73eac80e8126573d8aae0f0.tar.gz rspamd-4184776a1744bfa1e73eac80e8126573d8aae0f0.zip |
[Fix] Fix tld compositon rules
Issue: #3248, #3268
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/url.c | 7 | ||||
-rw-r--r-- | src/libutil/multipattern.c | 10 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c index dcf13cfda..0407490d8 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -442,7 +442,6 @@ rspamd_url_parse_tld_file (const gchar *fname, flags = URL_FLAG_NOHTML | URL_FLAG_TLD_MATCH; -#ifndef WITH_HYPERSCAN if (linebuf[0] == '*') { flags |= URL_FLAG_STAR_MATCH; p = strchr (linebuf, '.'); @@ -456,9 +455,6 @@ rspamd_url_parse_tld_file (const gchar *fname, else { p = linebuf; } -#else - p = linebuf; -#endif m.flags = flags; rspamd_multipattern_add_pattern (url_scanner->search_trie, p, @@ -1553,6 +1549,9 @@ rspamd_tld_trie_callback (struct rspamd_multipattern *mp, ndots--; pos = p + 1; } + else { + pos = p; + } p--; } diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c index 6eec009b3..f243c1d8a 100644 --- a/src/libutil/multipattern.c +++ b/src/libutil/multipattern.c @@ -108,7 +108,6 @@ rspamd_multipattern_escape_tld_hyperscan (const gchar *pattern, gsize slen, */ if (pattern[0] == '*') { - len = slen + 4; p = strchr (pattern, '.'); if (p == NULL) { @@ -119,12 +118,13 @@ rspamd_multipattern_escape_tld_hyperscan (const gchar *pattern, gsize slen, p ++; } - prefix = ".*."; + prefix = "\\."; + len = slen + strlen (prefix); } else { - len = slen + 1; - prefix = "."; + prefix = "\\."; p = pattern; + len = slen + strlen (prefix); } res = g_malloc (len + 1); @@ -208,7 +208,7 @@ rspamd_multipattern_pattern_filter (const gchar *pattern, gsize len, tmp = rspamd_multipattern_escape_tld_hyperscan (pattern, len, &tlen); ret = rspamd_str_regexp_escape (tmp, tlen, dst_len, - gl_flags|RSPAMD_REGEXP_ESCAPE_GLOB); + gl_flags|RSPAMD_REGEXP_ESCAPE_RE); g_free (tmp); } else if (flags & RSPAMD_MULTIPATTERN_RE) { |