aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-02 12:53:48 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-02 12:53:48 +0000
commit9508d87e3ceffeb21795eb1356229f48648182bf (patch)
treef7a825459adc4fbdefd1781a9258cd125ce0d356 /src/plugins
parenta45d5bd3da50cb5ede2d1fcf356190e68bb13f03 (diff)
downloadrspamd-9508d87e3ceffeb21795eb1356229f48648182bf.tar.gz
rspamd-9508d87e3ceffeb21795eb1356229f48648182bf.zip
[Minor] Fix greylisting messages
Issue: #2660
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/greylist.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua
index 7427f999e..87ed1080d 100644
--- a/src/plugins/lua/greylist.lua
+++ b/src/plugins/lua/greylist.lua
@@ -195,22 +195,25 @@ local function greylist_check(task)
local greylisted_meta = false
if data then
+ local end_time_body,end_time_meta
+
if data[1] and type(data[1]) ~= 'userdata' then
+ local tm = tonumber(data[1]) or rspamd_util.get_time()
ret_body,greylisted_body = check_time(task, data[1], 'body')
if greylisted_body then
- local end_time = rspamd_util.time_to_string(rspamd_util.get_time()
- + settings['timeout'])
- task:get_mempool():set_variable("grey_greylisted_body", end_time)
+ end_time_body = rspamd_util.time_to_string(tm + settings['timeout'])
+ task:get_mempool():set_variable("grey_greylisted_body", end_time_body)
end
end
+
if data[2] and type(data[2]) ~= 'userdata' then
if not ret_body or greylisted_body then
+ local tm = tonumber(data[2]) or rspamd_util.get_time()
ret_meta,greylisted_meta = check_time(task, data[2], 'meta')
if greylisted_meta then
- local end_time = rspamd_util.time_to_string(rspamd_util.get_time()
- + settings['timeout'])
- task:get_mempool():set_variable("grey_greylisted_meta", end_time)
+ end_time_meta = rspamd_util.time_to_string(tm + settings['timeout'])
+ task:get_mempool():set_variable("grey_greylisted_meta", end_time_meta)
end
end
end
@@ -220,8 +223,7 @@ local function greylist_check(task)
+ settings['timeout'])
task:get_mempool():set_variable("grey_greylisted", end_time)
elseif greylisted_body and greylisted_meta then
- local end_time = rspamd_util.time_to_string(rspamd_util.get_time() +
- settings['timeout'])
+ local end_time = math.min(end_time_body, end_time_meta)
rspamd_logger.infox(task, 'greylisted until "%s"',
end_time)
greylist_message(task, end_time, 'too early')