]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Force actions: Use postfilter if we have honor_action / require_action
authorAndrew Lewis <nerf@judo.za.org>
Tue, 28 Mar 2017 11:17:56 +0000 (13:17 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 28 Mar 2017 11:17:56 +0000 (13:17 +0200)
src/plugins/lua/force_actions.lua

index 4a0e61ab99b7bab8799da18846788609544cc9bd..0b5528d97053f30c8d328acd63163319ef3cb672 100644 (file)
@@ -146,16 +146,24 @@ local function configure_module()
         local honor = list_to_hash(sett.honor_action)
         local cb, atoms = gen_cb(expr, action, rspamd_config:get_mempool(), message, subject, raction, honor)
         if cb and atoms then
-          local sname = 'FORCE_ACTION_' .. name
-          local id = rspamd_config:register_symbol({
-            type = 'normal',
-            name = sname,
-            callback = cb,
-          })
-          for _, a in ipairs(atoms) do
-            rspamd_config:register_dependency(id, a)
+          local t = {}
+          if (raction or honor) then
+            t.type = 'postfilter'
+            t.priority = 10
+          else
+            t.type = 'normal'
+          end
+          t.name = 'FORCE_ACTION_' .. name
+          t.callback = cb
+          local id = rspamd_config:register_symbol(t)
+          if t.type == 'normal' then
+            for _, a in ipairs(atoms) do
+              rspamd_config:register_dependency(id, a)
+            end
+            rspamd_logger.infox(rspamd_config, 'Registered symbol %1 <%2> with dependencies [%3]', name, expr, table.concat(atoms, ','))
+          else
+            rspamd_logger.infox(rspamd_config, 'Registered symbol %1 <%2> as postfilter', name, expr)
           end
-          rspamd_logger.infox(rspamd_config, 'Registered symbol %1 <%2> with dependencies [%3]', name, expr, table.concat(atoms, ','))
         end
       end
     end