From 5a8425588002b80dc2196c1046597664f074863c Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 23 Jul 2018 15:30:28 +0100 Subject: [PATCH] [Minor] Fix dkim reputation selector --- src/plugins/lua/reputation.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua index 47507fe3cd..2ef7fbfd79 100644 --- a/src/plugins/lua/reputation.lua +++ b/src/plugins/lua/reputation.lua @@ -73,23 +73,24 @@ end -- DKIM Selector functions local gr 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 ret = {} if not gr then local semicolon = lpeg.P(':') - local domain = lpeg.C((1 - semicolon)^0) + local domain = lpeg.C((1 - semicolon)^1) local res = lpeg.S'+-?~' local function res_to_label(ch) if ch == '+' then return 'a' elseif ch == '-' then return 'r' - else return 'u' end + + return 'u' end - gr = domain * semicolon * lpeg.C(res / res_to_label) + gr = domain * semicolon * (lpeg.C(res^1) / res_to_label) end if dkim_trace and dkim_trace.options then @@ -112,6 +113,8 @@ local function dkim_reputation_filter(task, rule) local rep_accepted = 0.0 local rep_rejected = 0.0 + rspamd_logger.debugm(N, task, 'dkim reputation tokens: %s', requests) + local function tokens_cb(err, token, values) nchecked = nchecked + 1 -- 2.47.3