diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-04-30 09:07:29 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-04-30 09:07:29 +0200 |
commit | 204977598a26d5b95a1909fbce0c902c84437ff6 (patch) | |
tree | 72f66c4e6cddf64964027dbc03ae2298181f5895 /program | |
parent | fb1203c07fc6e8bf5504049522fb63f5408d218c (diff) |
Fix invalid host validation on login (#1489841)
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcmail.php | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php index cc70739cf..eb1ccc0cb 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -494,30 +494,18 @@ class rcmail extends rcube $username_domain = $this->config->get('username_domain'); $login_lc = $this->config->get('login_lc', 2); - if (!$host) { - $host = $default_host; - } - - // Validate that selected host is in the list of configured hosts - if (is_array($default_host)) { - $allowed = false; - - foreach ($default_host as $key => $host_allowed) { - if (!is_numeric($key)) { - $host_allowed = $key; - } - if ($host == $host_allowed) { - $allowed = true; - break; - } + // host is validated in rcmail::autoselect_host(), so here + // we'll only handle unset host (if possible) + if (!$host && !empty($default_host)) { + if (is_array($default_host)) { + list($key, $val) = each($default_host); + $host = is_numeric($key) ? $val : $key; } - - if (!$allowed) { - $host = null; + else { + $host = $default_host; } - } - else if (!empty($default_host) && $host != rcube_utils::parse_host($default_host)) { - $host = null; + + $host = rcube_utils::parse_host($host); } if (!$host) { |