summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-07-09 12:21:31 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-07-09 12:22:16 +0200
commitb29b6ee49c9b3f16cf5adf5cc49065aac2f72282 (patch)
tree87942505f937cf6b6e8271badc6542794fc8e77f /src/plugins
parent08c88c0e020987316a9acf761827ab268237e041 (diff)
downloadrspamd-b29b6ee49c9b3f16cf5adf5cc49065aac2f72282.tar.gz
rspamd-b29b6ee49c9b3f16cf5adf5cc49065aac2f72282.zip
[Feature] Milter headers: support adding/removing arbitrary headers from config
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/milter_headers.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua
index dcf8e9ffd..52cd874a6 100644
--- a/src/plugins/lua/milter_headers.lua
+++ b/src/plugins/lua/milter_headers.lua
@@ -35,6 +35,13 @@ local settings = {
authenticated_headers = {},
extended_headers_rcpt = {},
routines = {
+ ['remove-headers'] = {
+ headers = {},
+ },
+ ['add-headers'] = {
+ headers = {},
+ remove = 1,
+ },
['remove-header'] = {
remove = 1,
},
@@ -201,6 +208,21 @@ local function milter_headers(task)
end
end
+ routines['remove-headers'] = function()
+ if skip_wanted('remove-headers') then return end
+ for h, r in pairs(settings.routines['remove-headers'].headers) do
+ remove[h] = r
+ end
+ end
+
+ routines['add-headers'] = function()
+ if skip_wanted('add-headers') then return end
+ for h, r in pairs(settings.routines['add-headers'].headers) do
+ add[h] = r
+ remove[h] = settings.routines['add-headers'].remove
+ end
+ end
+
routines['x-rspamd-server'] = function()
if skip_wanted('x-rspamd-server') then return end
if settings.routines['x-rspamd-server'].remove then