diff options
author | alecpl <alec@alec.pl> | 2011-09-06 17:18:12 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-09-06 17:18:12 +0000 |
commit | d5ae9772c1427dbbcf1cb7582106dd1d542bc26e (patch) | |
tree | 4c3f47d650e675777bbaa4265e59d52cc3058062 | |
parent | f8e48df71540b268ceac058d32b8ee848fc2ab6b (diff) |
- Fix username case-insensitivity issue in MySQL (#1488021)
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | SQL/mysql.initial.sql | 4 | ||||
-rw-r--r-- | SQL/mysql.update.sql | 3 | ||||
-rw-r--r-- | program/include/rcube_user.php | 5 |
4 files changed, 7 insertions, 6 deletions
@@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix username case-insensitivity issue in MySQL (#1488021) - Addressbook Saved Searches - Added spellchecker exceptions dictionary (shared or per-user) - Added possibility to ignore words containing caps, numbers, symbols (spellcheck_ignore_* options) diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql index 6c2669009..a50e28c35 100644 --- a/SQL/mysql.initial.sql +++ b/SQL/mysql.initial.sql @@ -20,9 +20,9 @@ CREATE TABLE `session` ( CREATE TABLE `users` ( `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, - `username` varchar(128) NOT NULL, + `username` varchar(128) BINARY NOT NULL, `mail_host` varchar(128) NOT NULL, - `alias` varchar(128) NOT NULL, + `alias` varchar(128) BINARY NOT NULL, `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', `last_login` datetime DEFAULT NULL, `language` varchar(5), diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql index afeb3a528..7f8ce6154 100644 --- a/SQL/mysql.update.sql +++ b/SQL/mysql.update.sql @@ -147,6 +147,9 @@ TRUNCATE TABLE `cache`; -- Updates from version 0.6-stable +ALTER TABLE `users` CHANGE `alias` `alias` varchar(128) BINARY NOT NULL; +ALTER TABLE `users` CHANGE `username` `username` varchar(128) BINARY NOT NULL; + CREATE TABLE `dictionary` ( `user_id` int(10) UNSIGNED DEFAULT NULL, `language` varchar(5) NOT NULL, diff --git a/program/include/rcube_user.php b/program/include/rcube_user.php index 90edad6e9..500b9224d 100644 --- a/program/include/rcube_user.php +++ b/program/include/rcube_user.php @@ -399,11 +399,8 @@ class rcube_user { $dbh = rcmail::get_instance()->get_dbh(); - // use BINARY (case-sensitive) comparison on MySQL, other engines are case-sensitive - $mod = preg_match('/^mysql/', $dbh->db_provider) ? 'BINARY' : ''; - // query for matching user name - $query = "SELECT * FROM ".get_table_name('users')." WHERE mail_host = ? AND %s = $mod ?"; + $query = "SELECT * FROM ".get_table_name('users')." WHERE mail_host = ? AND %s = ?"; $sql_result = $dbh->query(sprintf($query, 'username'), $host, $user); // query for matching alias |