Skip to content

Commit

Permalink
[Minor] Set allowed ids in settings symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Aug 20, 2019
1 parent 2ce497d commit 35fd0d7
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/plugins/lua/settings.lua
Expand Up @@ -39,6 +39,7 @@ local settings = {}
local N = "settings"
local settings_initialized = false
local max_pri = 0
local module_sym_id -- Main module symbol

local function apply_settings(task, to_apply, id)
task:set_settings(to_apply)
Expand Down Expand Up @@ -926,17 +927,19 @@ local function process_settings_table(tbl, allow_ids, mempool)
if elt.apply and elt.apply.symbols then
-- Register virtual symbols
for k,v in pairs(elt.apply.symbols) do
local rtb = {
type = 'virtual',
parent = module_sym_id,
}
if type(k) == 'number' and type(v) == 'string' then
rspamd_config:register_symbol{
name = v,
type = 'virtual,ghost',
}
rtb.name = v
elseif type(k) == 'string' then
rspamd_config:register_symbol{
name = k,
type = 'virtual,ghost',
}
rtb.name = k
end
if out.id then
rtb.allowed_ids = tostring(elt.id)
end
rspamd_config:register_symbol(rtb)
end
end
else
Expand Down Expand Up @@ -1115,7 +1118,7 @@ elseif set_section and type(set_section) == "table" then
process_settings_table(set_section, true, settings_map_pool)
end

rspamd_config:register_symbol({
module_sym_id = rspamd_config:register_symbol({
name = 'SETTINGS_CHECK',
type = 'prefilter',
callback = check_settings,
Expand Down

0 comments on commit 35fd0d7

Please sign in to comment.