Browse Source

[Minor] Fix dkim reputation selector

tags/1.7.9
Vsevolod Stakhov 6 years ago
parent
commit
5a84255880
1 changed files with 7 additions and 4 deletions
  1. 7
    4
      src/plugins/lua/reputation.lua

+ 7
- 4
src/plugins/lua/reputation.lua View File

-- DKIM Selector functions -- DKIM Selector functions
local gr local gr
local function gen_dkim_queries(task, rule) local function gen_dkim_queries(task, rule)
local dkim_trace = task:get_symbol('DKIM_TRACE')
local dkim_trace = (task:get_symbol('DKIM_TRACE') or E)[1]
local lpeg = require 'lpeg' local lpeg = require 'lpeg'
local ret = {} local ret = {}


if not gr then if not gr then
local semicolon = lpeg.P(':') local semicolon = lpeg.P(':')
local domain = lpeg.C((1 - semicolon)^0)
local domain = lpeg.C((1 - semicolon)^1)
local res = lpeg.S'+-?~' local res = lpeg.S'+-?~'


local function res_to_label(ch) local function res_to_label(ch)
if ch == '+' then return 'a' if ch == '+' then return 'a'
elseif ch == '-' then return 'r' elseif ch == '-' then return 'r'
else return 'u'
end end

return 'u'
end end


gr = domain * semicolon * lpeg.C(res / res_to_label)
gr = domain * semicolon * (lpeg.C(res^1) / res_to_label)
end end


if dkim_trace and dkim_trace.options then if dkim_trace and dkim_trace.options then
local rep_accepted = 0.0 local rep_accepted = 0.0
local rep_rejected = 0.0 local rep_rejected = 0.0


rspamd_logger.debugm(N, task, 'dkim reputation tokens: %s', requests)

local function tokens_cb(err, token, values) local function tokens_cb(err, token, values)
nchecked = nchecked + 1 nchecked = nchecked + 1



Loading…
Cancel
Save