aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/spamassassin.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-23 15:00:12 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-23 15:00:12 +0000
commite03d9dac6c7829a67b95815a30a22ffa756aed47 (patch)
tree16ffbfa60fb6ec3f38a6bbd3c822dd0eb9ed16a2 /src/plugins/lua/spamassassin.lua
parent403fd9f7a230d888cef9963fe11619907e9f69ce (diff)
downloadrspamd-e03d9dac6c7829a67b95815a30a22ffa756aed47.tar.gz
rspamd-e03d9dac6c7829a67b95815a30a22ffa756aed47.zip
Fix freemail rules
Diffstat (limited to 'src/plugins/lua/spamassassin.lua')
-rw-r--r--src/plugins/lua/spamassassin.lua20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index 08abb7b05..7842e4e96 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -261,10 +261,13 @@ local function gen_eval_rule(arg)
local h = task:get_header(arg)
if h then
local hdr_freemail = freemail_search(h)
+
if hdr_freemail > 0 and re then
- r = rspamd_regexp.create_cached(re)
+ local r = rspamd_regexp.create_cached(re)
if r then
- r:match(h)
+ if r:match(h) then
+ return 1
+ end
else
rspamd_logger.infox(rspamd_config, 'cannot create regexp %1', re)
return 0
@@ -768,7 +771,7 @@ local function process_sa_conf(f)
scores[words[2]] = parse_score(words)
elseif words[1] == 'freemail_domains' then
_.each(function(dom)
- table.insert(freemail_domains, '@' .. dom)
+ table.insert(freemail_domains, '@' .. dom)
end, _.drop_n(1, words))
elseif words[1] == 'tflags' then
process_tflags(cur_rule, words)
@@ -815,12 +818,6 @@ local function add_sole_meta(sym, rule)
rules[sym] = r
end
-if freemail_domains then
- freemail_trie = rspamd_trie.create(freemail_domains)
- rspamd_logger.infox(rspamd_config, 'loaded %1 freemail domains definitions',
- #freemail_domains)
-end
-
local function sa_regexp_match(data, re, raw, rule)
local res = 0
if not re then
@@ -1273,6 +1270,11 @@ local function post_process()
end,
rules))
+ if freemail_domains then
+ freemail_trie = rspamd_trie.create(freemail_domains)
+ rspamd_logger.infox(rspamd_config, 'loaded %1 freemail domains definitions',
+ #freemail_domains)
+ end
end
local has_rules = false