MDEV-5668 Assertion `granted_role->is_role()' fails on granting role with empty name

parser: error out on empty role names
This commit is contained in:
Sergei Golubchik 2014-03-01 11:55:31 +01:00
parent 8dce8ecfda
commit 04de6ccc31
3 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,5 @@
grant '' to foo@localhost;
ERROR OP000: Invalid role specification ``.
create user ''@localhost;
create role r1;
grant r1 to ''@localhost;

View File

@ -1,3 +1,9 @@
#
# MDEV-5668 Assertion `granted_role->is_role()' fails on granting role with empty name
#
--error ER_INVALID_ROLE
grant '' to foo@localhost;
#
# MDEV-5238 Server crashes in find_role_grant_pair on SHOW GRANTS for an anonymous user
#

View File

@ -15192,6 +15192,11 @@ current_role:
grant_role:
ident_or_text
{
if ($1.length == 0)
{
my_error(ER_INVALID_ROLE, MYF(0), "");
MYSQL_YYABORT;
}
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
MYSQL_YYABORT;
$$->user = $1;