From: AL Date: Thu, 27 Oct 2016 13:03:18 +0000 (+0300) Subject: [Minor] Add var for premature greylisting X-Git-Tag: 1.4.0~176^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ce36371a8bdaf04c9e13d30ad310c2ac9fd8e5da;p=rspamd.git [Minor] Add var for premature greylisting --- 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)