commit 5f116f6: [Minor] Fix dmarc after change

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Dec 2 17:07:13 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-12-02 15:17:01 +0000
URL: https://github.com/rspamd/rspamd/commit/5f116f6edbeffd33ef0cbdbaf893c2587f4ae784

[Minor] Fix dmarc after change

---
 src/plugins/dkim_check.c  | 3 ++-
 src/plugins/lua/dmarc.lua | 2 +-
 src/plugins/lua/spf.lua   | 4 ++++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c
index 3a88d9bb6..133feef2f 100644
--- a/src/plugins/dkim_check.c
+++ b/src/plugins/dkim_check.c
@@ -1121,7 +1121,8 @@ dkim_symbol_callback (struct rspamd_task *task,
 	GError *err = NULL;
 	struct rspamd_mime_header *rh, *rh_cur;
 	struct dkim_check_result *res = NULL, *cur;
-	guint checked = 0, *dmarc_checks;
+	guint checked = 0;
+	gdouble *dmarc_checks;
 	struct dkim_ctx *dkim_module_ctx = dkim_get_context (task->cfg);
 
 	/* Allow dmarc */
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua
index c2fc4d9bb..08d9732d9 100644
--- a/src/plugins/lua/dmarc.lua
+++ b/src/plugins/lua/dmarc.lua
@@ -559,7 +559,7 @@ local function dmarc_callback(task)
   local hfromdom = ((from or E)[1] or E).domain
   local dmarc_domain
   local ip_addr = task:get_ip()
-  local dmarc_checks = task:get_mempool():get_variable('dmarc_checks', 'int') or 0
+  local dmarc_checks = task:get_mempool():get_variable('dmarc_checks', 'double') or 0
   local seen_invalid = false
 
   if dmarc_checks ~= 2 then
diff --git a/src/plugins/lua/spf.lua b/src/plugins/lua/spf.lua
index 2e4492b33..62f147f91 100644
--- a/src/plugins/lua/spf.lua
+++ b/src/plugins/lua/spf.lua
@@ -126,6 +126,10 @@ local function spf_check_callback(task)
       local sym = flag_to_symbol(flags)
       task:insert_result(sym, 1.0, err)
     end
+
+    local dmarc_checks = task:get_mempool():get_variable('dmarc_checks', 'double') or 0
+    dmarc_checks = dmarc_checks + 1
+    task:get_mempool():set_variable('dmarc_checks', dmarc_checks)
   end
 
   rspamd_spf.resolve(task, spf_resolved_cb)


More information about the Commits mailing list