commit 35fd0d7: [Minor] Set allowed ids in settings symbols
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Aug 20 16:42:04 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-08-20 15:48:41 +0100
URL: https://github.com/rspamd/rspamd/commit/35fd0d7813d4c72a0a19f6c0f350448eaf5804e1
[Minor] Set allowed ids in settings symbols
---
src/plugins/lua/settings.lua | 21 ++++++++++++---------
1 file 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,
More information about the Commits
mailing list