From e351e9493f461a9e72b61116731f735db044b205 Mon Sep 17 00:00:00 2001 From: alec Date: Mon, 4 Oct 2010 07:03:00 +0000 Subject: - Convert IDN to ASCII before using rcube_user::query() - Always convert to lower case a username when it's an email address git-svn-id: https://svn.roundcube.net/trunk@4030 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/include/rcmail.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'roundcubemail/program/include/rcmail.php') diff --git a/roundcubemail/program/include/rcmail.php b/roundcubemail/program/include/rcmail.php index 1b11ca3c5..30b79e26a 100644 --- a/roundcubemail/program/include/rcmail.php +++ b/roundcubemail/program/include/rcmail.php @@ -683,6 +683,15 @@ class rcmail if ($virtuser = rcube_user::email2user($username)) $username = $virtuser; + // Here we need IDNA ASCII + // Only rcube_contacts class is using domain names in Unicode + $host = idn_to_ascii($host); + if (strpos($username, '@')) { + // lowercase username if it's an e-mail address (#1484473) + $username = mb_strtolower($username); + $username = idn_to_ascii($username); + } + // user already registered -> overwrite username if ($user = rcube_user::query($username, $host)) $username = $user->data['username']; @@ -690,15 +699,9 @@ class rcmail if (!$this->imap) $this->imap_init(); - // Here we need IDNA ASCII - // Only rcube_contacts class is using domain names in Unicode - $host = idn_to_ascii($host); - if (strpos($username, '@')) - $username = idn_to_ascii($username); - // try IMAP login if (!($imap_login = $this->imap->connect($host, $username, $pass, $imap_port, $imap_ssl))) { - // lowercase username if it's an e-mail address (#1484473) + // try with lowercase $username_lc = mb_strtolower($username); if ($username_lc != $username && ($imap_login = $this->imap->connect($host, $username_lc, $pass, $imap_port, $imap_ssl))) $username = $username_lc; -- cgit v1.2.3