]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Unify settings checks
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 21 Apr 2019 15:58:20 +0000 (16:58 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 21 Apr 2019 15:58:20 +0000 (16:58 +0100)
lualib/lua_dkim_tools.lua
src/plugins/lua/arc.lua
src/plugins/lua/dkim_signing.lua

index 5733cf81a6d3e42ba5c047c05fc9bd3fe187a125..9e00fdfb1168a68a41c71e5e959cc528f9c233fe 100644 (file)
@@ -521,4 +521,14 @@ exports.sign_using_redis = function(N, task, settings, selectors, sign_func, err
   end
 end
 
+exports.validate_signing_settings = function(settings)
+  return settings.use_redis or
+      settings.path or
+      settings.domain or
+      settings.path_map or
+      settings.selector_map or
+      settings.use_http_headers or
+      (settings.signing_table and settings.key_table)
+end
+
 return exports
index d3fe818da8e02ab4fe29ebf8beea54e230030e16..5dfba662c32fdb4efa1262db221c5f7bb94a630c 100644 (file)
@@ -637,13 +637,7 @@ for k,v in pairs(opts) do
   end
 end
 
-if not (settings.use_redis or
-    settings.path or
-    settings.domain or
-    settings.path_map or
-    settings.selector_map or
-    settings.use_http_headers or
-    (settings.signing_table and settings.key_table)) then
+if not dkim_sign_tools.validate_signing_settings(settings) then
   rspamd_logger.infox(rspamd_config, 'mandatory parameters missing, disable arc signing')
   return
 end
index d8e1f751900cefc6b475a576ac4ca66f1fd3a7e3..05a7739e72ccd760d4270ddb7f270b98cde6efd2 100644 (file)
@@ -138,17 +138,12 @@ for k,v in pairs(opts) do
   end
 end
 
-if not (settings.use_redis or
-    settings.path or
-    settings.domain or
-    settings.path_map or
-    settings.selector_map or
-    settings.use_http_headers or
-    (settings.signing_table and settings.key_table)) then
+if not dkim_sign_tools.validate_signing_settings(settings) then
   rspamd_logger.infox(rspamd_config, 'mandatory parameters missing, disable dkim signing')
   lua_util.disable_module(N, "config")
   return
 end
+
 if settings.use_redis then
   redis_params = lua_redis.parse_redis_server('dkim_signing')