From: Vsevolod Stakhov Date: Fri, 17 Aug 2018 19:08:41 +0000 (+0100) Subject: [Minor] Fix init logic X-Git-Tag: 1.8.0~245 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=de9ca456b037b5db3fb45b8f6be148e9ba32c9db;p=rspamd.git [Minor] Fix init logic --- diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 8ba0a164d..d20885525 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -884,18 +884,20 @@ local function add_multimap_rule(key, newrule) rspamd_logger.errx(rspamd_config, 'mempool map requires variable') return nil end - if newrule['type'] == 'selector' and not newrule['selector'] then - rspamd_logger.errx(rspamd_config, 'selector map requires selector definition') - return nil - else - local selector = lua_selectors.parse_selector(rspamd_config, newrule['selector']) - - if not selector then - rspamd_logger.errx(rspamd_config, 'selector map has invalid selector') + if newrule['type'] == 'selector' then + if not newrule['selector'] then + rspamd_logger.errx(rspamd_config, 'selector map requires selector definition') return nil - end + else + local selector = lua_selectors.parse_selector(rspamd_config, newrule['selector']) - newrule.selector = selector + if not selector then + rspamd_logger.errx(rspamd_config, 'selector map has invalid selector') + return nil + end + + newrule.selector = selector + end end -- Check cdb flag if type(newrule['map']) == 'string' and string.find(newrule['map'], '^cdb://.*$') then