From: Vsevolod Stakhov Date: Mon, 23 Jul 2018 14:30:28 +0000 (+0100) Subject: [Minor] Fix dkim reputation selector X-Git-Tag: 1.7.9~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a8425588002b80dc2196c1046597664f074863c;p=thirdparty%2Frspamd.git [Minor] Fix dkim reputation selector --- 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