options[k] = v
end
end
+
+ local auth_and_local_conf = lua_util.config_check_local_or_authed(rspamd_config, N,
+ false, true)
+ options.check_local = auth_and_local_conf[1]
+ options.check_authed = auth_and_local_conf[2]
+
if options['provider_type'] == 'rspamd' then
if not options['provider_info'] and options['provider_info']['ip4'] and
options['provider_info']['ip6'] then
local rspamd_logger = require "rspamd_logger"
local rspamd_util = require "rspamd_util"
local lua_redis = require "lua_redis"
+local lua_util = require "lua_util"
local fun = require "fun"
local hash = require "rspamd_cryptobox_hash"
local rspamd_lua_utils = require "lua_util"
end
end
+ local auth_and_local_conf = lua_util.config_check_local_or_authed(rspamd_config, N,
+ false, false)
+ settings.check_local = auth_and_local_conf[1]
+ settings.check_authed = auth_and_local_conf[2]
+
if settings['greylist_min_score'] then
settings['greylist_min_score'] = tonumber(settings['greylist_min_score'])
else
"HFILTER_FROM_BOUNCE"
}
-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]
local opts = rspamd_config:get_all_opt('hfilter')
if opts then
local whitelist = nil
local rspamd_logger = require "rspamd_logger"
+local lua_util = require "lua_util"
local fun = require "fun"
local N = 'once_received'
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)
end
-- Module setup
-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
local opts = rspamd_config:get_all_opt('spamtrap')
if not (opts and type(opts) == 'table') then
return
end
-if not try_opts(M) then try_opts('options') end
+
+local auth_and_local_conf = lua_util.config_check_local_or_authed(rspamd_config, 'spamtrap',
+ false, false)
+check_local = auth_and_local_conf[1]
+check_authed = auth_and_local_conf[2]
if opts then
for k,v in pairs(opts) do
options[k] = v
end
- local function try_opts(where)
- local ret = false
- local test_opts = rspamd_config:get_all_opt(where)
- if type(test_opts) == 'table' then
- if type(test_opts.check_local) == 'boolean' then
- options.check_local = test_opts.check_local
- ret = true
- end
- if type(test_opts.check_authed) == 'boolean' then
- options.check_authed = test_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)
+ options.check_local = auth_and_local_conf[1]
+ options.check_authed = auth_and_local_conf[2]
else
rspamd_logger.infox(rspamd_config, 'Module is unconfigured')
return