aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-31 12:03:07 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-31 12:03:07 +0100
commit9a0f9f497674c0b5086f9ea41469d3489c98c166 (patch)
treec4999050c4dde9749d6c98b21c7bfb59d678464b
parenta80bdbab50bf3fb6c3cd6bd815bc019c3baa4d60 (diff)
downloadrspamd-9a0f9f497674c0b5086f9ea41469d3489c98c166.tar.gz
rspamd-9a0f9f497674c0b5086f9ea41469d3489c98c166.zip
Follow SA conventions about header rules.
-rw-r--r--src/plugins/lua/spamassassin.lua25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index 3684f9a28..1398ef39d 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -270,7 +270,7 @@ end
-- Header rules
_.each(function(k, r)
local f = function(task)
- _.each(function(h)
+ local str = _.foldl(function(acc, h)
local hdr = task:get_header_full(h['header'], h['strong'])
if hdr then
for n, rh in ipairs(hdr) do
@@ -286,15 +286,23 @@ _.each(function(k, r)
if h['function'] then
str = h['function'](str)
end
- local match = r['re']:match(str)
- if (match and not r['not']) or (not match and r['not']) then
- return 1
- end
+
+ acc = acc .. str
end
- elseif r['not'] then
- return 1
end
- end, r['header'])
+
+ return acc
+ end, '', r['header'])
+
+ if str == '' then
+ if r['not'] then return 1 end
+ return 0
+ end
+
+ local match = r['re']:match(str)
+ if (match and not r['not']) or (not match and r['not']) then
+ return 1
+ end
return 0
end
@@ -383,6 +391,7 @@ _.each(function(k, r)
return r['type'] == 'message'
end,
rules))
+
-- URL rules
_.each(function(k, r)
local f = function(task)