aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/emails.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-29 08:47:52 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-29 08:59:21 +0100
commit652f423ee3cedfe6a331c29def14461c0ca2c059 (patch)
tree36c0508cc90f1a582b02549c8aeea1fbbb351649 /src/plugins/lua/emails.lua
parent5f52812464d4209b93c1665c242f2cd2c3576f60 (diff)
downloadrspamd-652f423ee3cedfe6a331c29def14461c0ca2c059.tar.gz
rspamd-652f423ee3cedfe6a331c29def14461c0ca2c059.zip
[Minor] Allow to cut hashes when checking emails
Diffstat (limited to 'src/plugins/lua/emails.lua')
-rw-r--r--src/plugins/lua/emails.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/lua/emails.lua b/src/plugins/lua/emails.lua
index bda3d4f77..e27a783ef 100644
--- a/src/plugins/lua/emails.lua
+++ b/src/plugins/lua/emails.lua
@@ -62,6 +62,12 @@ local function check_email_rule(task, rule, addr)
if rule['hash'] then
to_resolve = hash.create_specific(rule['hash'], email):hex()
+
+ if rule['hashlen'] and type(rule['hashlen']) == 'number' then
+ if #to_resolve > rule['hashlen'] then
+ to_resolve = string.sub(to_resolve, 1, rule['hashlen'])
+ end
+ end
else
to_resolve = email
end