aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-02-25 15:27:33 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-02-25 15:27:33 +0000
commit33c00d45023cdfd0cc1f53f149a1fe2e4c8ebc4c (patch)
tree9647c010001139ebedceb123bca6ef569c1c4ccc /lualib/rspamadm
parent7b5b413b40ce995c849aa558347502ed862d8d10 (diff)
downloadrspamd-33c00d45023cdfd0cc1f53f149a1fe2e4c8ebc4c.tar.gz
rspamd-33c00d45023cdfd0cc1f53f149a1fe2e4c8ebc4c.zip
[Fix] Avoid stupid practice of polluting module's internal state
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r--lualib/rspamadm/dmarc_report.lua22
1 files changed, 15 insertions, 7 deletions
diff --git a/lualib/rspamadm/dmarc_report.lua b/lualib/rspamadm/dmarc_report.lua
index 42c801eed..a54e12d67 100644
--- a/lualib/rspamadm/dmarc_report.lua
+++ b/lualib/rspamadm/dmarc_report.lua
@@ -19,7 +19,6 @@ local lua_util = require "lua_util"
local logger = require "rspamd_logger"
local lua_redis = require "lua_redis"
local dmarc_common = require "plugins/dmarc"
-local lupa = require "lupa"
local rspamd_mempool = require "rspamd_mempool"
local rspamd_url = require "rspamd_url"
local rspamd_text = require "rspamd_text"
@@ -176,8 +175,6 @@ local function escape_xml(input)
return ''
end
--- Enable xml escaping in lupa templates
-lupa.filters.escape_xml = escape_xml
-- Creates report XML header
local function report_header(reporting_domain, report_start, report_end, domain_policy)
@@ -211,7 +208,10 @@ local function report_header(reporting_domain, report_start, report_end, domain_
report_end = report_end,
domain_policy = domain_policy,
reporting_domain = reporting_domain,
- }, true)
+ }, true, false,
+ {
+ escape_xml = escape_xml
+ })
end
-- Generate xml entry for a preprocessed redis row
@@ -248,7 +248,10 @@ local function entry_to_xml(data)
</auth_results>
</record>
]]
- return lua_util.jinja_template(xml_template, { data = data }, true)
+ return lua_util.jinja_template(xml_template, { data = data }, true,
+ false, {
+ escape_xml = escape_xml
+ })
end
-- Process a report entry stored in Redis splitting it to a lua table
@@ -534,10 +537,15 @@ local function prepare_report(opts, start_time, end_time, rep_key)
message_id = rspamd_util.random_hex(16) .. '@' .. report_settings.msgid_from,
report_start = start_time,
report_end = end_time
- }, true)
+ }, true,
+ false, {
+ escape_xml = escape_xml
+ })
local rfooter = lua_util.jinja_template(report_footer, {
uuid = uuid,
- }, true)
+ }, true, false, {
+ escape_xml = escape_xml
+ })
local message = rspamd_text.fromtable {
(rhead:gsub("\n", "\r\n")),
rspamd_util.encode_base64(rspamd_util.gzip_compress(xml_to_compress), 73),