Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

- Fix username case-insensitivity issue in MySQL (#1488021)

  • Loading branch information...
commit d5ae9772c1427dbbcf1cb7582106dd1d542bc26e 1 parent f8e48df
Aleksander Machniak authored September 06, 2011
1  CHANGELOG
... ...
@@ -1,6 +1,7 @@
1 1
 CHANGELOG Roundcube Webmail
2 2
 ===========================
3 3
 
  4
+- Fix username case-insensitivity issue in MySQL (#1488021)
4 5
 - Addressbook Saved Searches
5 6
 - Added spellchecker exceptions dictionary (shared or per-user)
6 7
 - Added possibility to ignore words containing caps, numbers, symbols (spellcheck_ignore_* options)
4  SQL/mysql.initial.sql
@@ -20,9 +20,9 @@ CREATE TABLE `session` (
20 20
 
21 21
 CREATE TABLE `users` (
22 22
  `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
23  
- `username` varchar(128) NOT NULL,
  23
+ `username` varchar(128) BINARY NOT NULL,
24 24
  `mail_host` varchar(128) NOT NULL,
25  
- `alias` varchar(128) NOT NULL,
  25
+ `alias` varchar(128) BINARY NOT NULL,
26 26
  `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
27 27
  `last_login` datetime DEFAULT NULL,
28 28
  `language` varchar(5),
3  SQL/mysql.update.sql
@@ -147,6 +147,9 @@ TRUNCATE TABLE `cache`;
147 147
 
148 148
 -- Updates from version 0.6-stable
149 149
 
  150
+ALTER TABLE `users` CHANGE `alias` `alias` varchar(128) BINARY NOT NULL;
  151
+ALTER TABLE `users` CHANGE `username` `username` varchar(128) BINARY NOT NULL;
  152
+
150 153
 CREATE TABLE `dictionary` (
151 154
   `user_id` int(10) UNSIGNED DEFAULT NULL,
152 155
   `language` varchar(5) NOT NULL,
5  program/include/rcube_user.php
@@ -399,11 +399,8 @@ static function query($user, $host)
399 399
     {
400 400
         $dbh = rcmail::get_instance()->get_dbh();
401 401
 
402  
-        // use BINARY (case-sensitive) comparison on MySQL, other engines are case-sensitive
403  
-        $mod = preg_match('/^mysql/', $dbh->db_provider) ? 'BINARY' : '';
404  
-
405 402
         // query for matching user name
406  
-        $query = "SELECT * FROM ".get_table_name('users')." WHERE mail_host = ? AND %s = $mod ?";
  403
+        $query = "SELECT * FROM ".get_table_name('users')." WHERE mail_host = ? AND %s = ?";
407 404
         $sql_result = $dbh->query(sprintf($query, 'username'), $host, $user);
408 405
 
409 406
         // query for matching alias

0 notes on commit d5ae977

Please sign in to comment.
Something went wrong with that request. Please try again.