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