MDEV-5520 Connection lost on wrong CREATE ROLE

This commit is contained in:
Sergei Golubchik 2014-01-28 21:01:21 +01:00
parent 74d29b0ed3
commit 03b428d2cd
3 changed files with 11 additions and 2 deletions

View file

@ -34,3 +34,5 @@ ERROR HY000: Operation DROP ROLE failed for 'dummy'
drop user dummy@'';
select user, host, is_role from user where user like 'test%';
user host is_role
create role '';
ERROR OP000: Invalid role specification ``.

View file

@ -18,7 +18,6 @@ select user, host, is_role from user where user like 'test%';
drop role test_role1;
drop role test_role2, test_role3;
create role test_role1;
--error ER_CANNOT_USER
create role test_role1;
@ -45,3 +44,11 @@ drop user dummy@'';
--sorted_result
select user, host, is_role from user where user like 'test%';
disconnect mysql;
connection default;
#
# MDEV-5520 Connection lost on wrong CREATE ROLE
#
--error ER_INVALID_ROLE
create role '';

View file

@ -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)
{
if (strcasecmp(str, "PUBLIC") && strcasecmp(str, "NONE"))
if (*str && strcasecmp(str, "PUBLIC") && strcasecmp(str, "NONE"))
return false;
my_error(ER_INVALID_ROLE, MYF(0), str);