From 2e42cfbd5f47e71ecfa179828b5fab1d74b3351b Mon Sep 17 00:00:00 2001 From: heavygale Date: Sat, 5 Oct 2019 17:29:16 +0200 Subject: [PATCH 1/7] Added sogo_access acl for domain admin - new sogo_access acl is added for domain admins - changing sogo_acces on a mailbox is only allowed if attempted by admin or by an domain admin with sogo_access acl. - new Mailboxes are created with SOGo access if "$MAILBOX_DEFAULT_ATTRIBUTES['sogo_access'] = true;" AND if created by admin or domain admin with sogo_access acl. Otherwise sogo_access is forbidden for the new mailbox. --- data/web/admin.php | 10 +++--- data/web/edit.php | 4 +-- data/web/inc/functions.mailbox.inc.php | 50 +++++++++++++++----------- data/web/inc/init_db.inc.php | 39 ++++++++++---------- data/web/lang/lang.de.php | 3 +- data/web/lang/lang.en.php | 2 +- 6 files changed, 60 insertions(+), 48 deletions(-) diff --git a/data/web/admin.php b/data/web/admin.php index d78f3621..b08fc262 100644 --- a/data/web/admin.php +++ b/data/web/admin.php @@ -200,7 +200,7 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC - +

Rspamd UI

@@ -487,7 +487,7 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC - +
@@ -654,7 +654,7 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC if (!empty($f2b_data['active_bans'])): foreach ($f2b_data['active_bans'] as $active_bans): ?> -

() - +

() - @@ -1005,8 +1005,8 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC

- - + +
diff --git a/data/web/edit.php b/data/web/edit.php index 10896077..cb031e4d 100644 --- a/data/web/edit.php +++ b/data/web/edit.php @@ -712,8 +712,8 @@ if (isset($_SESSION['mailcow_cc_role'])) {
- -
+
+
diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index 740fca3f..ccd7e1b0 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -46,7 +46,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $stmt = $pdo->prepare("SELECT `domain` FROM `mailbox` WHERE `username` = :username"); $stmt->execute(array(':username' => $_SESSION['mailcow_cc_username'])); $domain = $stmt->fetch(PDO::FETCH_ASSOC)['domain']; - $validity = strtotime("+".$_data["validity"]." hour"); + $validity = strtotime("+".$_data["validity"]." hour"); $letters = 'abcefghijklmnopqrstuvwxyz1234567890'; $random_name = substr(str_shuffle($letters), 0, 24); $stmt = $pdo->prepare("INSERT INTO `spamalias` (`address`, `goto`, `validity`) VALUES @@ -485,7 +485,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { 'msg' => 'comment_too_long' ); return false; - } + } if (empty($addresses[0])) { $_SESSION['return'][] = array( 'type' => 'danger', @@ -810,13 +810,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $name = $local_part; } $active = intval($_data['active']); - $quota_b = ($quota_m * 1048576); + $quota_b = ($quota_m * 1048576); $mailbox_attrs = json_encode( array( 'force_pw_update' => strval(intval($MAILBOX_DEFAULT_ATTRIBUTES['force_pw_update'])), 'tls_enforce_in' => strval(intval($MAILBOX_DEFAULT_ATTRIBUTES['tls_enforce_in'])), 'tls_enforce_out' => strval(intval($MAILBOX_DEFAULT_ATTRIBUTES['tls_enforce_out'])), - 'sogo_access' => strval(intval($MAILBOX_DEFAULT_ATTRIBUTES['sogo_access'])), + 'sogo_access' => (!isset($_SESSION['acl']['sogo_access']) || $_SESSION['acl']['sogo_access'] != "1") ? 0 : strval(intval($MAILBOX_DEFAULT_ATTRIBUTES['sogo_access'])), 'mailbox_format' => strval($MAILBOX_DEFAULT_ATTRIBUTES['mailbox_format']), 'quarantine_notification' => strval($MAILBOX_DEFAULT_ATTRIBUTES['quarantine_notification']) ) @@ -841,7 +841,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { WHERE `domain` = :domain"); $stmt->execute(array(':domain' => $domain)); $DomainData = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt = $pdo->prepare("SELECT + $stmt = $pdo->prepare("SELECT COUNT(*) as count, COALESCE(ROUND(SUM(`quota`)/1048576), 0) as `quota` FROM `mailbox` @@ -945,7 +945,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); return false; } - $stmt = $pdo->prepare("INSERT INTO `mailbox` (`username`, `password`, `name`, `quota`, `local_part`, `domain`, `attributes`, `active`) + $stmt = $pdo->prepare("INSERT INTO `mailbox` (`username`, `password`, `name`, `quota`, `local_part`, `domain`, `attributes`, `active`) VALUES (:username, :password_hashed, :name, :quota_b, :local_part, :domain, :mailbox_attrs, :active)"); $stmt->execute(array( ':username' => $username, @@ -1073,7 +1073,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); return false; } - $stmt = $pdo->prepare("INSERT INTO `mailbox` (`username`, `password`, `name`, `quota`, `local_part`, `domain`, `active`, `multiple_bookings`, `kind`) + $stmt = $pdo->prepare("INSERT INTO `mailbox` (`username`, `password`, `name`, `quota`, `local_part`, `domain`, `active`, `multiple_bookings`, `kind`) VALUES (:name, 'RESOURCE', :description, 0, :local_part, :domain, :active, :multiple_bookings, :kind)"); $stmt->execute(array( ':name' => $name, @@ -1249,7 +1249,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { 'msg' => 'access_denied' ); continue; - } + } $stmt = $pdo->prepare("UPDATE `mailbox` SET `attributes` = JSON_SET(`attributes`, '$.quarantine_notification', :quarantine_notification) WHERE `username` = :username"); @@ -1360,7 +1360,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { continue; } $validity = round((int)time() + ($_data['validity'] * 3600)); - $stmt = $pdo->prepare("UPDATE `spamalias` SET `validity` = :validity WHERE + $stmt = $pdo->prepare("UPDATE `spamalias` SET `validity` = :validity WHERE `address` = :address"); $stmt->execute(array( ':address' => $address, @@ -1888,7 +1888,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); continue; } - $stmt = $pdo->prepare("UPDATE `domain` SET + $stmt = $pdo->prepare("UPDATE `domain` SET `description` = :description, `gal` = :gal WHERE `domain` = :domain"); @@ -1928,7 +1928,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { continue; } // todo: should be using api here - $stmt = $pdo->prepare("SELECT + $stmt = $pdo->prepare("SELECT COUNT(*) AS count, MAX(COALESCE(ROUND(`quota`/1048576), 0)) AS `biggest_mailbox`, COALESCE(ROUND(SUM(`quota`)/1048576), 0) AS `quota_all` @@ -2009,7 +2009,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); continue; } - $stmt = $pdo->prepare("UPDATE `domain` SET + $stmt = $pdo->prepare("UPDATE `domain` SET `relay_all_recipients` = :relay_all_recipients, `backupmx` = :backupmx, `gal` = :gal, @@ -2071,7 +2071,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $domain = $is_now['domain']; $quota_b = $quota_m * 1048576; $password = (!empty($_data['password'])) ? $_data['password'] : null; - $password2 = (!empty($_data['password2'])) ? $_data['password2'] : null; + $password2 = (!empty($_data['password2'])) ? $_data['password2'] : null; } else { $_SESSION['return'][] = array( @@ -2119,6 +2119,16 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); continue; } + // if already 1 == ok + if ((!isset($_SESSION['acl']['sogo_access']) || $_SESSION['acl']['sogo_access'] != "1") && + (intval($_data['sogo_access']) == 0 && intval($is_now['attributes']['sogo_access'] != 0))) { + $_SESSION['return'][] = array( + 'type' => 'danger', + 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), + 'msg' => 'access_denied' + ); + return false; + } $extra_acls = array(); if (isset($_data['extended_sender_acl'])) { if (!isset($_SESSION['acl']['extend_sender_acl']) || $_SESSION['acl']['extend_sender_acl'] != "1" ) { @@ -2517,14 +2527,14 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { } $stmt = $pdo->prepare("SELECT `domain` FROM `domain` WHERE `domain` NOT IN ( - SELECT REPLACE(`send_as`, '@', '') FROM `sender_acl` + SELECT REPLACE(`send_as`, '@', '') FROM `sender_acl` WHERE `logged_in_as` = :logged_in_as1 AND `external` = '0' AND `send_as` LIKE '@%') UNION SELECT '*' FROM `domain` WHERE '*' NOT IN ( - SELECT `send_as` FROM `sender_acl` + SELECT `send_as` FROM `sender_acl` WHERE `logged_in_as` = :logged_in_as2 AND `external` = '0' )"); @@ -2546,7 +2556,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $stmt = $pdo->prepare("SELECT `address` FROM `alias` WHERE `goto` != :goto AND `address` NOT IN ( - SELECT `send_as` FROM `sender_acl` + SELECT `send_as` FROM `sender_acl` WHERE `logged_in_as` = :logged_in_as AND `external` = '0' AND `send_as` NOT LIKE '@%')"); @@ -3074,11 +3084,11 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { if (!empty($row)) { $_data = $row['target_domain']; } - $stmt = $pdo->prepare("SELECT + $stmt = $pdo->prepare("SELECT `domain`, `description`, `aliases`, - `mailboxes`, + `mailboxes`, `defquota`, `maxquota`, `quota`, @@ -3096,7 +3106,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':domain' => $_data )); $row = $stmt->fetch(PDO::FETCH_ASSOC); - if (empty($row)) { + if (empty($row)) { return false; } $stmt = $pdo->prepare("SELECT COUNT(*) AS `count`, @@ -3724,7 +3734,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { curl_setopt($curl, CURLOPT_HTTPHEADER,array('Content-Type: text/xml')); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_POSTFIELDS, 'user:' . $username . ''); + curl_setopt($curl, CURLOPT_POSTFIELDS, 'user:' . $username . ''); curl_setopt($curl, CURLOPT_TIMEOUT, 30); $response = curl_exec($curl); if ($response === false) { diff --git a/data/web/inc/init_db.inc.php b/data/web/inc/init_db.inc.php index e1daed63..83a427e9 100644 --- a/data/web/inc/init_db.inc.php +++ b/data/web/inc/init_db.inc.php @@ -29,7 +29,7 @@ function init_db_schema() { SELECT logged_in_as, IFNULL(GROUP_CONCAT(send_as SEPARATOR ' '), '') AS send_as_acl FROM sender_acl WHERE send_as NOT LIKE '@%' GROUP BY logged_in_as;", - // END + // END "grouped_sender_acl_external" => "CREATE VIEW grouped_sender_acl_external (username, send_as_acl) AS SELECT logged_in_as, IFNULL(GROUP_CONCAT(send_as SEPARATOR ' '), '') AS send_as_acl FROM sender_acl WHERE send_as NOT LIKE '@%' AND external = '1' @@ -474,6 +474,7 @@ function init_db_schema() { "syncjobs" => "TINYINT(1) NOT NULL DEFAULT '1'", "quarantine" => "TINYINT(1) NOT NULL DEFAULT '1'", "login_as" => "TINYINT(1) NOT NULL DEFAULT '1'", + "sogo_access" => "TINYINT(1) NOT NULL DEFAULT '1'", "bcc_maps" => "TINYINT(1) NOT NULL DEFAULT '1'", "filters" => "TINYINT(1) NOT NULL DEFAULT '1'", "ratelimit" => "TINYINT(1) NOT NULL DEFAULT '1'", @@ -871,7 +872,7 @@ function init_db_schema() { $stmt = $pdo->query("SHOW TABLES LIKE 'mailbox'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { - $stmt = $pdo->query("SHOW COLUMNS FROM `mailbox` LIKE '%tls_enforce%'"); + $stmt = $pdo->query("SHOW COLUMNS FROM `mailbox` LIKE '%tls_enforce%'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { $stmt = $pdo->query("SELECT `username`, `tls_enforce_in`, `tls_enforce_out` FROM `mailbox`"); @@ -882,7 +883,7 @@ function init_db_schema() { } } } - $stmt = $pdo->query("SHOW TABLES LIKE '" . $table . "'"); + $stmt = $pdo->query("SHOW TABLES LIKE '" . $table . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { $stmt = $pdo->prepare("SELECT CONCAT('ALTER TABLE ', `table_schema`, '.', `table_name`, ' DROP FOREIGN KEY ', `constraint_name`, ';') AS `FKEY_DROP` FROM `information_schema`.`table_constraints` @@ -893,7 +894,7 @@ function init_db_schema() { $pdo->query($row['FKEY_DROP']); } foreach($properties['cols'] as $column => $type) { - $stmt = $pdo->query("SHOW COLUMNS FROM `" . $table . "` LIKE '" . $column . "'"); + $stmt = $pdo->query("SHOW COLUMNS FROM `" . $table . "` LIKE '" . $column . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results == 0) { if (strpos($type, 'AUTO_INCREMENT') !== false) { @@ -915,7 +916,7 @@ function init_db_schema() { if (strtolower($key_type) == 'primary') { foreach ($key_content as $key_values) { $fields = "`" . implode("`, `", $key_values) . "`"; - $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = 'PRIMARY'"); + $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = 'PRIMARY'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); $is_drop = ($num_results != 0) ? "DROP PRIMARY KEY, " : ""; $pdo->query("ALTER TABLE `" . $table . "` " . $is_drop . "ADD PRIMARY KEY (" . $fields . ")"); @@ -924,7 +925,7 @@ function init_db_schema() { if (strtolower($key_type) == 'key') { foreach ($key_content as $key_name => $key_values) { $fields = "`" . implode("`, `", $key_values) . "`"; - $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); + $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); $is_drop = ($num_results != 0) ? "DROP INDEX `" . $key_name . "`, " : ""; $pdo->query("ALTER TABLE `" . $table . "` " . $is_drop . "ADD KEY `" . $key_name . "` (" . $fields . ")"); @@ -933,7 +934,7 @@ function init_db_schema() { if (strtolower($key_type) == 'unique') { foreach ($key_content as $key_name => $key_values) { $fields = "`" . implode("`, `", $key_values) . "`"; - $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); + $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); $is_drop = ($num_results != 0) ? "DROP INDEX `" . $key_name . "`, " : ""; $pdo->query("ALTER TABLE `" . $table . "` " . $is_drop . "ADD UNIQUE KEY `" . $key_name . "` (" . $fields . ")"); @@ -942,7 +943,7 @@ function init_db_schema() { if (strtolower($key_type) == 'fkey') { foreach ($key_content as $key_name => $key_values) { $fields = "`" . implode("`, `", $key_values) . "`"; - $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); + $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { $pdo->query("ALTER TABLE `" . $table . "` DROP INDEX `" . $key_name . "`"); @@ -954,8 +955,8 @@ function init_db_schema() { } } // Drop all vanished columns - $stmt = $pdo->query("SHOW COLUMNS FROM `" . $table . "`"); - $cols_in_table = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt = $pdo->query("SHOW COLUMNS FROM `" . $table . "`"); + $cols_in_table = $stmt->fetchAll(PDO::FETCH_ASSOC); while ($row = array_shift($cols_in_table)) { if (!array_key_exists($row['Field'], $properties['cols'])) { $pdo->query("ALTER TABLE `" . $table . "` DROP COLUMN `" . $row['Field'] . "`;"); @@ -963,8 +964,8 @@ function init_db_schema() { } // Step 1: Get all non-primary keys, that currently exist and those that should exist - $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE `Key_name` != 'PRIMARY'"); - $keys_in_table = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE `Key_name` != 'PRIMARY'"); + $keys_in_table = $stmt->fetchAll(PDO::FETCH_ASSOC); $keys_to_exist = array(); if (isset($properties['keys']['unique']) && is_array($properties['keys']['unique'])) { foreach ($properties['keys']['unique'] as $key_name => $key_values) { @@ -990,7 +991,7 @@ function init_db_schema() { } // Step 3: Drop all vanished primary keys if (!isset($properties['keys']['primary'])) { - $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = 'PRIMARY'"); + $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = 'PRIMARY'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { $pdo->query("ALTER TABLE `" . $table . "` DROP PRIMARY KEY"); @@ -1049,8 +1050,8 @@ function init_db_schema() { // Create events to clean database $events[] = 'DROP EVENT IF EXISTS clean_spamalias; DELIMITER // -CREATE EVENT clean_spamalias -ON SCHEDULE EVERY 1 DAY DO +CREATE EVENT clean_spamalias +ON SCHEDULE EVERY 1 DAY DO BEGIN DELETE FROM spamalias WHERE validity < UNIX_TIMESTAMP(); END; @@ -1058,8 +1059,8 @@ END; DELIMITER ;'; $events[] = 'DROP EVENT IF EXISTS clean_oauth2; DELIMITER // -CREATE EVENT clean_oauth2 -ON SCHEDULE EVERY 1 DAY DO +CREATE EVENT clean_oauth2 +ON SCHEDULE EVERY 1 DAY DO BEGIN DELETE FROM oauth_refresh_tokens WHERE expires < NOW(); DELETE FROM oauth_access_tokens WHERE expires < NOW(); @@ -1072,7 +1073,7 @@ DELIMITER ;'; } // Inject admin if not exists - $stmt = $pdo->query("SELECT NULL FROM `admin`"); + $stmt = $pdo->query("SELECT NULL FROM `admin`"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results == 0) { $stmt = $pdo->query("INSERT INTO `admin` (`username`, `password`, `superadmin`, `created`, `modified`, `active`) @@ -1083,7 +1084,7 @@ DELIMITER ;'; $stmt = $pdo->query("DELETE FROM `admin` WHERE `username` NOT IN (SELECT `username` FROM `domain_admins`);"); } // Insert new DB schema version - $stmt = $pdo->query("REPLACE INTO `versions` (`application`, `version`) VALUES ('db_schema', '" . $db_version . "');"); + $stmt = $pdo->query("REPLACE INTO `versions` (`application`, `version`) VALUES ('db_schema', '" . $db_version . "');"); // Migrate attributes $stmt = $pdo->query("UPDATE `mailbox` SET `attributes` = '{}' WHERE `attributes` = '' OR `attributes` IS NULL;"); diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php index dadfb8de..6dd50bcd 100644 --- a/data/web/lang/lang.de.php +++ b/data/web/lang/lang.de.php @@ -420,6 +420,7 @@ $lang['acl']['recipient_maps'] = 'Empfängerumschreibungen'; $lang['acl']['unlimited_quota'] = 'Unendliche Quota für Mailboxen'; $lang['acl']['extend_sender_acl'] = 'Eingabe externer Absenderadressen erlauben'; $lang['acl']['prohibited'] = 'Untersagt durch Richtlinie'; +$lang['acl']['sogo_access'] = 'SOGo Zugriffsrecht'; $lang['edit']['extended_sender_acl'] = 'Externe Absenderadressen'; $lang['edit']['extended_sender_acl_info'] = 'Der DKIM Domainkey der externen Absenderdomain sollte in diesen Server importiert werden, falls vorhanden.
@@ -545,7 +546,7 @@ $lang['tfa']['confirm_totp_token'] = "Bitte bestätigen Sie die Änderung durch $lang['admin']['rspamd-com_settings'] = 'Rspamd docs - Ein Name wird automatisch generiert. Beispielinhalte zur Einsicht stehen nachstehend bereit.'; - + $lang['admin']['no_new_rows'] = 'Keine weiteren Zeilen vorhanden'; $lang['admin']['additional_rows'] = ' zusätzliche Zeilen geladen'; // parses to 'n additional rows were added' $lang['admin']['private_key'] = 'Private Key'; diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php index efdb80ee..8375c953 100644 --- a/data/web/lang/lang.en.php +++ b/data/web/lang/lang.en.php @@ -428,6 +428,7 @@ $lang['acl']['recipient_maps'] = 'Recipient maps'; $lang['acl']['unlimited_quota'] = 'Unlimited quota for mailboxes'; $lang['acl']['extend_sender_acl'] = 'Allow to extend sender ACL by external addresses'; $lang['acl']['prohibited'] = 'Prohibited by ACL'; +$lang['acl']['sogo_access'] = 'Grant access to SOGo'; $lang['edit']['extended_sender_acl'] = 'External sender addresses'; $lang['edit']['extended_sender_acl_info'] = 'A DKIM domain key should be imported, if available.
@@ -936,4 +937,3 @@ $lang['mailbox']['alias_domain_backupmx'] = 'Alias domain inactive for relay dom $lang['danger']['extra_acl_invalid'] = 'External sender address "%s" is invalid'; $lang['danger']['extra_acl_invalid_domain'] = 'External sender "%s" uses an invalid domain'; - From 292923a1cc9830a77a7966c7bb09d9c124e8d14f Mon Sep 17 00:00:00 2001 From: heavygale Date: Sat, 5 Oct 2019 17:34:25 +0200 Subject: [PATCH 2/7] Fix mistake in mailbox-edit --- data/web/inc/functions.mailbox.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index ccd7e1b0..8c7690a4 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -810,7 +810,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $name = $local_part; } $active = intval($_data['active']); - $quota_b = ($quota_m * 1048576); + $quota_b = ($quota_m * 1048576); $mailbox_attrs = json_encode( array( 'force_pw_update' => strval(intval($MAILBOX_DEFAULT_ATTRIBUTES['force_pw_update'])), @@ -2121,7 +2121,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { } // if already 1 == ok if ((!isset($_SESSION['acl']['sogo_access']) || $_SESSION['acl']['sogo_access'] != "1") && - (intval($_data['sogo_access']) == 0 && intval($is_now['attributes']['sogo_access'] != 0))) { + (intval($_data['sogo_access']) == 1 && intval($is_now['attributes']['sogo_access'] != 1))) { $_SESSION['return'][] = array( 'type' => 'danger', 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), From 48838d9fd7550df3da844a82e1e18f2f18cad2ee Mon Sep 17 00:00:00 2001 From: heavygale Date: Sat, 5 Oct 2019 18:07:46 +0200 Subject: [PATCH 3/7] Don't update sogo_access when editing without acl Disabled checkboxes send 0 even if checked -> don't change sogo_access at all, if mailbox gets edited by domain admin without sogo_access acl. --- data/web/inc/functions.mailbox.inc.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index 8c7690a4..1bdd4fbb 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -2065,7 +2065,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { if (!empty($is_now)) { $active = (isset($_data['active'])) ? intval($_data['active']) : $is_now['active_int']; (int)$force_pw_update = (isset($_data['force_pw_update'])) ? intval($_data['force_pw_update']) : intval($is_now['attributes']['force_pw_update']); - (int)$sogo_access = (isset($_data['sogo_access'])) ? intval($_data['sogo_access']) : intval($is_now['attributes']['sogo_access']); + (int)$sogo_access = (isset($_data['sogo_access']) && isset($_SESSION['acl']['sogo_access']) && $_SESSION['acl']['sogo_access'] == "1") ? intval($_data['sogo_access']) : intval($is_now['attributes']['sogo_access']); (int)$quota_m = (isset_has_content($_data['quota'])) ? intval($_data['quota']) : ($is_now['quota'] / 1048576); $name = (!empty($_data['name'])) ? ltrim(rtrim($_data['name'], '>'), '<') : $is_now['name']; $domain = $is_now['domain']; @@ -2119,16 +2119,6 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); continue; } - // if already 1 == ok - if ((!isset($_SESSION['acl']['sogo_access']) || $_SESSION['acl']['sogo_access'] != "1") && - (intval($_data['sogo_access']) == 1 && intval($is_now['attributes']['sogo_access'] != 1))) { - $_SESSION['return'][] = array( - 'type' => 'danger', - 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), - 'msg' => 'access_denied' - ); - return false; - } $extra_acls = array(); if (isset($_data['extended_sender_acl'])) { if (!isset($_SESSION['acl']['extend_sender_acl']) || $_SESSION['acl']['extend_sender_acl'] != "1" ) { From a997a2e46299f7235738e65004290f1fcc48e4ca Mon Sep 17 00:00:00 2001 From: heavygale Date: Sun, 6 Oct 2019 18:56:24 +0200 Subject: [PATCH 4/7] Undo automatic whitespace cleanup --- data/web/admin.php | 4 +-- data/web/edit.php | 2 +- data/web/inc/functions.mailbox.inc.php | 36 ++++++++++++------------ data/web/inc/init_db.inc.php | 38 +++++++++++++------------- data/web/lang/lang.de.php | 2 +- data/web/lang/lang.en.php | 2 +- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/data/web/admin.php b/data/web/admin.php index b08fc262..a4a014b9 100644 --- a/data/web/admin.php +++ b/data/web/admin.php @@ -200,7 +200,7 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC
- +

Rspamd UI

@@ -654,7 +654,7 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC if (!empty($f2b_data['active_bans'])): foreach ($f2b_data['active_bans'] as $active_bans): ?> -

() - +

() - diff --git a/data/web/edit.php b/data/web/edit.php index cb031e4d..9cda0fd9 100644 --- a/data/web/edit.php +++ b/data/web/edit.php @@ -712,7 +712,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {

- +
diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index 1bdd4fbb..f9fe0184 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -46,7 +46,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $stmt = $pdo->prepare("SELECT `domain` FROM `mailbox` WHERE `username` = :username"); $stmt->execute(array(':username' => $_SESSION['mailcow_cc_username'])); $domain = $stmt->fetch(PDO::FETCH_ASSOC)['domain']; - $validity = strtotime("+".$_data["validity"]." hour"); + $validity = strtotime("+".$_data["validity"]." hour"); $letters = 'abcefghijklmnopqrstuvwxyz1234567890'; $random_name = substr(str_shuffle($letters), 0, 24); $stmt = $pdo->prepare("INSERT INTO `spamalias` (`address`, `goto`, `validity`) VALUES @@ -485,7 +485,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { 'msg' => 'comment_too_long' ); return false; - } + } if (empty($addresses[0])) { $_SESSION['return'][] = array( 'type' => 'danger', @@ -841,7 +841,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { WHERE `domain` = :domain"); $stmt->execute(array(':domain' => $domain)); $DomainData = $stmt->fetch(PDO::FETCH_ASSOC); - $stmt = $pdo->prepare("SELECT + $stmt = $pdo->prepare("SELECT COUNT(*) as count, COALESCE(ROUND(SUM(`quota`)/1048576), 0) as `quota` FROM `mailbox` @@ -945,7 +945,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); return false; } - $stmt = $pdo->prepare("INSERT INTO `mailbox` (`username`, `password`, `name`, `quota`, `local_part`, `domain`, `attributes`, `active`) + $stmt = $pdo->prepare("INSERT INTO `mailbox` (`username`, `password`, `name`, `quota`, `local_part`, `domain`, `attributes`, `active`) VALUES (:username, :password_hashed, :name, :quota_b, :local_part, :domain, :mailbox_attrs, :active)"); $stmt->execute(array( ':username' => $username, @@ -1073,7 +1073,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); return false; } - $stmt = $pdo->prepare("INSERT INTO `mailbox` (`username`, `password`, `name`, `quota`, `local_part`, `domain`, `active`, `multiple_bookings`, `kind`) + $stmt = $pdo->prepare("INSERT INTO `mailbox` (`username`, `password`, `name`, `quota`, `local_part`, `domain`, `active`, `multiple_bookings`, `kind`) VALUES (:name, 'RESOURCE', :description, 0, :local_part, :domain, :active, :multiple_bookings, :kind)"); $stmt->execute(array( ':name' => $name, @@ -1249,7 +1249,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { 'msg' => 'access_denied' ); continue; - } + } $stmt = $pdo->prepare("UPDATE `mailbox` SET `attributes` = JSON_SET(`attributes`, '$.quarantine_notification', :quarantine_notification) WHERE `username` = :username"); @@ -1360,7 +1360,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { continue; } $validity = round((int)time() + ($_data['validity'] * 3600)); - $stmt = $pdo->prepare("UPDATE `spamalias` SET `validity` = :validity WHERE + $stmt = $pdo->prepare("UPDATE `spamalias` SET `validity` = :validity WHERE `address` = :address"); $stmt->execute(array( ':address' => $address, @@ -1888,7 +1888,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); continue; } - $stmt = $pdo->prepare("UPDATE `domain` SET + $stmt = $pdo->prepare("UPDATE `domain` SET `description` = :description, `gal` = :gal WHERE `domain` = :domain"); @@ -1928,7 +1928,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { continue; } // todo: should be using api here - $stmt = $pdo->prepare("SELECT + $stmt = $pdo->prepare("SELECT COUNT(*) AS count, MAX(COALESCE(ROUND(`quota`/1048576), 0)) AS `biggest_mailbox`, COALESCE(ROUND(SUM(`quota`)/1048576), 0) AS `quota_all` @@ -2009,7 +2009,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); continue; } - $stmt = $pdo->prepare("UPDATE `domain` SET + $stmt = $pdo->prepare("UPDATE `domain` SET `relay_all_recipients` = :relay_all_recipients, `backupmx` = :backupmx, `gal` = :gal, @@ -2071,7 +2071,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $domain = $is_now['domain']; $quota_b = $quota_m * 1048576; $password = (!empty($_data['password'])) ? $_data['password'] : null; - $password2 = (!empty($_data['password2'])) ? $_data['password2'] : null; + $password2 = (!empty($_data['password2'])) ? $_data['password2'] : null; } else { $_SESSION['return'][] = array( @@ -2517,14 +2517,14 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { } $stmt = $pdo->prepare("SELECT `domain` FROM `domain` WHERE `domain` NOT IN ( - SELECT REPLACE(`send_as`, '@', '') FROM `sender_acl` + SELECT REPLACE(`send_as`, '@', '') FROM `sender_acl` WHERE `logged_in_as` = :logged_in_as1 AND `external` = '0' AND `send_as` LIKE '@%') UNION SELECT '*' FROM `domain` WHERE '*' NOT IN ( - SELECT `send_as` FROM `sender_acl` + SELECT `send_as` FROM `sender_acl` WHERE `logged_in_as` = :logged_in_as2 AND `external` = '0' )"); @@ -2546,7 +2546,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $stmt = $pdo->prepare("SELECT `address` FROM `alias` WHERE `goto` != :goto AND `address` NOT IN ( - SELECT `send_as` FROM `sender_acl` + SELECT `send_as` FROM `sender_acl` WHERE `logged_in_as` = :logged_in_as AND `external` = '0' AND `send_as` NOT LIKE '@%')"); @@ -3074,11 +3074,11 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { if (!empty($row)) { $_data = $row['target_domain']; } - $stmt = $pdo->prepare("SELECT + $stmt = $pdo->prepare("SELECT `domain`, `description`, `aliases`, - `mailboxes`, + `mailboxes`, `defquota`, `maxquota`, `quota`, @@ -3096,7 +3096,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':domain' => $_data )); $row = $stmt->fetch(PDO::FETCH_ASSOC); - if (empty($row)) { + if (empty($row)) { return false; } $stmt = $pdo->prepare("SELECT COUNT(*) AS `count`, @@ -3724,7 +3724,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { curl_setopt($curl, CURLOPT_HTTPHEADER,array('Content-Type: text/xml')); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_POSTFIELDS, 'user:' . $username . ''); + curl_setopt($curl, CURLOPT_POSTFIELDS, 'user:' . $username . ''); curl_setopt($curl, CURLOPT_TIMEOUT, 30); $response = curl_exec($curl); if ($response === false) { diff --git a/data/web/inc/init_db.inc.php b/data/web/inc/init_db.inc.php index 83a427e9..0b19912e 100644 --- a/data/web/inc/init_db.inc.php +++ b/data/web/inc/init_db.inc.php @@ -29,7 +29,7 @@ function init_db_schema() { SELECT logged_in_as, IFNULL(GROUP_CONCAT(send_as SEPARATOR ' '), '') AS send_as_acl FROM sender_acl WHERE send_as NOT LIKE '@%' GROUP BY logged_in_as;", - // END + // END "grouped_sender_acl_external" => "CREATE VIEW grouped_sender_acl_external (username, send_as_acl) AS SELECT logged_in_as, IFNULL(GROUP_CONCAT(send_as SEPARATOR ' '), '') AS send_as_acl FROM sender_acl WHERE send_as NOT LIKE '@%' AND external = '1' @@ -872,7 +872,7 @@ function init_db_schema() { $stmt = $pdo->query("SHOW TABLES LIKE 'mailbox'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { - $stmt = $pdo->query("SHOW COLUMNS FROM `mailbox` LIKE '%tls_enforce%'"); + $stmt = $pdo->query("SHOW COLUMNS FROM `mailbox` LIKE '%tls_enforce%'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { $stmt = $pdo->query("SELECT `username`, `tls_enforce_in`, `tls_enforce_out` FROM `mailbox`"); @@ -883,7 +883,7 @@ function init_db_schema() { } } } - $stmt = $pdo->query("SHOW TABLES LIKE '" . $table . "'"); + $stmt = $pdo->query("SHOW TABLES LIKE '" . $table . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { $stmt = $pdo->prepare("SELECT CONCAT('ALTER TABLE ', `table_schema`, '.', `table_name`, ' DROP FOREIGN KEY ', `constraint_name`, ';') AS `FKEY_DROP` FROM `information_schema`.`table_constraints` @@ -894,7 +894,7 @@ function init_db_schema() { $pdo->query($row['FKEY_DROP']); } foreach($properties['cols'] as $column => $type) { - $stmt = $pdo->query("SHOW COLUMNS FROM `" . $table . "` LIKE '" . $column . "'"); + $stmt = $pdo->query("SHOW COLUMNS FROM `" . $table . "` LIKE '" . $column . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results == 0) { if (strpos($type, 'AUTO_INCREMENT') !== false) { @@ -916,7 +916,7 @@ function init_db_schema() { if (strtolower($key_type) == 'primary') { foreach ($key_content as $key_values) { $fields = "`" . implode("`, `", $key_values) . "`"; - $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = 'PRIMARY'"); + $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = 'PRIMARY'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); $is_drop = ($num_results != 0) ? "DROP PRIMARY KEY, " : ""; $pdo->query("ALTER TABLE `" . $table . "` " . $is_drop . "ADD PRIMARY KEY (" . $fields . ")"); @@ -925,7 +925,7 @@ function init_db_schema() { if (strtolower($key_type) == 'key') { foreach ($key_content as $key_name => $key_values) { $fields = "`" . implode("`, `", $key_values) . "`"; - $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); + $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); $is_drop = ($num_results != 0) ? "DROP INDEX `" . $key_name . "`, " : ""; $pdo->query("ALTER TABLE `" . $table . "` " . $is_drop . "ADD KEY `" . $key_name . "` (" . $fields . ")"); @@ -933,7 +933,7 @@ function init_db_schema() { } if (strtolower($key_type) == 'unique') { foreach ($key_content as $key_name => $key_values) { - $fields = "`" . implode("`, `", $key_values) . "`"; + $fields = "`" . implode("`, `", $key_values) . "`"; $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); $is_drop = ($num_results != 0) ? "DROP INDEX `" . $key_name . "`, " : ""; @@ -942,7 +942,7 @@ function init_db_schema() { } if (strtolower($key_type) == 'fkey') { foreach ($key_content as $key_name => $key_values) { - $fields = "`" . implode("`, `", $key_values) . "`"; + $fields = "`" . implode("`, `", $key_values) . "`"; $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { @@ -955,8 +955,8 @@ function init_db_schema() { } } // Drop all vanished columns - $stmt = $pdo->query("SHOW COLUMNS FROM `" . $table . "`"); - $cols_in_table = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt = $pdo->query("SHOW COLUMNS FROM `" . $table . "`"); + $cols_in_table = $stmt->fetchAll(PDO::FETCH_ASSOC); while ($row = array_shift($cols_in_table)) { if (!array_key_exists($row['Field'], $properties['cols'])) { $pdo->query("ALTER TABLE `" . $table . "` DROP COLUMN `" . $row['Field'] . "`;"); @@ -964,8 +964,8 @@ function init_db_schema() { } // Step 1: Get all non-primary keys, that currently exist and those that should exist - $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE `Key_name` != 'PRIMARY'"); - $keys_in_table = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE `Key_name` != 'PRIMARY'"); + $keys_in_table = $stmt->fetchAll(PDO::FETCH_ASSOC); $keys_to_exist = array(); if (isset($properties['keys']['unique']) && is_array($properties['keys']['unique'])) { foreach ($properties['keys']['unique'] as $key_name => $key_values) { @@ -991,7 +991,7 @@ function init_db_schema() { } // Step 3: Drop all vanished primary keys if (!isset($properties['keys']['primary'])) { - $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = 'PRIMARY'"); + $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = 'PRIMARY'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { $pdo->query("ALTER TABLE `" . $table . "` DROP PRIMARY KEY"); @@ -1050,8 +1050,8 @@ function init_db_schema() { // Create events to clean database $events[] = 'DROP EVENT IF EXISTS clean_spamalias; DELIMITER // -CREATE EVENT clean_spamalias -ON SCHEDULE EVERY 1 DAY DO +CREATE EVENT clean_spamalias +ON SCHEDULE EVERY 1 DAY DO BEGIN DELETE FROM spamalias WHERE validity < UNIX_TIMESTAMP(); END; @@ -1059,8 +1059,8 @@ END; DELIMITER ;'; $events[] = 'DROP EVENT IF EXISTS clean_oauth2; DELIMITER // -CREATE EVENT clean_oauth2 -ON SCHEDULE EVERY 1 DAY DO +CREATE EVENT clean_oauth2 +ON SCHEDULE EVERY 1 DAY DO BEGIN DELETE FROM oauth_refresh_tokens WHERE expires < NOW(); DELETE FROM oauth_access_tokens WHERE expires < NOW(); @@ -1073,7 +1073,7 @@ DELIMITER ;'; } // Inject admin if not exists - $stmt = $pdo->query("SELECT NULL FROM `admin`"); + $stmt = $pdo->query("SELECT NULL FROM `admin`"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results == 0) { $stmt = $pdo->query("INSERT INTO `admin` (`username`, `password`, `superadmin`, `created`, `modified`, `active`) @@ -1084,7 +1084,7 @@ DELIMITER ;'; $stmt = $pdo->query("DELETE FROM `admin` WHERE `username` NOT IN (SELECT `username` FROM `domain_admins`);"); } // Insert new DB schema version - $stmt = $pdo->query("REPLACE INTO `versions` (`application`, `version`) VALUES ('db_schema', '" . $db_version . "');"); + $stmt = $pdo->query("REPLACE INTO `versions` (`application`, `version`) VALUES ('db_schema', '" . $db_version . "');"); // Migrate attributes $stmt = $pdo->query("UPDATE `mailbox` SET `attributes` = '{}' WHERE `attributes` = '' OR `attributes` IS NULL;"); diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php index 6dd50bcd..001fcd7b 100644 --- a/data/web/lang/lang.de.php +++ b/data/web/lang/lang.de.php @@ -546,7 +546,7 @@ $lang['tfa']['confirm_totp_token'] = "Bitte bestätigen Sie die Änderung durch $lang['admin']['rspamd-com_settings'] = 'Rspamd docs - Ein Name wird automatisch generiert. Beispielinhalte zur Einsicht stehen nachstehend bereit.'; - + $lang['admin']['no_new_rows'] = 'Keine weiteren Zeilen vorhanden'; $lang['admin']['additional_rows'] = ' zusätzliche Zeilen geladen'; // parses to 'n additional rows were added' $lang['admin']['private_key'] = 'Private Key'; diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php index 8375c953..b6854de0 100644 --- a/data/web/lang/lang.en.php +++ b/data/web/lang/lang.en.php @@ -936,4 +936,4 @@ $lang['admin']['transport_dest_format'] = 'Syntax: example.org, .example.org, *, $lang['mailbox']['alias_domain_backupmx'] = 'Alias domain inactive for relay domain'; $lang['danger']['extra_acl_invalid'] = 'External sender address "%s" is invalid'; -$lang['danger']['extra_acl_invalid_domain'] = 'External sender "%s" uses an invalid domain'; +$lang['danger']['extra_acl_invalid_domain'] = 'External sender "%s" uses an invalid domain'; \ No newline at end of file From a049a1ffac4c5d23eee6e305405e3523f36334a7 Mon Sep 17 00:00:00 2001 From: heavygale Date: Sun, 6 Oct 2019 18:59:54 +0200 Subject: [PATCH 5/7] Undo automatic whitespace cleanup 2 --- data/web/inc/init_db.inc.php | 4 ++-- data/web/lang/lang.en.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/web/inc/init_db.inc.php b/data/web/inc/init_db.inc.php index 0b19912e..fbc8f7b3 100644 --- a/data/web/inc/init_db.inc.php +++ b/data/web/inc/init_db.inc.php @@ -933,7 +933,7 @@ function init_db_schema() { } if (strtolower($key_type) == 'unique') { foreach ($key_content as $key_name => $key_values) { - $fields = "`" . implode("`, `", $key_values) . "`"; + $fields = "`" . implode("`, `", $key_values) . "`"; $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); $is_drop = ($num_results != 0) ? "DROP INDEX `" . $key_name . "`, " : ""; @@ -942,7 +942,7 @@ function init_db_schema() { } if (strtolower($key_type) == 'fkey') { foreach ($key_content as $key_name => $key_values) { - $fields = "`" . implode("`, `", $key_values) . "`"; + $fields = "`" . implode("`, `", $key_values) . "`"; $stmt = $pdo->query("SHOW KEYS FROM `" . $table . "` WHERE Key_name = '" . $key_name . "'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); if ($num_results != 0) { diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php index b6854de0..8375c953 100644 --- a/data/web/lang/lang.en.php +++ b/data/web/lang/lang.en.php @@ -936,4 +936,4 @@ $lang['admin']['transport_dest_format'] = 'Syntax: example.org, .example.org, *, $lang['mailbox']['alias_domain_backupmx'] = 'Alias domain inactive for relay domain'; $lang['danger']['extra_acl_invalid'] = 'External sender address "%s" is invalid'; -$lang['danger']['extra_acl_invalid_domain'] = 'External sender "%s" uses an invalid domain'; \ No newline at end of file +$lang['danger']['extra_acl_invalid_domain'] = 'External sender "%s" uses an invalid domain'; From 11503fd316320bda565b0ae7941d11ef35592660 Mon Sep 17 00:00:00 2001 From: heavygale Date: Wed, 9 Oct 2019 22:30:20 +0200 Subject: [PATCH 6/7] Change ACL description --- data/web/lang/lang.de.php | 2 +- data/web/lang/lang.en.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php index 001fcd7b..2540d8e8 100644 --- a/data/web/lang/lang.de.php +++ b/data/web/lang/lang.de.php @@ -420,7 +420,7 @@ $lang['acl']['recipient_maps'] = 'Empfängerumschreibungen'; $lang['acl']['unlimited_quota'] = 'Unendliche Quota für Mailboxen'; $lang['acl']['extend_sender_acl'] = 'Eingabe externer Absenderadressen erlauben'; $lang['acl']['prohibited'] = 'Untersagt durch Richtlinie'; -$lang['acl']['sogo_access'] = 'SOGo Zugriffsrecht'; +$lang['acl']['sogo_access'] = 'Verwalten des SOGo Zugriffsrechts erlauben'; $lang['edit']['extended_sender_acl'] = 'Externe Absenderadressen'; $lang['edit']['extended_sender_acl_info'] = 'Der DKIM Domainkey der externen Absenderdomain sollte in diesen Server importiert werden, falls vorhanden.
diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php index 8375c953..567f23ca 100644 --- a/data/web/lang/lang.en.php +++ b/data/web/lang/lang.en.php @@ -428,7 +428,7 @@ $lang['acl']['recipient_maps'] = 'Recipient maps'; $lang['acl']['unlimited_quota'] = 'Unlimited quota for mailboxes'; $lang['acl']['extend_sender_acl'] = 'Allow to extend sender ACL by external addresses'; $lang['acl']['prohibited'] = 'Prohibited by ACL'; -$lang['acl']['sogo_access'] = 'Grant access to SOGo'; +$lang['acl']['sogo_access'] = 'Allow management of SOGo access'; $lang['edit']['extended_sender_acl'] = 'External sender addresses'; $lang['edit']['extended_sender_acl_info'] = 'A DKIM domain key should be imported, if available.
From be9af6fb2a838b77bc3914072e9e3ed25d5bae38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Peters?= Date: Wed, 9 Oct 2019 22:31:41 +0200 Subject: [PATCH 7/7] Update init_db.inc.php --- data/web/inc/init_db.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/web/inc/init_db.inc.php b/data/web/inc/init_db.inc.php index fbc8f7b3..eafcfec8 100644 --- a/data/web/inc/init_db.inc.php +++ b/data/web/inc/init_db.inc.php @@ -3,7 +3,7 @@ function init_db_schema() { try { global $pdo; - $db_version = "29092019_1040"; + $db_version = "09102019_1040"; $stmt = $pdo->query("SHOW TABLES LIKE 'versions'"); $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));