summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <gluh@mysql.com/gluh.(none)>2006-08-30 15:56:17 +0500
committerunknown <gluh@mysql.com/gluh.(none)>2006-08-30 15:56:17 +0500
commitddb9f8668fa10166e4ffb761dc54a25a007c5bfa (patch)
treebadf8f73c40042fa5b387f7c6af18f4e9f4f7696 /sql
parent2416a453eb21f56483865e42cbe568f0cf5a609e (diff)
downloadmariadb-git-ddb9f8668fa10166e4ffb761dc54a25a007c5bfa.tar.gz
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: 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, SYSTEM_CHARSET_MBMAXLEN mysql-test/r/ctype_utf8.result: 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: 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: 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: 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: 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: 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
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_acl.cc6
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/table.cc6
3 files changed, 11 insertions, 5 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 0ad5432f3eb..6ede19d0e96 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2640,7 +2640,11 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
while ((Str = str_list++))
{
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_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
result= -1;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index cf1f50aed63..89ecceeb1bf 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -902,8 +902,8 @@ static int check_connection(THD *thd)
char *user= end;
char *passwd= strend(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;
/*
diff --git a/sql/table.cc b/sql/table.cc
index 29e7d5ebf26..7587531b2f9 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1413,7 +1413,7 @@ char *get_field(MEM_ROOT *mem, Field *field)
bool check_db_name(char *name)
{
- char *start=name;
+ uint name_length= 0; // name length in symbols
/* Used to catch empty names and names with end space */
bool last_char_is_space= TRUE;
@@ -1430,6 +1430,7 @@ bool check_db_name(char *name)
name+system_charset_info->mbmaxlen);
if (len)
{
+ name_length++;
name += len;
continue;
}
@@ -1437,12 +1438,13 @@ bool check_db_name(char *name)
#else
last_char_is_space= *name==' ';
#endif
+ name_length++;
if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR ||
*name == FN_EXTCHAR)
return 1;
name++;
}
- return last_char_is_space || (uint) (name - start) > NAME_LEN;
+ return (last_char_is_space || name_length > NAME_LEN);
}