[Rspamd] fix excluding alias from domain wide footer

This commit is contained in:
FreddleSpl0it 2023-11-27 16:20:44 +01:00
parent d2e3867893
commit b3ac94115e
No known key found for this signature in database
GPG Key ID: 00E14E7634F4BEC5
2 changed files with 7 additions and 4 deletions

View File

@ -43,6 +43,8 @@ $headers = getallheaders();
$domain = $headers['Domain'];
// Get Username
$username = $headers['Username'];
// Get From
$from = $headers['From'];
// define empty footer
$empty_footer = json_encode(array(
'html' => '',
@ -50,7 +52,7 @@ $empty_footer = json_encode(array(
'vars' => array()
));
error_log("FOOTER: checking for domain " . $domain . " and user " . $username . PHP_EOL);
error_log("FOOTER: checking for domain " . $domain . ", user " . $username . " and address " . $from . PHP_EOL);
try {
$stmt = $pdo->prepare("SELECT `plain`, `html`, `mbox_exclude` FROM `domain_wide_footer`
@ -59,7 +61,7 @@ try {
':domain' => $domain
));
$footer = $stmt->fetch(PDO::FETCH_ASSOC);
if (in_array($username, json_decode($footer['mbox_exclude']))){
if (in_array($from, json_decode($footer['mbox_exclude']))){
$footer = false;
}
if (empty($footer)){

View File

@ -538,7 +538,8 @@ rspamd_config:register_symbol({
return false
end
local uname = uname:lower()
local env_from_domain = envfrom[1].domain:lower() -- get smtp from domain in lower case
local env_from_domain = envfrom[1].domain:lower()
local env_from_addr = envfrom[1].addr:lower()
-- determine newline type
local function newline(task)
@ -669,7 +670,7 @@ rspamd_config:register_symbol({
url='http://nginx:8081/footer.php',
body='',
callback=footer_cb,
headers={Domain=env_from_domain,Username=uname},
headers={Domain=env_from_domain,Username=uname,From=env_from_addr},
})
return true