1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Bug #49752: 2469.126.2 unintentionally breaks authentication against

MySQL 5.1 server

Server used to clip overly long user-names. This was presumably lost
when code was made UTF8-clean.

Now we emulate the behaviour for backward compatibility, but UTF8-ly
correct.


mysql-test/r/connect.result:
  Show that user-names that are too long get clipped now.
mysql-test/t/connect.test:
  Show that user-names that are too long get clipped now.
sql/sql_connect.cc:
  Clip user-name to 16 characters (not bytes).
strings/CHARSET_INFO.txt:
  Clarify in docs.
This commit is contained in:
Tatiana A. Nurnberg
2010-11-11 07:34:14 +00:00
parent 58dfba2899
commit 1c37eaaabf
4 changed files with 56 additions and 7 deletions

View File

@@ -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))))