| 1 |
--source include/not_embedded.inc |
| 2 |
--echo # |
| 3 |
--echo # MDEV-10744 Roles are not fully case-sensitive |
| 4 |
--echo # |
| 5 |
|
| 6 |
--echo # |
| 7 |
--echo # Test creating two case-different roles. |
| 8 |
--echo # |
| 9 |
create user test_user@'%'; |
| 10 |
create role test_ROLE; |
| 11 |
create role test_role; |
| 12 |
--echo # |
| 13 |
--echo # Test if mysql.user has the roles created. |
| 14 |
--echo # |
| 15 |
--sorted_result |
| 16 |
select user, host from mysql.user where is_role='y' and user like 'test%'; |
| 17 |
|
| 18 |
create database secret_db; |
| 19 |
create table secret_db.t1 (secret varchar(100)); |
| 20 |
insert into secret_db.t1 values ("Some Secret P4ssw0rd"); |
| 21 |
|
| 22 |
grant select on secret_db.* to test_role; |
| 23 |
grant test_role to test_user; |
| 24 |
show grants for test_user; |
| 25 |
--echo # |
| 26 |
--echo # Now test the UPPER case role. |
| 27 |
--echo # |
| 28 |
grant test_ROLE to test_user; |
| 29 |
grant insert on secret_db.t1 to test_ROLE; |
| 30 |
show grants for test_user; |
| 31 |
connect (test_user,localhost,test_user); |
| 32 |
|
| 33 |
--echo # |
| 34 |
--echo # Test users privileges when interacting with those roles; |
| 35 |
--echo # |
| 36 |
--error ER_DBACCESS_DENIED_ERROR |
| 37 |
show tables from secret_db; |
| 38 |
set role test_ROLE; |
| 39 |
show tables from secret_db; |
| 40 |
--error ER_TABLEACCESS_DENIED_ERROR |
| 41 |
select * from secret_db.t1; |
| 42 |
insert into secret_db.t1 values ("|-|4><"); |
| 43 |
set role test_role; |
| 44 |
select * from secret_db.t1 order by secret; |
| 45 |
--error ER_TABLEACCESS_DENIED_ERROR |
| 46 |
insert into secret_db.t1 values ("|_33T|-|4><"); |
| 47 |
|
| 48 |
connection default; |
| 49 |
|
| 50 |
|
| 51 |
drop role test_ROLE; |
| 52 |
drop role test_role; |
| 53 |
drop user test_user; |
| 54 |
drop database secret_db; |