MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:gluh Date:August 15 2006 10:34am
Subject:bk commit into 5.0 tree (gluh:1.2226) BUG#21432
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-08-15 15:34:41+05:00, gluh@stripped +7 -0
  Bug#20393 User name truncation in mysql client
  Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte

  include/mysql_com.h@stripped, 2006-08-15 15:34:36+05:00, gluh@stripped +3 -0
    Bug#20393 User name truncation in mysql client
    Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
    added new constants NAME_BYTE_LEN, USERNAME_BYTE_LENGTH

  mysql-test/r/ctype_utf8.result@stripped, 2006-08-15 15:34:37+05:00, gluh@stripped +12 -0
    Bug#20393 User name truncation in mysql client
    Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
    test case

  mysql-test/t/ctype_utf8.test@stripped, 2006-08-15 15:34:37+05:00, gluh@stripped +15 -0
    Bug#20393 User name truncation in mysql client
    Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
    test case

  sql-common/client.c@stripped, 2006-08-15 15:34:37+05:00, gluh@stripped +3 -3
    Bug#20393 User name truncation in mysql client
    Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
    increased buffers for user name & db

  sql/sql_acl.cc@stripped, 2006-08-15 15:34:37+05:00, gluh@stripped +5 -1
    Bug#20393 User name truncation in mysql client
    Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
    check that user name is not longer than USERNAME_LENGTH symbols

  sql/sql_parse.cc@stripped, 2006-08-15 15:34:37+05:00, gluh@stripped +2 -2
    Bug#20393 User name truncation in mysql client
    Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
    increased buffers for user name & db

  sql/table.cc@stripped, 2006-08-15 15:34:37+05:00, gluh@stripped +3 -1
    Bug#20393 User name truncation in mysql client
    Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
    check that db name is not longer than NAME_LEN symbols

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gluh
# Host:	gluh.(none)
# Root:	/home/gluh/MySQL/Bugs/5.0.20393

--- 1.103/include/mysql_com.h	2006-08-15 15:34:50 +05:00
+++ 1.104/include/mysql_com.h	2006-08-15 15:34:50 +05:00
@@ -26,6 +26,9 @@
 #define USERNAME_LENGTH 16
 #define SERVER_VERSION_LENGTH 60
 #define SQLSTATE_LENGTH 5
+#define NAME_BYTE_LEN   NAME_LEN*3
+#define USERNAME_BYTE_LENGTH USERNAME_LENGTH*3
+
 
 /*
   USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain

--- 1.199/sql/sql_acl.cc	2006-08-15 15:34:50 +05:00
+++ 1.200/sql/sql_acl.cc	2006-08-15 15:34:50 +05:00
@@ -3247,7 +3247,11 @@
       continue;
     }  
     if (Str->host.length > HOSTNAME_LENGTH ||
-	Str->user.length > USERNAME_LENGTH)
+	system_charset_info->cset->charpos(system_charset_info,
+                                           Str->user.str,
+                                           Str->user.str +
+                                           Str->user.length,
+                                           USERNAME_LENGTH) < Str->user.length)
     {
       my_message(ER_GRANT_WRONG_HOST_OR_USER, ER(ER_GRANT_WRONG_HOST_OR_USER),
                  MYF(0));

--- 1.563/sql/sql_parse.cc	2006-08-15 15:34:50 +05:00
+++ 1.564/sql/sql_parse.cc	2006-08-15 15:34:50 +05:00
@@ -1001,8 +1001,8 @@
   char *passwd= strend(user)+1;
   uint user_len= passwd - user - 1;
   char *db= passwd;
-  char db_buff[NAME_LEN+1];                     // buffer to store db in utf8
-  char user_buff[USERNAME_LENGTH+1];		// buffer to store user in utf8
+  char db_buff[NAME_BYTE_LEN + 1];              // buffer to store db in utf8
+  char user_buff[USERNAME_BYTE_LENGTH + 1];	// buffer to store user in utf8
   uint dummy_errors;
 
   /*

--- 1.229/sql/table.cc	2006-08-15 15:34:50 +05:00
+++ 1.230/sql/table.cc	2006-08-15 15:34:50 +05:00
@@ -1619,7 +1619,9 @@
       return 1;
     name++;
   }
-  return last_char_is_space || (uint) (name - start) > NAME_LEN;
+  return last_char_is_space || (system_charset_info->cset->
+                                  charpos(system_charset_info, start, name,
+                                          NAME_LEN) < (uint) (name - start));
 }
 
 

--- 1.92/mysql-test/r/ctype_utf8.result	2006-08-15 15:34:50 +05:00
+++ 1.93/mysql-test/r/ctype_utf8.result	2006-08-15 15:34:50 +05:00
@@ -1390,3 +1390,15 @@
 execute my_stmt using @a;
 a	b
 drop table if exists t1;
+set names utf8;
+create user юзер_юзер@localhost;
+grant select on test.* to юзер_юзер@localhost;
+user()
+юзер_юзер@localhost
+drop user юзер_юзер@localhost;
+create database имя_базы_в_кодировке_утф8_длинной_более_чем_45;
+use имя_базы_в_кодировке_утф8_длинной_более_чем_45;
+select database();
+database()
+имя_базы_в_кодировке_утф8_длинной_более_чем_45
+drop database имя_базы_в_кодировке_утф8_длинной_более_чем_45;

--- 1.85/mysql-test/t/ctype_utf8.test	2006-08-15 15:34:50 +05:00
+++ 1.86/mysql-test/t/ctype_utf8.test	2006-08-15 15:34:50 +05:00
@@ -1104,3 +1104,18 @@
 set @a:=null;
 execute my_stmt using @a;
 drop table if exists t1;
+
+#
+# Bug#20393: User name truncation in mysql client
+# Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte
+#
+set names utf8;
+create user юзер_юзер@localhost;
+grant select on test.* to юзер_юзер@localhost;
+--exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
+drop user юзер_юзер@localhost;
+
+create database имя_базы_в_кодировке_утф8_длинной_более_чем_45;
+use имя_базы_в_кодировке_утф8_длинной_более_чем_45;
+select database();
+drop database имя_базы_в_кодировке_утф8_длинной_более_чем_45;

--- 1.95/sql-common/client.c	2006-08-15 15:34:50 +05:00
+++ 1.96/sql-common/client.c	2006-08-15 15:34:50 +05:00
@@ -1748,7 +1748,7 @@
 		       const char *passwd, const char *db,
 		       uint port, const char *unix_socket,ulong client_flag)
 {
-  char		buff[NAME_LEN+USERNAME_LENGTH+100];
+  char		buff[NAME_BYTE_LEN+USERNAME_BYTE_LENGTH+100];
   char		*end,*host_info;
   my_socket	sock;
   in_addr_t	ip_addr;
@@ -2207,7 +2207,7 @@
 		     mysql->server_status, client_flag));
   /* This needs to be changed as it's not useful with big packets */
   if (user && user[0])
-    strmake(end,user,USERNAME_LENGTH);          /* Max user name */
+    strmake(end,user,USERNAME_BYTE_LENGTH);          /* Max user name */
   else
     read_user_name((char*) end);
 
@@ -2237,7 +2237,7 @@
   /* Add database if needed */
   if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
   {
-    end= strmake(end, db, NAME_LEN) + 1;
+    end= strmake(end, db, NAME_BYTE_LEN) + 1;
     mysql->db= my_strdup(db,MYF(MY_WME));
     db= 0;
   }
Thread
bk commit into 5.0 tree (gluh:1.2226) BUG#21432gluh15 Aug