| 1 |
source include/not_embedded.inc; |
| 2 |
|
| 3 |
connect (mysql, localhost, root,,); |
| 4 |
use mysql; |
| 5 |
|
| 6 |
#test valid syntax |
| 7 |
--error ER_PARSE_ERROR |
| 8 |
create role test_role1@host1; |
| 9 |
--error ER_PARSE_ERROR |
| 10 |
create role test_role2@host2, test_role1@host1; |
| 11 |
|
| 12 |
create role test_role1; |
| 13 |
create role test_role2, test_role3; |
| 14 |
|
| 15 |
--sorted_result |
| 16 |
select user, host, is_role from user where user like 'test%'; |
| 17 |
|
| 18 |
drop role test_role1; |
| 19 |
drop role test_role2, test_role3; |
| 20 |
|
| 21 |
create role test_role1; |
| 22 |
--error ER_CANNOT_USER |
| 23 |
create role test_role1; |
| 24 |
--error ER_CANNOT_USER |
| 25 |
create role test_role1, test_role2; |
| 26 |
|
| 27 |
--sorted_result |
| 28 |
select user, host, is_role from user where user like 'test%'; |
| 29 |
|
| 30 |
drop role test_role1; |
| 31 |
--error ER_CANNOT_USER |
| 32 |
drop role test_role1; |
| 33 |
--error ER_CANNOT_USER |
| 34 |
drop role test_role1, test_role2; |
| 35 |
|
| 36 |
#test that we can not drop users when calling drop role |
| 37 |
--error ER_CANNOT_USER |
| 38 |
drop role root; |
| 39 |
create user dummy@''; |
| 40 |
--error ER_CANNOT_USER |
| 41 |
drop role dummy; |
| 42 |
drop user dummy@''; |
| 43 |
|
| 44 |
--sorted_result |
| 45 |
select user, host, is_role from user where user like 'test%'; |
| 46 |
disconnect mysql; |
| 47 |
connection default; |
| 48 |
|
| 49 |
# |
| 50 |
# MDEV-5520 Connection lost on wrong CREATE ROLE |
| 51 |
# |
| 52 |
--error ER_INVALID_ROLE |
| 53 |
create role ''; |
| 54 |
|
| 55 |
# |
| 56 |
# MDEV-8609 Server crashes in is_invalid_role_name on reloading ACL with a blank role name |
| 57 |
# |
| 58 |
--error ER_INVALID_ROLE |
| 59 |
create role ' '; |
| 60 |
create role 'foo '; |
| 61 |
drop role foo; |
| 62 |
|
| 63 |
# |
| 64 |
# MDEV-5523 Server crashes on DROP USER <rolename> |
| 65 |
# |
| 66 |
create role r1; |
| 67 |
--error ER_CANNOT_USER |
| 68 |
drop user r1; |
| 69 |
drop role r1; |
| 70 |
|
| 71 |
# |
| 72 |
# MDEV-5525 Assertion `status == 0' fails on creating user after granting it role admin option |
| 73 |
# |
| 74 |
create role r1 with admin u1; |
| 75 |
create user foo@bar; |
| 76 |
drop user foo@bar; |
| 77 |
drop role r1; |
| 78 |
|
| 79 |
# |
| 80 |
# MDEV-7774 Assertion `status == 0' fails when dropping in this order: |
| 81 |
# |
| 82 |
CREATE USER u1; |
| 83 |
CREATE ROLE r1; |
| 84 |
CREATE USER r1@localhost; |
| 85 |
CREATE ROLE r2; |
| 86 |
GRANT r2 to r1; |
| 87 |
GRANT r2 to r1@localhost; |
| 88 |
# MDEV-7774: Dropping in this order caused the crash. |
| 89 |
DROP ROLE r1; |
| 90 |
--sorted_result |
| 91 |
SELECT * FROM mysql.roles_mapping; |
| 92 |
SHOW GRANTS FOR r1@localhost; # Related to MDEV-7774, also caused a crash, by |
| 93 |
# not updating the internal acl_roles_mapping |
| 94 |
# data structure correctly; |
| 95 |
DROP USER u1; |
| 96 |
DROP ROLE r2; |
| 97 |
DROP USER r1@localhost; |
| 98 |
|
| 99 |
# |
| 100 |
# MDEV-11533: Roles with trailing white spaces are not cleared correctly |
| 101 |
# |
| 102 |
create role 'foo '; |
| 103 |
select concat(user, '__'), is_role from mysql.user where user like 'foo%'; |
| 104 |
select * from mysql.roles_mapping; |
| 105 |
drop role foo; |
| 106 |
select concat(user, '__'), is_role from mysql.user where user like 'foo%'; |
| 107 |
select * from mysql.roles_mapping; |
| 108 |
--sorted_result |
| 109 |
show grants; |