diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-11-30 13:43:04 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-11-30 13:43:04 +0000 |
| commit | 104203010b81b1287800b20165f192cb5792f394 (patch) | |
| tree | ce6f340150072cf4a53fa2f82d8bf5cb8f8fba09 /roundcubemail/program/include/rcube_user.php | |
| parent | d6b259e3ee175a60f06cafaf0c1a75b35106a2b0 (diff) | |
- Add 'login_lc' config option for case-insensitive authentication (#1487113)
- Make username comparison case sensitive on MySQL
git-svn-id: https://svn.roundcube.net/trunk@4290 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_user.php')
| -rw-r--r-- | roundcubemail/program/include/rcube_user.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/roundcubemail/program/include/rcube_user.php b/roundcubemail/program/include/rcube_user.php index e4506cff7..ee6db77cc 100644 --- a/roundcubemail/program/include/rcube_user.php +++ b/roundcubemail/program/include/rcube_user.php @@ -358,13 +358,17 @@ class rcube_user { $dbh = rcmail::get_instance()->get_dbh(); + // use BINARY (case-sensitive) comparison on MySQL, other engines are case-sensitive + $prefix = preg_match('/^mysql/', $dbh->db_provider) ? 'BINARY ' : ''; + // query for matching user name $query = "SELECT * FROM ".get_table_name('users')." WHERE mail_host = ? AND %s = ?"; - $sql_result = $dbh->query(sprintf($query, 'username'), $host, $user); + + $sql_result = $dbh->query(sprintf($query, $prefix.'username'), $host, $user); // query for matching alias if (!($sql_arr = $dbh->fetch_assoc($sql_result))) { - $sql_result = $dbh->query(sprintf($query, 'alias'), $host, $user); + $sql_result = $dbh->query(sprintf($query, $prefix.'alias'), $host, $user); $sql_arr = $dbh->fetch_assoc($sql_result); } |
