aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-20 20:01:46 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-20 20:01:46 +0100
commitf0109cb80d338fafa17fa3952f60fcc88c8005bf (patch)
tree5b601e07f8e58b39205378a3c2d40524399ef76a /src
parent4d77ad7c6d9ae6d1fd10747a21ab0c9442b5eba3 (diff)
downloadrspamd-f0109cb80d338fafa17fa3952f60fcc88c8005bf.tar.gz
rspamd-f0109cb80d338fafa17fa3952f60fcc88c8005bf.zip
[Minor] Allow to append greylist end time to message reported
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/greylist.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua
index d8f3206d1..37ebf6f02 100644
--- a/src/plugins/lua/greylist.lua
+++ b/src/plugins/lua/greylist.lua
@@ -50,6 +50,7 @@ local settings = {
action = 'soft reject', -- default greylisted action
ipv4_mask = 19, -- Mask bits for ipv4
ipv6_mask = 64, -- Mask bits for ipv6
+ report_time = false, -- Tell when greylisting is epired (appended to `message`)
}
local rspamd_logger = require "rspamd_logger"
@@ -199,13 +200,20 @@ local function greylist_check(task)
rspamd_logger.infox(task, 'greylisted until "%s" using %s key',
end_time, type)
task:insert_result(settings['symbol'], 0.0, 'greylisted', end_time)
- if not task:get_queue_id() then return end
+
+ if not task:get_queue_id() then return end -- Likely rspamc scan
+
if settings.message_func then
task:set_pre_result('soft reject',
settings.message_func(task, end_time))
else
- task:set_pre_result('soft reject', settings['message'])
+ local message = settings['message']
+ if settings.report_time then
+ message = string.format("%s: %s", message, end_time)
+ end
+ task:set_pre_result('soft reject', message)
end
+
task:set_flag('greylisted')
end
elseif err then