summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <bar@bar.intranet.mysql.r18.ru>2003-12-24 17:58:06 +0400
committerunknown <bar@bar.intranet.mysql.r18.ru>2003-12-24 17:58:06 +0400
commit229cc612776f757de6822eb97eb4e9a97226e760 (patch)
treeceb8bb064ba4611d2e5dd95d0f90e2626d6e2b63 /sql/sql_parse.cc
parent4bff43a7244cedb45f99c812596a6527d3808c43 (diff)
downloadmariadb-git-229cc612776f757de6822eb97eb4e9a97226e760.tar.gz
sql_parse.cc:
Fix for the bug 1175: Usernames will not converted to utf8 during connect sql/sql_parse.cc: Fix for the bug 1175: Usernames will not converted to utf8 during connect
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 678d0890136..465d840e2b8 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -834,6 +834,7 @@ static int check_connection(THD *thd)
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
/*
Old clients send null-terminated string as password; new clients send
the size (1 byte) + string (not null-terminated). Hence in case of empty
@@ -854,6 +855,14 @@ static int check_connection(THD *thd)
db= db_buff;
}
+ if (user)
+ {
+ user_buff[copy_and_convert(user_buff, sizeof(user_buff)-1,
+ system_charset_info, user, strlen(user),
+ thd->charset())]= '\0';
+ user= user_buff;
+ }
+
if (thd->user)
x_free(thd->user);
if (!(thd->user= my_strdup(user, MYF(0))))