]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow base32 encoding for emails request
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 29 Jun 2017 17:59:50 +0000 (18:59 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 29 Jun 2017 17:59:50 +0000 (18:59 +0100)
src/plugins/lua/emails.lua

index 9199bc6f39d7ec1f75b88a1f34ae01247290cd02..41b65f2ff50687cb85092f703bd186b76cfe5787 100644 (file)
@@ -63,7 +63,13 @@ local function check_email_rule(task, rule, addr)
     logger.debugm(N, task, "check %s on %s", email, rule['dnsbl'])
 
     if rule['hash'] then
-      to_resolve = hash.create_specific(rule['hash'], email):hex()
+      local hkey = hash.create_specific(rule['hash'], email)
+
+      if rule['encoding'] == 'base32' then
+        to_resolve = hkey:base32()
+      else
+        to_resolve = hkey:hex()
+      end
 
       if rule['hashlen'] and type(rule['hashlen']) == 'number' then
         if #to_resolve > rule['hashlen'] then