[Rspamd] fix excluding alias from domain wide footer
This commit is contained in:
parent
d2e3867893
commit
b3ac94115e
@ -43,6 +43,8 @@ $headers = getallheaders();
|
|||||||
$domain = $headers['Domain'];
|
$domain = $headers['Domain'];
|
||||||
// Get Username
|
// Get Username
|
||||||
$username = $headers['Username'];
|
$username = $headers['Username'];
|
||||||
|
// Get From
|
||||||
|
$from = $headers['From'];
|
||||||
// define empty footer
|
// define empty footer
|
||||||
$empty_footer = json_encode(array(
|
$empty_footer = json_encode(array(
|
||||||
'html' => '',
|
'html' => '',
|
||||||
@ -50,7 +52,7 @@ $empty_footer = json_encode(array(
|
|||||||
'vars' => 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 {
|
try {
|
||||||
$stmt = $pdo->prepare("SELECT `plain`, `html`, `mbox_exclude` FROM `domain_wide_footer`
|
$stmt = $pdo->prepare("SELECT `plain`, `html`, `mbox_exclude` FROM `domain_wide_footer`
|
||||||
@ -59,7 +61,7 @@ try {
|
|||||||
':domain' => $domain
|
':domain' => $domain
|
||||||
));
|
));
|
||||||
$footer = $stmt->fetch(PDO::FETCH_ASSOC);
|
$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;
|
$footer = false;
|
||||||
}
|
}
|
||||||
if (empty($footer)){
|
if (empty($footer)){
|
||||||
|
@ -538,7 +538,8 @@ rspamd_config:register_symbol({
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local uname = uname:lower()
|
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
|
-- determine newline type
|
||||||
local function newline(task)
|
local function newline(task)
|
||||||
@ -669,7 +670,7 @@ rspamd_config:register_symbol({
|
|||||||
url='http://nginx:8081/footer.php',
|
url='http://nginx:8081/footer.php',
|
||||||
body='',
|
body='',
|
||||||
callback=footer_cb,
|
callback=footer_cb,
|
||||||
headers={Domain=env_from_domain,Username=uname},
|
headers={Domain=env_from_domain,Username=uname,From=env_from_addr},
|
||||||
})
|
})
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user