[Svn] r5183 - in trunk/roundcubemail: . SQL program/include

trac at roundcube.net trac at roundcube.net
Tue Sep 6 19:18:13 CEST 2011


Author: alec
Date: 2011-09-06 12:18:12 -0500 (Tue, 06 Sep 2011)
New Revision: 5183

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/SQL/mysql.initial.sql
   trunk/roundcubemail/SQL/mysql.update.sql
   trunk/roundcubemail/program/include/rcube_user.php
Log:
- Fix username case-insensitivity issue in MySQL (#1488021)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2011-09-06 16:35:14 UTC (rev 5182)
+++ trunk/roundcubemail/CHANGELOG	2011-09-06 17:18:12 UTC (rev 5183)
@@ -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)

Modified: trunk/roundcubemail/SQL/mysql.initial.sql
===================================================================
--- trunk/roundcubemail/SQL/mysql.initial.sql	2011-09-06 16:35:14 UTC (rev 5182)
+++ trunk/roundcubemail/SQL/mysql.initial.sql	2011-09-06 17:18:12 UTC (rev 5183)
@@ -20,9 +20,9 @@
 
 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),

Modified: trunk/roundcubemail/SQL/mysql.update.sql
===================================================================
--- trunk/roundcubemail/SQL/mysql.update.sql	2011-09-06 16:35:14 UTC (rev 5182)
+++ trunk/roundcubemail/SQL/mysql.update.sql	2011-09-06 17:18:12 UTC (rev 5183)
@@ -147,6 +147,9 @@
 
 -- 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,

Modified: trunk/roundcubemail/program/include/rcube_user.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_user.php	2011-09-06 16:35:14 UTC (rev 5182)
+++ trunk/roundcubemail/program/include/rcube_user.php	2011-09-06 17:18:12 UTC (rev 5183)
@@ -399,11 +399,8 @@
     {
         $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

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list