diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-31 12:16:54 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-31 12:16:54 +0100 |
commit | 4ff824245805bfabdfaeb50c1ec46387bc06425b (patch) | |
tree | 4374891a46a106d6867d0a2c14d17a319aed90af /src/plugins | |
parent | 9a0f9f497674c0b5086f9ea41469d3489c98c166 (diff) | |
download | rspamd-4ff824245805bfabdfaeb50c1ec46387bc06425b.tar.gz rspamd-4ff824245805bfabdfaeb50c1ec46387bc06425b.zip |
Add guards for invalid rules.
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lua/spamassassin.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index 1398ef39d..170997f15 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -163,7 +163,8 @@ local function process_sa_conf(f) handle_header_def(words[3], cur_rule) end - if cur_rule['re'] and (cur_rule['header'] or cur_rule['function']) then + if cur_rule['re'] and cur_rule['symbol'] and + (cur_rule['header'] or cur_rule['function']) then valid_rule = true end else @@ -193,7 +194,7 @@ local function process_sa_conf(f) cur_rule['symbol'] = words[2] cur_rule['re_expr'] = words_to_re(words, 2) cur_rule['re'] = rspamd_regexp.create_cached(cur_rule['re_expr']) - if cur_rule['re'] then valid_rule = true end + if cur_rule['re'] and cur_rule['symbol'] then valid_rule = true end elseif words[1] == "rawbody" or words[1] == "full" and slash then -- body SYMBOL /regexp/ if valid_rule then @@ -203,7 +204,7 @@ local function process_sa_conf(f) cur_rule['symbol'] = words[2] cur_rule['re_expr'] = words_to_re(words, 2) cur_rule['re'] = rspamd_regexp.create_cached(cur_rule['re_expr']) - if cur_rule['re'] then valid_rule = true end + if cur_rule['re'] and cur_rule['symbol'] then valid_rule = true end elseif words[1] == "uri" then -- uri SYMBOL /regexp/ if valid_rule then @@ -213,7 +214,7 @@ local function process_sa_conf(f) cur_rule['symbol'] = words[2] cur_rule['re_expr'] = words_to_re(words, 2) cur_rule['re'] = rspamd_regexp.create_cached(cur_rule['re_expr']) - if cur_rule['re'] then valid_rule = true end + if cur_rule['re'] and cur_rule['symbol'] then valid_rule = true end elseif words[1] == "meta" then -- meta SYMBOL expression if valid_rule then @@ -222,7 +223,7 @@ local function process_sa_conf(f) cur_rule['type'] = 'meta' cur_rule['symbol'] = words[2] cur_rule['meta'] = words_to_re(words, 2) - if cur_rule['meta'] then valid_rule = true end + if cur_rule['meta'] and cur_rule['symbol'] then valid_rule = true end elseif words[1] == "describe" and valid_rule then cur_rule['description'] = words_to_re(words, 1) elseif words[1] == "score" and valid_rule then |