Commit 04de6ccc authored by Sergei Golubchik's avatar Sergei Golubchik

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

parser: error out on empty role names
parent 8dce8ecf
grant '' to foo@localhost;
ERROR OP000: Invalid role specification ``.
create user ''@localhost; create user ''@localhost;
create role r1; create role r1;
grant r1 to ''@localhost; grant r1 to ''@localhost;
......
#
# 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 # MDEV-5238 Server crashes in find_role_grant_pair on SHOW GRANTS for an anonymous user
# #
......
...@@ -15192,6 +15192,11 @@ current_role: ...@@ -15192,6 +15192,11 @@ current_role:
grant_role: grant_role:
ident_or_text 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)))) if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
MYSQL_YYABORT; MYSQL_YYABORT;
$$->user = $1; $$->user = $1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment