Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmir Caspi <cepheid666@users.noreply.github.com>2019-05-11 09:03:37 +0300
committerAleksander Machniak <alec@alec.pl>2019-05-19 09:46:02 +0300
commit06c5a2033105074109282d2a88d760789f9a8370 (patch)
tree98028446aed968c131e77c524d4c32109414b467 /program
parent55ebae3c1e9665d8c7f6086769cba035a1afd0a0 (diff)
Update rcube_utils::parse_host, fixes #6746
Updated regexps used in parse_host to ensure that %t, %d, %z do not cut off domain and return only tld when underlying host has no subdomain (i.e., is just domain.tld rather than mail.domain.tld). Update fixes #6746, now returns nothing shorter than domain.tld. Also removed backslash from character class, period does not need to be escaped within character class.
Diffstat (limited to 'program')
-rw-r--r--program/lib/Roundcube/rcube_utils.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php
index d66c9ce72..5c972e6f2 100644
--- a/program/lib/Roundcube/rcube_utils.php
+++ b/program/lib/Roundcube/rcube_utils.php
@@ -567,13 +567,15 @@ class rcube_utils
// %n - host
$n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']);
// %t - host name without first part, e.g. %n=mail.domain.tld, %t=domain.tld
- $t = preg_replace('/^[^\.]+\./', '', $n);
- // %d - domain name without first part
- $d = preg_replace('/^[^\.]+\./', '', $_SERVER['HTTP_HOST']);
+ // If %n=domain.tld then %t=domain.tld as well (remains valid)
+ $t = preg_replace('/^[^.]+\.(?![^.]+$)/', '', $n);
+ // %d - domain name without first part (up to domain.tld)
+ $d = preg_replace('/^[^.]+\.(?![^.]+$)/', '', $_SERVER['HTTP_HOST']);
// %h - IMAP host
$h = $_SESSION['storage_host'] ?: $host;
// %z - IMAP domain without first part, e.g. %h=imap.domain.tld, %z=domain.tld
- $z = preg_replace('/^[^\.]+\./', '', $h);
+ // If %h=domain.tld then %z=domain.tld as well (remains valid)
+ $z = preg_replace('/^[^.]+\.(?![^.]+$)/', '', $h);
// %s - domain name after the '@' from e-mail address provided at login screen.
// Returns FALSE if an invalid email is provided
if (strpos($name, '%s') !== false) {