1
1
# Check for error if no parameter provided
2
create database authz_no;
6
# Set up a table to be able to test not being able to kill other people
8
create table t1 (kill_id int);
9
insert into t1 values(connection_id());
11
# Test that we get a normal don't exist error for things that don't exist
3
12
--error ER_NO_SUCH_TABLE
4
SELECT * from authz_no.dont_exist;
5
create database authz_yes;
13
SELECT * from user1.dont_exist;
15
# Connect as user1 - should only see information_schema, user1 and
17
# Also tests that we are able to read data_dictionary, without which fail
7
19
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
8
connect (should_succeed,localhost,authz,test,,);
20
connect (should_succeed,localhost,user1,,user1,,);
9
21
connection should_succeed;
11
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
12
--replace_regex /@'.*?'/@'LOCALHOST'/
13
--error ER_DBACCESS_DENIED_ERROR
14
SELECT * from authz_no.dont_exist;
15
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
16
--replace_regex /@'.*?'/@'LOCALHOST'/
17
--error ER_DBACCESS_DENIED_ERROR
18
create database authz_no;
19
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
20
--replace_regex /@'.*?'/@'LOCALHOST'/
21
--error ER_DBACCESS_DENIED_ERROR
22
drop database authz_no;
24
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
25
connect (con1,localhost,root,test,,);
26
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
27
connect (con2,localhost,root,test,,);
24
# Test that we get blocked on not being allowed to see user2 at all before
25
# we get blocked on the table not existing
26
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
27
--replace_regex /@'.*?'/@'LOCALHOST'/
28
--error ER_DBACCESS_DENIED_ERROR
29
SELECT * from user2.dont_exist;
31
# Test that we can't create a schema that isn't named the same as we are
32
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
33
--replace_regex /@'.*?'/@'LOCALHOST'/
34
--error ER_DBACCESS_DENIED_ERROR
35
create database authorize_fail;
37
# Test that we can't drop a schema that isn't named the same as we are
38
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
39
--replace_regex /@'.*?'/@'LOCALHOST'/
40
--error ER_DBACCESS_DENIED_ERROR
43
# Set up a table to test that we can kill other versions of us
44
create table t1 (kill_id int);
45
insert into t1 values(connection_id());
47
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
48
connect (con1,localhost,user1,,user1,);
49
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
50
connect (con2,localhost,user2,,user2,);
30
--replace_column 3 # 5 # 6 # 7 #
53
# Check that we don't see other people's connections
54
--replace_column 3 # 5 # 6 # 7 # 8 #
57
# Check that we can kill a process that is owned by our user
33
58
--disable_reconnect
34
create table t1 (kill_id int);
35
insert into t1 values(connection_id());
59
select ((@id := kill_id) - kill_id) from t1;
62
connection should_succeed;
67
# One of the following statements should fail
76
select ((@id := kill_id) - kill_id) from t1;
77
select @id != connection_id();
79
# Set the table to our current id now
80
update t1 set kill_id = connection_id();
82
# Test that we cannot kill a process owned by someone else
38
select ((@id := kill_id) - kill_id) from t1;
46
# One of the following statements should fail
55
select ((@id := kill_id) - kill_id) from t1;
56
select @id != connection_id();
58
update t1 set kill_id= connection_id();
60
connection should_succeed;
61
--replace_column 3 # 6 #
84
--replace_column 3 # 5 # 6 # 7 # 8 #
63
86
select ((@id := kill_id) - kill_id) from t1;
65
88
--error ER_NO_SUCH_THREAD
91
# Test that root can see everybody
93
--replace_column 3 # 5 # 6 # 7 # 8 #
96
# Test that root can kill someone else
99
select ((@id := kill_id) - kill_id) from t1;
102
connection should_succeed;
107
# One of the following statements should fail
116
select ((@id := kill_id) - kill_id) from t1;
117
select @id != connection_id();
71
120
# Test failing initial connection