| 1 |
--source include/not_embedded.inc |
| 2 |
|
| 3 |
--echo # |
| 4 |
--echo # MDEV-9614 Roles and Users Longer than 6 characters |
| 5 |
--echo # |
| 6 |
--echo # This test case checks the edge case presented in the MDEV. The |
| 7 |
--echo # real issue is actually apparent when the username is longer than the |
| 8 |
--echo # rolename. |
| 9 |
|
| 10 |
--enable_connect_log |
| 11 |
--echo # |
| 12 |
--echo # We need a separate database not including test or test_% names. Due to |
| 13 |
--echo # default privileges given on these databases. |
| 14 |
--echo # |
| 15 |
DROP DATABASE IF EXISTS `bug_db`; |
| 16 |
|
| 17 |
--echo # |
| 18 |
--echo # The first user did not show the bug as john's length is smaller |
| 19 |
--echo # than client. The bug is apparent most of the time for usertestjohn. |
| 20 |
--echo # |
| 21 |
CREATE USER `john`@`%`; |
| 22 |
CREATE USER `usertestjohn`@`%`; |
| 23 |
CREATE ROLE `client`; |
| 24 |
|
| 25 |
--echo # |
| 26 |
--echo # Setup the required tables. |
| 27 |
--echo # |
| 28 |
CREATE DATABASE `bug_db`; |
| 29 |
CREATE TABLE `bug_db`.`t0`(`c0` INT); |
| 30 |
|
| 31 |
--echo # |
| 32 |
--echo # Setup select privileges only on the role. Setting the role should give |
| 33 |
--echo # select access to bug_db.t0. |
| 34 |
--echo # |
| 35 |
GRANT SELECT ON `bug_db`.`t0` TO `client`; |
| 36 |
GRANT `client` TO `john`@`%`; |
| 37 |
GRANT `client` TO `usertestjohn`@`%`; |
| 38 |
|
| 39 |
--echo # |
| 40 |
--echo # Check to see grants are set. |
| 41 |
--echo # |
| 42 |
SHOW GRANTS FOR `john`@`%`; |
| 43 |
SHOW GRANTS FOR `usertestjohn`@`%`; |
| 44 |
SHOW GRANTS FOR `client`; |
| 45 |
|
| 46 |
show databases; |
| 47 |
|
| 48 |
--echo # |
| 49 |
--echo # Try using the database as john. |
| 50 |
--echo # |
| 51 |
connect (john, localhost, john,,information_schema); |
| 52 |
|
| 53 |
show databases; |
| 54 |
set role client; |
| 55 |
show databases; |
| 56 |
use bug_db; |
| 57 |
|
| 58 |
--echo # |
| 59 |
--echo # Try using the database as usertestjohn. |
| 60 |
--echo # |
| 61 |
connect (usertestjohn, localhost, usertestjohn,,information_schema); |
| 62 |
|
| 63 |
show databases; |
| 64 |
set role client; |
| 65 |
show databases; |
| 66 |
|
| 67 |
show grants; |
| 68 |
use bug_db; |
| 69 |
|
| 70 |
|
| 71 |
--echo # |
| 72 |
--echo # Cleanup |
| 73 |
--echo # |
| 74 |
connection default; |
| 75 |
drop user john; |
| 76 |
drop user usertestjohn; |
| 77 |
drop role client; |
| 78 |
drop database bug_db; |
| 79 |
--disable_connect_log |