]> source.dussan.org Git - rspamd.git/commitdiff
Add REPLYTO_EQ_TO_ADDR rule 2008/head
authorSteve Freegard <steve@stevefreegard.com>
Tue, 30 Jan 2018 18:24:19 +0000 (18:24 +0000)
committerSteve Freegard <steve@stevefreegard.com>
Tue, 30 Jan 2018 18:24:19 +0000 (18:24 +0000)
rules/headers_checks.lua

index e9f26117e9b0a71575a2cc6acb0e8752013b458e..334e0ab935d5860b4d3a56c30652bc2f7fcfc61b 100644 (file)
@@ -217,8 +217,14 @@ local check_replyto_id = rspamd_config:register_callback_symbol('CHECK_REPLYTO',
         elseif from[1].domain and rt[1].domain then
           if (util.strequal_caseless(from[1].domain, rt[1].domain)) then
             task:insert_result('REPLYTO_DOM_EQ_FROM_DOM', 1.0)
-          else
-            task:insert_result('REPLYTO_DOM_NEQ_FROM_DOM', 1.0)
+          else 
+            -- See if Reply-To matches the To address
+            local to = task:get_recipients(2)
+            if (to and to[1] and to[1].addr:lower() == rt[1].addr:lower()) then
+              task:insert_result('REPLYTO_EQ_TO_ADDR', 1.0)
+            else
+              task:insert_result('REPLYTO_DOM_NEQ_FROM_DOM', 1.0)
+           end
           end
         end
         -- See if the Display Names match
@@ -295,6 +301,15 @@ rspamd_config:register_symbol{
   description = 'Reply-To header has title',
   group = 'headers',
 }
+rspamd_config:register_symbol{
+  name = 'REPLYTO_EQ_TO_ADDR',
+  score = 5.0,
+  parent = check_replyto_id,
+  type = 'virtual',
+  description = 'Reply-To is the same as the To address',
+  group = 'headers',
+}
+
 rspamd_config:register_dependency(check_replyto_id, 'FROM_NAME_HAS_TITLE')
 
 local check_mime_id = rspamd_config:register_symbol{