From c13c52169963ae77db3e69d8044b00f498e9034e Mon Sep 17 00:00:00 2001 From: andryyy Date: Mon, 9 Aug 2021 21:35:19 +0200 Subject: [PATCH] [Web] Fix broken autoconfig ports, fixes #4221 --- data/web/inc/vars.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/data/web/inc/vars.inc.php b/data/web/inc/vars.inc.php index d0022694d..eb3b4b0cf 100644 --- a/data/web/inc/vars.inc.php +++ b/data/web/inc/vars.inc.php @@ -45,18 +45,18 @@ $autodiscover_config = array( // The autoconfig service will additionally announce the STARTTLS-enabled ports, specified in the "tlsport" variable. 'imap' => array( 'server' => $mailcow_hostname, - 'port' => substr(getenv('IMAPS_PORT'), strrpos(getenv('IMAPS_PORT'), ':') + 1), - 'tlsport' => substr(getenv('POP_PORT'), strrpos(getenv('IMAP_PORT'), ':') + 1) + 'port' => (int)filter_var(substr(getenv('IMAPS_PORT'), strrpos(getenv('IMAPS_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT), + 'tlsport' => (int)filter_var(substr(getenv('POP_PORT'), strrpos(getenv('IMAP_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT) ), 'pop3' => array( 'server' => $mailcow_hostname, - 'port' => substr(getenv('POPS_PORT'), strrpos(getenv('POPS_PORT'), ':') + 1), - 'tlsport' => substr(getenv('POP_PORT'), strrpos(getenv('POP_PORT'), ':') + 1) + 'port' => (int)filter_var(substr(getenv('POPS_PORT'), strrpos(getenv('POPS_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT), + 'tlsport' => (int)filter_var(substr(getenv('POP_PORT'), strrpos(getenv('POP_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT) ), 'smtp' => array( 'server' => $mailcow_hostname, - 'port' => substr(getenv('SMTPS_PORT'), strrpos(getenv('SMTPS_PORT'), ':') + 1), - 'tlsport' => substr(getenv('SUBMISSION_PORT'), strrpos(getenv('SUBMISSION_PORT'), ':') + 1) + 'port' => (int)filter_var(substr(getenv('SMTPS_PORT'), strrpos(getenv('SMTPS_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT), + 'tlsport' => (int)filter_var(substr(getenv('SUBMISSION_PORT'), strrpos(getenv('SUBMISSION_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT) ), 'activesync' => array( 'url' => 'https://' . $mailcow_hostname . ($https_port == 443 ? '' : ':' . $https_port) . '/Microsoft-Server-ActiveSync',