commit 480bfeb: [Minor] milter_headers: new option skip_all

GitHub noreply at github.com
Mon Jan 18 16:14:15 UTC 2021


Author: Tobias Mädel
Date: 2021-01-18 16:47:17 +0100
URL: https://github.com/rspamd/rspamd/commit/480bfebb1326bdc8dab0b8f0ff5c2103a593fd11 (refs/pull/3610/head)

[Minor] milter_headers: new option skip_all
This PR introduces the new configuration option "skip_all" for milter_headers.
This config option will skip the addition of extended spam headers for every mail, except those with recipients listed in the extended_headers_rcpt map.
---
 src/plugins/lua/milter_headers.lua | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua
index e88d85b3d..7dd590faa 100644
--- a/src/plugins/lua/milter_headers.lua
+++ b/src/plugins/lua/milter_headers.lua
@@ -35,6 +35,7 @@ local settings = {
   remove_upstream_spam_flag = true;
   skip_local = true,
   skip_authenticated = true,
+  skip_all = false,
   local_headers = {},
   authenticated_headers = {},
   routines = {
@@ -157,6 +158,9 @@ local function milter_headers(task)
       return found
     end
 
+    if settings.extended_headers_rcpt and match_extended_headers_rcpt() then
+      return false
+    end
 
     if settings.skip_local and not settings.local_headers[hdr] then
       local ip = task:get_ip()
@@ -167,7 +171,7 @@ local function milter_headers(task)
       if task:get_user() ~= nil then return true end
     end
 
-    if settings.extended_headers_rcpt and not match_extended_headers_rcpt() then
+    if settings.skip_all then
       return true
     end
 
@@ -637,6 +641,10 @@ if type(opts['skip_authenticated']) == 'boolean' then
   settings.skip_authenticated = opts['skip_authenticated']
 end
 
+if type(opts['skip_all']) == 'boolean' then
+  settings.skip_all = opts['skip_all']
+end
+
 for _, s in ipairs(opts['use']) do
   if not have_routine[s] then
     activate_routine(s)


More information about the Commits mailing list