Commit 03b428d2 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-5520 Connection lost on wrong CREATE ROLE

parent 74d29b0e
...@@ -34,3 +34,5 @@ ERROR HY000: Operation DROP ROLE failed for 'dummy' ...@@ -34,3 +34,5 @@ ERROR HY000: Operation DROP ROLE failed for 'dummy'
drop user dummy@''; drop user dummy@'';
select user, host, is_role from user where user like 'test%'; select user, host, is_role from user where user like 'test%';
user host is_role user host is_role
create role '';
ERROR OP000: Invalid role specification ``.
...@@ -18,7 +18,6 @@ select user, host, is_role from user where user like 'test%'; ...@@ -18,7 +18,6 @@ select user, host, is_role from user where user like 'test%';
drop role test_role1; drop role test_role1;
drop role test_role2, test_role3; drop role test_role2, test_role3;
create role test_role1; create role test_role1;
--error ER_CANNOT_USER --error ER_CANNOT_USER
create role test_role1; create role test_role1;
...@@ -45,3 +44,11 @@ drop user dummy@''; ...@@ -45,3 +44,11 @@ drop user dummy@'';
--sorted_result --sorted_result
select user, host, is_role from user where user like 'test%'; select user, host, is_role from user where user like 'test%';
disconnect mysql; disconnect mysql;
connection default;
#
# MDEV-5520 Connection lost on wrong CREATE ROLE
#
--error ER_INVALID_ROLE
create role '';
...@@ -800,7 +800,7 @@ ACL_ROLE::ACL_ROLE(const char * rolename, ulong privileges, MEM_ROOT *root) : ...@@ -800,7 +800,7 @@ ACL_ROLE::ACL_ROLE(const char * rolename, ulong privileges, MEM_ROOT *root) :
static bool is_invalid_role_name(const char *str) static bool is_invalid_role_name(const char *str)
{ {
if (strcasecmp(str, "PUBLIC") && strcasecmp(str, "NONE")) if (*str && strcasecmp(str, "PUBLIC") && strcasecmp(str, "NONE"))
return false; return false;
my_error(ER_INVALID_ROLE, MYF(0), str); my_error(ER_INVALID_ROLE, MYF(0), str);
......
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