aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/once_received.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/lua/once_received.lua')
-rw-r--r--src/plugins/lua/once_received.lua23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua
index 4f1e67c72..11e880cc5 100644
--- a/src/plugins/lua/once_received.lua
+++ b/src/plugins/lua/once_received.lua
@@ -31,6 +31,7 @@ local good_hosts = {}
local whitelist = nil
local rspamd_logger = require "rspamd_logger"
+local lua_util = require "lua_util"
local fun = require "fun"
local N = 'once_received'
@@ -156,24 +157,10 @@ local function check_quantity_received (task)
end
end
-local function try_opts(where)
- local ret = false
- local opts = rspamd_config:get_all_opt(where)
- if type(opts) == 'table' then
- if type(opts['check_local']) == 'boolean' then
- check_local = opts['check_local']
- ret = true
- end
- if type(opts['check_authed']) == 'boolean' then
- check_authed = opts['check_authed']
- ret = true
- end
- end
-
- return ret
-end
-
-if not try_opts(N) then try_opts('options') end
+local auth_and_local_conf = lua_util.config_check_local_or_authed(rspamd_config, N,
+ false, false)
+check_local = auth_and_local_conf[1]
+check_authed = auth_and_local_conf[2]
-- Configuration
local opts = rspamd_config:get_all_opt(N)