[Web] Database schema test

master
André Peters 2018-02-17 09:50:58 +01:00
parent b81930e416
commit 2bdc3f94c0
2 changed files with 7 additions and 7 deletions

View File

@ -39,7 +39,7 @@ query = SELECT IF(EXISTS(
SELECT CONCAT('%u', '@', target_domain) FROM alias_domain SELECT CONCAT('%u', '@', target_domain) FROM alias_domain
WHERE alias_domain='%d' WHERE alias_domain='%d'
) )
) AND mailbox.tls_enforce_in = '1' AND mailbox.active = '1' ) AND json_extract(`attributes`, '$.tls_enforce_in') = '1' AND mailbox.active = '1'
), 'reject_plaintext_session', NULL) AS 'tls_enforce_in'; ), 'reject_plaintext_session', NULL) AS 'tls_enforce_in';
EOF EOF
@ -58,7 +58,7 @@ query = SELECT GROUP_CONCAT(transport SEPARATOR '') AS transport_maps
WHERE alias_domain = '%d' WHERE alias_domain = '%d'
) )
) )
AND mailbox.tls_enforce_out = '1' AND json_extract(`attributes`, '$.tls_enforce_out') = '1'
AND mailbox.active = '1' AND mailbox.active = '1'
), 'smtp_enforced_tls:', 'smtp:') AS 'transport' ), 'smtp_enforced_tls:', 'smtp:') AS 'transport'
UNION ALL UNION ALL

View File

@ -511,8 +511,8 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
if (in_array($address, $gotos)) { if (in_array($address, $gotos)) {
continue; continue;
} }
$domain = idn_to_ascii(substr(strrchr($address, '@'), 1)); $domain = idn_to_ascii(substr(strstr($address, '@'), 1));
$local_part = substr($address, 0, strripos($address, '@')); $local_part = strstr($address, '@', true);
$address = $local_part.'@'.$domain; $address = $local_part.'@'.$domain;
$stmt = $pdo->prepare("SELECT `address` FROM `alias` $stmt = $pdo->prepare("SELECT `address` FROM `alias`
WHERE `address`= :address OR `address` IN ( WHERE `address`= :address OR `address` IN (
@ -1713,8 +1713,8 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
$gotos = array_filter($gotos); $gotos = array_filter($gotos);
$goto = implode(",", $gotos); $goto = implode(",", $gotos);
} }
$domain = idn_to_ascii(substr(strrchr($address, '@'), 1)); $domain = idn_to_ascii(substr(strstr($address, '@'), 1));
$local_part = substr($address, 0, strripos($address, '@')); $local_part = strstr($address, '@', true);
if (!hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $domain)) { if (!hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $domain)) {
$_SESSION['return'] = array( $_SESSION['return'] = array(
'type' => 'danger', 'type' => 'danger',
@ -3470,7 +3470,7 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
$addresses = $_data['address']; $addresses = $_data['address'];
} }
foreach ($addresses as $address) { foreach ($addresses as $address) {
$local_part = substr($address, 0, strripos($address, '@')); $local_part = strstr($address, '@', true);
$domain = mailbox('get', 'alias_details', $address)['domain']; $domain = mailbox('get', 'alias_details', $address)['domain'];
try { try {
$stmt = $pdo->prepare("SELECT `goto` FROM `alias` WHERE `address` = :address"); $stmt = $pdo->prepare("SELECT `goto` FROM `alias` WHERE `address` = :address");