]> source.dussan.org Git - rspamd.git/commitdiff
Fix freemail rules
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 23 Dec 2015 15:00:12 +0000 (15:00 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 23 Dec 2015 15:00:12 +0000 (15:00 +0000)
src/plugins/lua/spamassassin.lua

index 08abb7b056e3171bd411006e832292ed63454dc2..7842e4e96f2def2a860714fa10a05a12197bf79c 100644 (file)
@@ -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