aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAL <AlexeySa@users.noreply.github.com>2016-10-27 16:03:18 +0300
committerGitHub <noreply@github.com>2016-10-27 16:03:18 +0300
commitce36371a8bdaf04c9e13d30ad310c2ac9fd8e5da (patch)
tree9b0957fe0bc49b6b2d982286204feffc7f17ef85 /src
parent0bd145a9ac742764af8214ec1a532d1f8317f735 (diff)
downloadrspamd-ce36371a8bdaf04c9e13d30ad310c2ac9fd8e5da.tar.gz
rspamd-ce36371a8bdaf04c9e13d30ad310c2ac9fd8e5da.zip
[Minor] Add var for premature greylisting
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/greylist.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua
index 8bb101be0..5e0ce9ff1 100644
--- a/src/plugins/lua/greylist.lua
+++ b/src/plugins/lua/greylist.lua
@@ -255,6 +255,7 @@ local function greylist_set(task)
local is_whitelisted = task:get_mempool():get_variable("grey_whitelisted")
local do_greylisting = task:get_mempool():get_variable("grey_greylisted")
+ local do_greylisting_required = task:get_mempool():get_variable("grey_greylisted_required")
-- Third and second level domains whitelist
if not is_whitelisted and whitelist_domains_map then
@@ -269,7 +270,9 @@ local function greylist_set(task)
end
local action = task:get_metric_action('default')
- if action == 'no action' or action == 'reject' then return end
+ if action == 'no action' or action == 'reject' then
+ if not do_greylisting_required or do_greylisting_required ~= "1" then return end
+ end
local body_key = data_key(task)
local meta_key = envelope_key(task)
local upstream, ret, conn
@@ -312,7 +315,7 @@ local function greylist_set(task)
rspamd_logger.infox(task, 'got error while connecting to redis: %1', addr)
upstream:fail()
end
- elseif do_greylisting then
+ elseif do_greylisting or do_greylisting_required then
local t = tostring(math.floor(rspamd_util.get_time()))
local end_time = rspamd_util.time_to_string(t + settings['timeout'])
rspamd_logger.infox(task, 'greylisted until "%s", new record', end_time)