From: Vsevolod Stakhov Date: Wed, 11 Jul 2018 20:29:16 +0000 (+0100) Subject: [Minor] Avoid pre-result overriding X-Git-Tag: 1.7.8~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7f169bd819f5b35cd3237308b3e4441cc02934ff;p=rspamd.git [Minor] Avoid pre-result overriding --- diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index 53ece7aa4..a7f53b6b2 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -198,6 +198,8 @@ local function dmarc_callback(task) local function maybe_force_action(disposition) local force_action = dmarc_actions[disposition] if force_action then + -- Don't do anything if pre-result has been already set + if task:has_pre_result() then return end task:set_pre_result(force_action, 'Action set by DMARC') end end diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua index 8de4f69c8..0bf74bc74 100644 --- a/src/plugins/lua/greylist.lua +++ b/src/plugins/lua/greylist.lua @@ -249,6 +249,9 @@ local function greylist_set(task) local action = task:get_metric_action('default') local ip = task:get_ip() + -- Don't do anything if pre-result has been already set + if task:has_pre_result() then return end + if settings.greylist_min_score then local score = task:get_metric_score('default')[1] if score < settings.greylist_min_score then diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index 786bc71bf..654c300ca 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -402,6 +402,9 @@ local function ratelimit_cb(task) end end + -- Don't do anything if pre-result has been already set + if task:has_pre_result() then return end + if nprefixes > 0 then -- Save prefixes to the cache to allow update task:cache_set('ratelimit_prefixes', prefixes) @@ -570,7 +573,7 @@ if opts then local s = { type = 'prefilter,nostat', name = 'RATELIMIT_CHECK', - priority = 4, + priority = 7, callback = ratelimit_cb, flags = 'empty', }