commit 8a2ba3a: [Minor] Fix REPLYTO_ADDR_EQ_FROM for normalised addresses

Andrew Lewis nerf at judo.za.org
Thu Apr 29 15:42:04 UTC 2021


Author: Andrew Lewis
Date: 2021-04-29 10:31:59 +0200
URL: https://github.com/rspamd/rspamd/commit/8a2ba3a5c355209ac8db01bcf036ceb911f81258 (refs/pull/3739/head)

[Minor] Fix REPLYTO_ADDR_EQ_FROM for normalised addresses

---
 rules/headers_checks.lua                          | 2 +-
 test/functional/cases/280_rules.robot             | 3 +++
 test/functional/messages/replyto_addr_eq_from.eml | 5 +++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/rules/headers_checks.lua b/rules/headers_checks.lua
index f0f64daff..4613a7dd7 100644
--- a/rules/headers_checks.lua
+++ b/rules/headers_checks.lua
@@ -214,7 +214,7 @@ local check_replyto_id = rspamd_config:register_symbol({
     end
 
     -- See if Reply-To matches From in some way
-    local from = task:get_from(2)
+    local from = task:get_from{'mime', 'orig'}
     local from_h = get_raw_header(task, 'From')
     if not (from and from[1]) then
       return false
diff --git a/test/functional/cases/280_rules.robot b/test/functional/cases/280_rules.robot
index 5bab11016..ec8e12fb2 100644
--- a/test/functional/cases/280_rules.robot
+++ b/test/functional/cases/280_rules.robot
@@ -110,6 +110,9 @@ PHISH_SENDER_ROUTING_PART
   Scan File  ${TESTDIR}/messages/phish_sender6.eml
   Expect Symbol  FROM_INVALID
 
+REPLYTO_ADDR_EQ_FROM
+  Scan File  ${TESTDIR}/messages/replyto_addr_eq_from.eml
+  Expect Symbol  REPLYTO_ADDR_EQ_FROM
 
 
 *** Keywords ***
diff --git a/test/functional/messages/replyto_addr_eq_from.eml b/test/functional/messages/replyto_addr_eq_from.eml
new file mode 100644
index 000000000..8d61078fb
--- /dev/null
+++ b/test/functional/messages/replyto_addr_eq_from.eml
@@ -0,0 +1,5 @@
+From: "OMG" <kewl.example.20210428 at gmail.com>
+Reply-To: "GMO" <kewl.example.20210428 at gmail.com>
+Content-type: text/plain
+
+hi


More information about the Commits mailing list