summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-28 14:06:57 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-28 14:06:57 +0100
commitb6e156e807a83b2b843929832869ccc3b6ecaec2 (patch)
tree1bad579a771f930a46dfbc06c604aacd7164c29c /src
parent30b6627f1fe91a16d78b5640b881ecbfc143cc70 (diff)
downloadrspamd-b6e156e807a83b2b843929832869ccc3b6ecaec2.tar.gz
rspamd-b6e156e807a83b2b843929832869ccc3b6ecaec2.zip
[Fix] Fix HTML part detection heuristic
Diffstat (limited to 'src')
-rw-r--r--src/libmime/message.c6
-rw-r--r--src/plugins/lua/multimap.lua4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index 76f63ed1a..333748d16 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -676,11 +676,13 @@ rspamd_message_process_text_part (struct rspamd_task *task,
RSPAMD_FTOK_ASSIGN (&xhtml_tok, "<html");
if (mime_part->parsed_data.len >= xhtml_tok.len &&
- rspamd_lc_cmp (mime_part->parsed_data.begin, xhtml_tok.begin, xhtml_tok.len)) {
+ rspamd_lc_cmp (mime_part->parsed_data.begin,
+ xhtml_tok.begin, xhtml_tok.len) == 0) {
found_html = TRUE;
}
else if (mime_part->parsed_data.len >= html_tok.len &&
- rspamd_lc_cmp (mime_part->parsed_data.begin, html_tok.begin, html_tok.len)) {
+ rspamd_lc_cmp (mime_part->parsed_data.begin,
+ html_tok.begin, html_tok.len) == 0) {
found_html = TRUE;
}
else {
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 18a66a23f..303f97d0e 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -413,6 +413,7 @@ local function multimap_callback(task, rule)
table.insert(srch, nip)
end
end
+
table.insert(srch, 1, r['redis_key'])
ret = rspamd_redis_make_request(task,
redis_params, -- connect params
@@ -759,6 +760,7 @@ local function multimap_callback(task, rule)
url = function()
if task:has_urls() then
local msg_urls = task:get_urls()
+
for _,url in ipairs(msg_urls) do
match_url(rule, url)
end
@@ -1095,6 +1097,8 @@ if opts and type(opts) == 'table' then
if not rule then
rspamd_logger.errx(rspamd_config, 'cannot add rule: "'..k..'"')
else
+ rspamd_logger.infox(rspamd_config, 'added multimap rule: %s (%s)',
+ k, rule.type)
table.insert(rules, rule)
end
end