MDEV-8609 Server crashes in is_invalid_role_name on reloading ACL with a blank role name
strip endspaces from the role name in the parser because they'll be lost anyway when the name is stored in the mysql.user.user column (of type CHAR)
This commit is contained in:
parent
27328ca1f4
commit
956e92d908
@ -36,6 +36,10 @@ select user, host, is_role from user where user like 'test%';
|
||||
user host is_role
|
||||
create role '';
|
||||
ERROR OP000: Invalid role specification ``.
|
||||
create role ' ';
|
||||
ERROR OP000: Invalid role specification ``.
|
||||
create role 'foo ';
|
||||
drop role foo;
|
||||
create role r1;
|
||||
drop user r1;
|
||||
ERROR HY000: Operation DROP USER failed for 'r1'@'%'
|
||||
|
@ -52,6 +52,14 @@ connection default;
|
||||
--error ER_INVALID_ROLE
|
||||
create role '';
|
||||
|
||||
#
|
||||
# MDEV-8609 Server crashes in is_invalid_role_name on reloading ACL with a blank role name
|
||||
#
|
||||
--error ER_INVALID_ROLE
|
||||
create role ' ';
|
||||
create role 'foo ';
|
||||
drop role foo;
|
||||
|
||||
#
|
||||
# MDEV-5523 Server crashes on DROP USER <rolename>
|
||||
#
|
||||
|
@ -15170,6 +15170,9 @@ current_role:
|
||||
grant_role:
|
||||
ident_or_text
|
||||
{
|
||||
CHARSET_INFO *cs= system_charset_info;
|
||||
/* trim end spaces (as they'll be lost in mysql.user anyway) */
|
||||
$1.length= cs->cset->lengthsp(cs, $1.str, $1.length);
|
||||
if ($1.length == 0)
|
||||
{
|
||||
my_error(ER_INVALID_ROLE, MYF(0), "");
|
||||
@ -15184,8 +15187,7 @@ grant_role:
|
||||
$$->auth= empty_lex_str;
|
||||
|
||||
if (check_string_char_length(&$$->user, ER(ER_USERNAME),
|
||||
username_char_length,
|
||||
system_charset_info, 0))
|
||||
username_char_length, cs, 0))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| current_role
|
||||
|
Loading…
x
Reference in New Issue
Block a user