]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Allow default_headers_order to be configured in milter_headers
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 7 Dec 2025 15:05:13 +0000 (15:05 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 7 Dec 2025 15:05:13 +0000 (15:05 +0000)
Fixes #5781: The default_headers_order setting was defined in the plugin
but never read from the configuration file. Add schema validation and
config loading for this option.

src/plugins/lua/milter_headers.lua

index e13b5a9ec8365514c4373af18b86631c13b0854c..26406a5c4b2b305fb96408b3c848b9c09f4bcd44 100644 (file)
@@ -650,6 +650,7 @@ local config_schema = T.table({
   authenticated_headers = T.array(T.string()):optional():doc({ summary = "Headers for authenticated users" }),
   extended_headers_rcpt = lua_maps.map_schema:optional():doc({ summary = "Recipients for extended headers" }),
   custom = T.table({}, { open = true, extra = T.string() }):optional():doc({ summary = "Custom header definitions" }),
+  default_headers_order = T.number():optional():doc({ summary = "Default order for headers (1 to insert after first Received header)" }),
 }, {
   open = true
 }):doc({ summary = "Milter headers plugin configuration" })
@@ -738,6 +739,10 @@ if type(opts['skip_all']) == 'boolean' then
   settings.skip_all = opts['skip_all']
 end
 
+if type(opts['default_headers_order']) == 'number' then
+  settings.default_headers_order = opts['default_headers_order']
+end
+
 for _, s in ipairs(opts['use']) do
   if not have_routine[s] then
     activate_routine(s)