]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Greylist: Suppress greylist action for whitelisted hosts too 1517/head
authorAndrew Lewis <nerf@judo.za.org>
Mon, 13 Mar 2017 10:52:29 +0000 (12:52 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 13 Mar 2017 10:52:29 +0000 (12:52 +0200)
src/plugins/lua/greylist.lua

index 2653564b581bdea55cebe5a5c8325def5c0359c6..1cb94b6aa0aceb1b2a8691a72ee4dc08f6894205 100644 (file)
@@ -227,14 +227,25 @@ local function greylist_check(task)
 end
 
 local function greylist_set(task)
+  local action = task:get_metric_action('default')
   local ip = task:get_ip()
 
   if task:get_user() or (ip and ip:is_local()) then
+    if action == 'greylist' then
+      -- We are going to accept message
+      rspamd_logger.infox(task, 'Downgrading metric action from "greylist" to "no action"')
+      task:set_metric_action('default', 'no action')
+    end
     return
   end
 
   if ip and ip:is_valid() and whitelisted_ip then
     if whitelisted_ip:get_key(ip) then
+      if action == 'greylist' then
+        -- We are going to accept message
+        rspamd_logger.infox(task, 'Downgrading metric action from "greylist" to "no action"')
+        task:set_metric_action('default', 'no action')
+      end
       return
     end
   end
@@ -255,7 +266,6 @@ local function greylist_set(task)
     end
   end
 
-  local action = task:get_metric_action('default')
   if action == 'reject' or
       not do_greylisting_required and action == 'no action' then
     return