diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-08-20 15:48:41 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-08-20 15:48:41 +0100 |
commit | 35fd0d7813d4c72a0a19f6c0f350448eaf5804e1 (patch) | |
tree | 3b75de2a7fc51a4d926f5fc2dcc43d9e95aa99be | |
parent | 2ce497de837c7a444bc81ff52ac29984b9f2ae99 (diff) | |
download | rspamd-35fd0d7813d4c72a0a19f6c0f350448eaf5804e1.tar.gz rspamd-35fd0d7813d4c72a0a19f6c0f350448eaf5804e1.zip |
[Minor] Set allowed ids in settings symbols
-rw-r--r-- | src/plugins/lua/settings.lua | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index e28473b5b..757fce95f 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -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) @@ -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 @@ -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, |