List:Commits« Previous MessageNext Message »
From:Tatiana A. Nurnberg Date:November 24 2010 10:03am
Subject:bzr commit into mysql-5.1-bugteam branch (azundris:3518)
View as plain text  
#At file:///Users/tnurnberg/forest/1/51-1/ based on revid:azundris@stripped

 3518 Tatiana A. Nurnberg	2010-11-24 [merge]
      merge

    modified:
      mysql-test/r/connect.result
      mysql-test/t/connect.test
      sql/sql_connect.cc
      strings/CHARSET_INFO.txt
=== modified file 'mysql-test/r/connect.result'
--- a/mysql-test/r/connect.result	2009-03-06 14:56:17 +0000
+++ b/mysql-test/r/connect.result	2010-11-11 07:34:14 +0000
@@ -215,6 +215,17 @@ SET GLOBAL event_scheduler = OFF;
 
 # -- End of Bug#35074.
 
+#
+# -- Bug#49752: 2469.126.2 unintentionally breaks authentication
+#               against MySQL 5.1 server
+#
+GRANT ALL ON test.* TO 'Azundris12345678'@'localhost' IDENTIFIED BY 'test123';
+FLUSH PRIVILEGES;
+DROP USER 'Azundris12345678'@'localhost';
+FLUSH PRIVILEGES;
+#
+# -- End of Bug#49752
+#
 # ------------------------------------------------------------------
 # -- End of 5.1 tests
 # ------------------------------------------------------------------

=== modified file 'mysql-test/t/connect.test'
--- a/mysql-test/t/connect.test	2009-05-25 15:19:20 +0000
+++ b/mysql-test/t/connect.test	2010-11-11 07:34:14 +0000
@@ -293,6 +293,34 @@ SET GLOBAL event_scheduler = OFF;
 --echo # -- End of Bug#35074.
 --echo
 
+
+###########################################################################
+
+--echo #
+--echo # -- Bug#49752: 2469.126.2 unintentionally breaks authentication
+--echo #               against MySQL 5.1 server
+--echo #
+
+GRANT ALL ON test.* TO 'Azundris12345678'@'localhost' IDENTIFIED BY 'test123';
+
+FLUSH PRIVILEGES;
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+connect (con1,localhost,Azundris123456789,test123,test);
+disconnect con1;
+
+connection default;
+
+DROP USER 'Azundris12345678'@'localhost';
+
+FLUSH PRIVILEGES;
+
+--echo #
+--echo # -- End of Bug#49752
+--echo #
+
+
+
 --echo # ------------------------------------------------------------------
 --echo # -- End of 5.1 tests
 --echo # ------------------------------------------------------------------

=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc	2010-07-19 14:30:34 +0000
+++ b/sql/sql_connect.cc	2010-11-11 07:34:14 +0000
@@ -899,6 +899,19 @@ static int check_connection(THD *thd)
     user_len-= 2;
   }
 
+  /*
+    Clip username to allowed length in characters (not bytes).  This is
+    mostly for backward compatibility.
+  */
+  {
+    CHARSET_INFO *cs= system_charset_info;
+    int           err;
+
+    user_len= (uint) cs->cset->well_formed_len(cs, user, user + user_len,
+                                               USERNAME_CHAR_LENGTH, &err);
+    user[user_len]= '\0';
+  }
+
   if (thd->main_security_ctx.user)
     x_free(thd->main_security_ctx.user);
   if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME))))

=== modified file 'strings/CHARSET_INFO.txt'
--- a/strings/CHARSET_INFO.txt	2008-05-28 14:18:24 +0000
+++ b/strings/CHARSET_INFO.txt	2010-11-11 07:34:14 +0000
@@ -208,14 +208,11 @@ charpos()   - calculates the offset of t
               Used in SQL functions LEFT(), RIGHT(), SUBSTRING(), 
               INSERT()
 
-well_formed_length()
-            - finds the length of correctly formed multi-byte beginning.
-              Used in INSERTs to cut a beginning of the given string
-              which is
-              a) "well formed" according to the given character set.
+well_formed_len()
+            - returns length of a given multi-byte string in bytes
+              Used in INSERTs to shorten the given string so it
+              a) is "well formed" according to the given character set
               b) can fit into the given data type
-              Terminates the string in the good position, taking in account
-              multi-byte character boundaries.
 
 lengthsp()  - returns the length of the given string without trailing spaces.
 

No bundle (reason: revision is a merge).
Thread
bzr commit into mysql-5.1-bugteam branch (azundris:3518) Tatiana A. Nurnberg24 Nov