mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-10-07 01:52:35 +00:00
[Rspamd] Fix CTE and boundary prefix in domain wide footer
This commit is contained in:
@@ -856,6 +856,8 @@ rspamd_config:register_symbol({
|
|||||||
|
|
||||||
local seen_cte
|
local seen_cte
|
||||||
local newline_s = newline(task)
|
local newline_s = newline(task)
|
||||||
|
-- use the CTE add_text_footer actually applied
|
||||||
|
local new_cte = rewrite.new_cte or 'quoted-printable'
|
||||||
|
|
||||||
local function rewrite_ct_cb(name, hdr)
|
local function rewrite_ct_cb(name, hdr)
|
||||||
if rewrite.need_rewrite_ct then
|
if rewrite.need_rewrite_ct then
|
||||||
@@ -877,13 +879,13 @@ rspamd_config:register_symbol({
|
|||||||
return
|
return
|
||||||
elseif name:lower() == 'content-transfer-encoding' then
|
elseif name:lower() == 'content-transfer-encoding' then
|
||||||
out[#out + 1] = string.format('%s: %s',
|
out[#out + 1] = string.format('%s: %s',
|
||||||
'Content-Transfer-Encoding', 'quoted-printable')
|
'Content-Transfer-Encoding', new_cte)
|
||||||
-- update Content-Transfer-Encoding header
|
-- update Content-Transfer-Encoding header
|
||||||
task:set_milter_reply({
|
task:set_milter_reply({
|
||||||
remove_headers = {['Content-Transfer-Encoding'] = 0},
|
remove_headers = {['Content-Transfer-Encoding'] = 0},
|
||||||
})
|
})
|
||||||
task:set_milter_reply({
|
task:set_milter_reply({
|
||||||
add_headers = {['Content-Transfer-Encoding'] = 'quoted-printable'}
|
add_headers = {['Content-Transfer-Encoding'] = new_cte}
|
||||||
})
|
})
|
||||||
seen_cte = true
|
seen_cte = true
|
||||||
return
|
return
|
||||||
@@ -895,7 +897,7 @@ rspamd_config:register_symbol({
|
|||||||
task:headers_foreach(rewrite_ct_cb, {full = true})
|
task:headers_foreach(rewrite_ct_cb, {full = true})
|
||||||
|
|
||||||
if not seen_cte and rewrite.need_rewrite_ct then
|
if not seen_cte and rewrite.need_rewrite_ct then
|
||||||
out[#out + 1] = string.format('%s: %s', 'Content-Transfer-Encoding', 'quoted-printable')
|
out[#out + 1] = string.format('%s: %s', 'Content-Transfer-Encoding', new_cte)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- End of headers
|
-- End of headers
|
||||||
@@ -914,7 +916,7 @@ rspamd_config:register_symbol({
|
|||||||
out_parts[#out_parts + 1] = o
|
out_parts[#out_parts + 1] = o
|
||||||
out_parts[#out_parts + 1] = newline_s
|
out_parts[#out_parts + 1] = newline_s
|
||||||
else
|
else
|
||||||
local removePrefix = "--\x0D\x0AContent-Type"
|
local removePrefix = "--\x0D\x0AContent-"
|
||||||
if string.lower(string.sub(tostring(o[1]), 1, string.len(removePrefix))) == string.lower(removePrefix) then
|
if string.lower(string.sub(tostring(o[1]), 1, string.len(removePrefix))) == string.lower(removePrefix) then
|
||||||
o[1] = string.sub(tostring(o[1]), string.len("--\x0D\x0A") + 1)
|
o[1] = string.sub(tostring(o[1]), string.len("--\x0D\x0A") + 1)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user