Browse Source

[SOGo, Dovecot] Remove unnecessary likes from sql queries
[Web] Filter transport destinations to prevent empty destinations

andryyy 5 years ago
parent
commit
3a9efc86cf

+ 1 - 1
data/Dockerfiles/sogo/bootstrap-sogo.sh

@@ -35,7 +35,7 @@ SELECT
    mailbox.username,
    mailbox.domain,
    mailbox.username,
-   if(json_extract(attributes, '$.force_pw_update') LIKE '%0%', if(json_extract(attributes, '$.sogo_access') LIKE '%1%', password, '{SSHA256}A123A123A321A321A321B321B321B123B123B321B432F123E321123123321321'), '{SSHA256}A123A123A321A321A321B321B321B123B123B321B432F123E321123123321321'),
+   IF(JSON_UNQUOTE(JSON_VALUE(attributes, '$.force_pw_update')) = '0', IF(JSON_UNQUOTE(JSON_VALUE(attributes, '$.sogo_access')) = 1, password, '{SSHA256}A123A123A321A321A321B321B321B123B123B321B432F123E321123123321321'), '{SSHA256}A123A123A321A321A321B321B321B123B123B321B432F123E321123123321321'),
    mailbox.name,
    mailbox.username,
    IFNULL(GROUP_CONCAT(ga.aliases ORDER BY ga.aliases SEPARATOR ' '), ''),

+ 1 - 1
data/web/inc/functions.transports.inc.php

@@ -245,7 +245,7 @@ function transport($_action, $_data = null) {
           }
         }
       }
-      $destinations = array_values(array_unique($destinations));
+      $destinations = array_filter(array_values(array_unique($destinations)));
       if (empty($destinations)) { return false; }
       if (isset($next_hop_matches[1])) {
         if (in_array($next_hop_clean, $existing_nh)) {