From: Vsevolod Stakhov Date: Thu, 29 Jun 2017 07:47:52 +0000 (+0100) Subject: [Minor] Allow to cut hashes when checking emails X-Git-Tag: 1.6.2~59 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=652f423ee3cedfe6a331c29def14461c0ca2c059;p=rspamd.git [Minor] Allow to cut hashes when checking emails --- 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