Commit 5a385146 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-5523 Server crashes on DROP USER <rolename>

use 'user_name' for the error message (fixed, after get_current_user()),
not the original tmp_user_name, as it comes from the parser (host == NULL).
parent 92eafe1a
...@@ -36,3 +36,7 @@ select user, host, is_role from user where user like 'test%'; ...@@ -36,3 +36,7 @@ select user, host, is_role from user where user like 'test%';
user host is_role user host is_role
create role ''; create role '';
ERROR OP000: Invalid role specification ``. ERROR OP000: Invalid role specification ``.
create role r1;
drop user r1;
ERROR HY000: Operation DROP USER failed for 'r1'
drop role r1;
...@@ -52,3 +52,11 @@ connection default; ...@@ -52,3 +52,11 @@ connection default;
--error ER_INVALID_ROLE --error ER_INVALID_ROLE
create role ''; create role '';
#
# MDEV-5523 Server crashes on DROP USER <rolename>
#
create role r1;
--error ER_CANNOT_USER
drop user r1;
drop role r1;
...@@ -9271,7 +9271,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role) ...@@ -9271,7 +9271,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
if (handle_as_role != user_name->is_role()) if (handle_as_role != user_name->is_role())
{ {
append_user(&wrong_users, tmp_user_name); append_user(&wrong_users, user_name);
result= TRUE; result= TRUE;
continue; continue;
} }
......
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