commit 955fb06: [Minor] Store module that has set the pre-result

Vsevolod Stakhov vsevolod at rspamd.com
Mon Jan 2 21:49:03 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-01-02 21:48:13 +0000
URL: https://github.com/rspamd/rspamd/commit/955fb068cd72005c7277c5f0f3c2347144dbc6ea (HEAD -> master)

[Minor] Store module that has set the pre-result

---
 src/libserver/protocol.c          | 16 +++++++++++-----
 src/plugins/lua/history_redis.lua |  2 +-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index 9d83ae1db..380d80134 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -1211,14 +1211,20 @@ rspamd_scan_result_ucl (struct rspamd_task *task,
 		obj = top;
 	}
 
-	if (pr && pr->message && !(pr->flags & RSPAMD_PASSTHROUGH_NO_SMTP_MESSAGE)) {
-		/* Add smtp message if it does not exists: see #3269 for details */
-		if (ucl_object_lookup (task->messages, "smtp_message") == NULL) {
-			ucl_object_insert_key (task->messages,
-					ucl_object_fromstring_common (pr->message, 0, UCL_STRING_RAW),
+	if (pr) {
+		if (pr->message && !(pr->flags & RSPAMD_PASSTHROUGH_NO_SMTP_MESSAGE)) {
+			/* Add smtp message if it does not exists: see #3269 for details */
+			if (ucl_object_lookup(task->messages, "smtp_message") == NULL) {
+				ucl_object_insert_key(task->messages,
+					ucl_object_fromstring_common(pr->message, 0, UCL_STRING_RAW),
 					"smtp_message", 0,
 					false);
+			}
 		}
+
+		ucl_object_insert_key (obj,
+			ucl_object_fromstring (pr->module),
+			"passthrough_module", 0, false);
 	}
 
 	ucl_object_insert_key (obj,
diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua
index 01645a410..c203d354b 100644
--- a/src/plugins/lua/history_redis.lua
+++ b/src/plugins/lua/history_redis.lua
@@ -89,7 +89,7 @@ local function normalise_results(tbl, task)
   -- Convert stupid metric object
   if metric then
     tbl.symbols = {}
-    local symbols, others = fun.partition(function(k, v)
+    local symbols, others = fun.partition(function(_, v)
       return type(v) == 'table' and v.score
     end, metric)
 


More information about the Commits mailing list