commit d4f9fc6: [Rework] Dkim_signing: Move sign condition to dkim_signing

Vsevolod Stakhov vsevolod at highsecure.ru
Fri May 31 15:42:04 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-05-31 16:16:38 +0100
URL: https://github.com/rspamd/rspamd/commit/d4f9fc632e37c450f503f3194d4468d2c54de842

[Rework] Dkim_signing: Move sign condition to dkim_signing

---
 lualib/lua_dkim_tools.lua | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lualib/lua_dkim_tools.lua b/lualib/lua_dkim_tools.lua
index 5026bbd6b..fbb071245 100644
--- a/lualib/lua_dkim_tools.lua
+++ b/lualib/lua_dkim_tools.lua
@@ -134,6 +134,17 @@ local function prepare_dkim_signing(N, task, settings)
     end
   end
 
+  if settings.sign_condition and type(settings.sign_condition) == 'function' then
+    -- Use sign condition only
+    local ret = settings.sign_condition(task)
+
+    if not ret then
+      return false,{}
+    end
+
+    return true,ret
+  end
+
   local auser = task:get_user()
   local ip = task:get_from_ip()
 
@@ -673,6 +684,8 @@ exports.process_signing_settings = function(N, settings, opts)
       settings[k] = lua_maps.map_add(N, k, 'glob', 'DKIM keys table')
     elseif k == 'vault_domains' then
       settings[k] = lua_maps.map_add(N, k, 'glob', 'DKIM signing domains in vault')
+    elseif k == 'sign_condition' then
+      settings[k] = lua_util.callback_from_string(v)
     else
       settings[k] = v
     end


More information about the Commits mailing list