From d4f9fc632e37c450f503f3194d4468d2c54de842 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 31 May 2019 16:16:38 +0100 Subject: [PATCH] [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 -- 2.39.5