]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow to cut hashes when checking emails
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 29 Jun 2017 07:47:52 +0000 (08:47 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 29 Jun 2017 07:59:21 +0000 (08:59 +0100)
src/plugins/lua/emails.lua

index bda3d4f773fdf2d438eed488416f9f198daeeb9b..e27a783ef9cea9cdaf7a318a5353bc34cfbc1f63 100644 (file)
@@ -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