Browse Source

[Minor] Avoid pre-result overriding

tags/1.7.8
Vsevolod Stakhov 5 years ago
parent
commit
7f169bd819
3 changed files with 9 additions and 1 deletions
  1. 2
    0
      src/plugins/lua/dmarc.lua
  2. 3
    0
      src/plugins/lua/greylist.lua
  3. 4
    1
      src/plugins/lua/ratelimit.lua

+ 2
- 0
src/plugins/lua/dmarc.lua View File

@@ -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

+ 3
- 0
src/plugins/lua/greylist.lua View File

@@ -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

+ 4
- 1
src/plugins/lua/ratelimit.lua View File

@@ -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',
}

Loading…
Cancel
Save