diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-10-13 09:32:51 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-10-13 09:33:22 +0100 |
commit | 2664f9ef9cf3de116bf97f35edd7f9a3db726f28 (patch) | |
tree | 7086c588a51a9e8bf50b6fd8e5b9d39f128d168b /src/plugins/lua/mid.lua | |
parent | cf8114b5628ccfcf51ac244da3d648e602b35a74 (diff) | |
download | rspamd-2664f9ef9cf3de116bf97f35edd7f9a3db726f28.tar.gz rspamd-2664f9ef9cf3de116bf97f35edd7f9a3db726f28.zip |
[Minor] Mid: Try to fix composites insertion
Diffstat (limited to 'src/plugins/lua/mid.lua')
-rw-r--r-- | src/plugins/lua/mid.lua | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/plugins/lua/mid.lua b/src/plugins/lua/mid.lua index 0eccd360b..d7bf02d1d 100644 --- a/src/plugins/lua/mid.lua +++ b/src/plugins/lua/mid.lua @@ -39,7 +39,7 @@ local settings = { csymbol_missing_mid_allowed = 'MISSING_MID_ALLOWED', } -local map = {} +local map local E = {} @@ -76,7 +76,17 @@ if opts then settings[k] = v end - map = rspamd_map_add('mid', 'source', 'map', 'Message-IDs map') + if not opts.source then + rspamd_logger.infox(rspamd_config, 'mid module requires "source" parameter') + lua_util.disable_module(N, "config") + return + end + + map = rspamd_config:add_map{ + url = opts.source, + description = "Message-IDs map", + type = 'map' + } if map then local id = rspamd_config:register_symbol({ name = 'KNOWN_MID_CALLBACK', @@ -97,13 +107,17 @@ if opts then type = 'virtual' }) rspamd_config:add_composite(settings['csymbol_invalid_msgid_allowed'], - settings['symbol_known_mid'] .. ' & ' .. settings['symbol_invalid_msgid']) + string.format('~%s & ^%s', + settings['symbol_known_mid'], + settings['symbol_invalid_msgid'])) rspamd_config:add_composite(settings['csymbol_missing_mid_allowed'], - settings['symbol_known_no_mid'] .. ' & ' .. settings['symbol_missing_mid']) + string.format('~%s & ^%s', + settings['symbol_known_no_mid'], + settings['symbol_missing_mid'])) - rspamd_config:register_dependency('KNOWN_MID_CALLBACK', settings['symbol_dkim_allow']) + rspamd_config:register_dependency('KNOWN_MID_CALLBACK', 'DKIM_CHECK') else - rspamd_logger.infox(rspamd_config, 'source is not specified, disabling module') + rspamd_logger.infox(rspamd_config, 'source is not a valid map definition, disabling module') lua_util.disable_module(N, "config") end end |