diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-26 22:32:56 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-02-26 22:56:50 +0000 |
commit | 2f65edb588dbbdff37551724da85be15c955aeeb (patch) | |
tree | 6ffc8975af776f3ae291ad6ff3b0c822c839baad /src | |
parent | 3c1c6d599c9c0504177f3bb5c174050b8487e0e1 (diff) | |
download | rspamd-2f65edb588dbbdff37551724da85be15c955aeeb.tar.gz rspamd-2f65edb588dbbdff37551724da85be15c955aeeb.zip |
Add support of '!~' operator.
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/spamassassin.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index f9a2e6901..749336d75 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -78,6 +78,11 @@ local function process_sa_conf(f) cur_rule['type'] = 'header' cur_rule['symbol'] = words[2] cur_rule['header'] = words[3] + + if words[4] == '!~' then + cur_rule['not'] = true + end + cur_rule['re_expr'] = words_to_re(words, 4) cur_rule['re'] = rspamd_regexp.create_cached(cur_rule['re_expr']) if cur_rule['re'] then valid_rule = true end @@ -178,11 +183,14 @@ _.each(function(k, r) if hdr then for n, rh in ipairs(hdr) do -- Subject for optimization - if (r['re']:match(rh['decoded'])) then + local match = r['re']:match(rh['decoded']) + if (match and not r['not']) or (not match and r['not']) then task:insert_result(k, 1.0) return end end + elseif r['not'] then + task:insert_result(k, 1.0) end end rspamd_config:register_symbol(k, calculate_score(k), f) |