]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix HTML part detection heuristic
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 28 Jul 2018 13:06:57 +0000 (14:06 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 28 Jul 2018 13:06:57 +0000 (14:06 +0100)
src/libmime/message.c
src/plugins/lua/multimap.lua

index 76f63ed1a72a3ea4751a02314ee1a0711e9b1fea..333748d16db3d3de0b1d316802ebb6a113fe7b5b 100644 (file)
@@ -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 {
index 18a66a23f382938a75c79ea1910b30f42f488593..303f97d0ee4b592505ac75a2ac763e7533e7ca2f 100644 (file)
@@ -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