]> source.dussan.org Git - rspamd.git/commitdiff
Add 'check_relays_unparseable' support
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 23 Nov 2015 11:36:36 +0000 (11:36 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 23 Nov 2015 11:36:36 +0000 (11:36 +0000)
src/plugins/lua/spamassassin.lua

index f766c8fb943e97b2807147161af600e3a47cb5db..fb1998d986fd970ce9a231a37630cf81c87874b3 100644 (file)
@@ -41,7 +41,8 @@ local _ = require "fun"
 local known_plugins = {
   'Mail::SpamAssassin::Plugin::FreeMail',
   'Mail::SpamAssassin::Plugin::HeaderEval',
-  'Mail::SpamAssassin::Plugin::ReplaceTags'
+  'Mail::SpamAssassin::Plugin::ReplaceTags',
+  'Mail::SpamAssassin::Plugin::RelayEval'
 }
 
 -- Internal variables
@@ -234,6 +235,20 @@ local function gen_eval_rule(arg)
         return 0
       end
     },
+    {
+      'check_relays_unparseable',
+      function(task, remain)
+        local rh_mime = task:get_header_full('Received')
+        local rh_parsed = task:get_received_headers()
+
+        local rh_cnt = 0
+        if rh_mime then rh_cnt = #rh_mime end
+        local parsed_cnt = 0
+        if rh_parsed then parsed_cnt = #rh_parsed end
+
+        return rh_cnt - parsed_cnt
+      end
+    },
     {
       'check_for_shifted_date',
       function (task, remain)