[Rspamd] Pushover: Fixes

This commit is contained in:
andryyy 2020-04-16 22:29:01 +02:00
parent 47a15c21aa
commit 35d3586950
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF

View File

@ -202,12 +202,21 @@ foreach ($rcpt_final_mailboxes as $rcpt_final) {
$senders = explode(',', $api_data['senders']); $senders = explode(',', $api_data['senders']);
$senders = array_filter($senders); $senders = array_filter($senders);
$senders_regex = $api_data['senders_regex']; $senders_regex = $api_data['senders_regex'];
$sender_validated = true; $sender_validated = false;
if (!empty($senders_regex) && !preg_match($senders_regex, $sender)) { if (empty($senders) && empty($senders_regex)) {
$sender_validated = false; $sender_validated = true;
} }
if (!empty($senders) && !in_array($sender, $senders)) { else {
$sender_validated = false; if (!empty($senders)) {
if (in_array($sender, $senders)) {
$sender_validated = true;
}
}
if (!empty($senders_regex) && $sender_validated !== true) {
if (preg_match($senders_regex, $sender)) {
$sender_validated = true;
}
}
} }
if ($sender_validated === false) { if ($sender_validated === false) {
error_log("NOTIFY: pushover pipe: skipping unwanted sender " . $sender); error_log("NOTIFY: pushover pipe: skipping unwanted sender " . $sender);