aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/spamassassin.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-17 23:42:46 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-17 23:42:46 +0000
commit0ac0e550a387085659c4c6556021da601d93aa34 (patch)
tree78692a4fdc44c322fa5c3d12606c99cfa786ec0f /src/plugins/lua/spamassassin.lua
parent9240d07929d71c468639038ba8fd1512a1ad499a (diff)
downloadrspamd-0ac0e550a387085659c4c6556021da601d93aa34.tar.gz
rspamd-0ac0e550a387085659c4c6556021da601d93aa34.zip
Fix negation for header rules in SA plugin
Diffstat (limited to 'src/plugins/lua/spamassassin.lua')
-rw-r--r--src/plugins/lua/spamassassin.lua16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index 4f41681e6..988abf011 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -981,6 +981,7 @@ local function post_process()
-- Header rules
_.each(function(k, r)
local f = function(task)
+
local raw = false
local check = {}
-- Cached path for ordinary expressions
@@ -1006,9 +1007,14 @@ local function post_process()
raw = h['raw'],
})
- if h['not'] then
- return not ret
+ if r['not'] then
+ if ret ~= 0 then
+ ret = 0
+ else
+ ret = 1
+ end
end
+
return ret
end
@@ -1070,14 +1076,16 @@ local function post_process()
return 0
end
+ local ret = 0
for i, c in ipairs(check) do
local match = sa_regexp_match(c, r['re'], raw, r)
if (match and not r['not']) or (not match and r['not']) then
- return match
+ ret = 1
end
+
end
- return 0
+ return ret
end
if r['score'] then
local real_score = r['score'] * calculate_score(k, r)