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
|
# auth_file has to be used to provide access for user root, else the tests
# won't work. auth_schema can't provide this access because no one has
# access until the auth table is created.
# Check that the plugin is loaded and using the default auth.users table.
SHOW VARIABLES LIKE 'auth_schema%';
# mysql_protocol provides MYSQL_PASSWORD().
SELECT MYSQL_PASSWORD('test_pass');
CREATE SCHEMA auth;
USE auth;
CREATE TABLE users (
user VARCHAR(255) NOT NULL,
password VARCHAR(40),
UNIQUE INDEX user_idx (user)
);
INSERT INTO users VALUES ('test_user', '34F2496C75CF8F8D8EBE14067C9C8B1AA8E80DEF');
SELECT * FROM users ORDER BY user;
connect(conn1, localhost, test_user, test_pass,,);
connection conn1;
SELECT 'connection 1 works';
--exec $TOP_BUILDDIR/client/drizzle --host=localhost --port=$MASTER_MYPORT -e "SELECT 'client 1 works'" --user=test_user --password=test_pass 2>&1
# Test that bad passwords aren't accepted.
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--replace_regex /@'.*?'/@'LOCALHOST'/
--error ER_ACCESS_DENIED_ERROR
connect (bad_user,localhost,test_user,foo,,);
# Test that the auth table can be changed dynamically.
USE auth;
CREATE TABLE users2 (
user VARCHAR(255) NOT NULL,
password VARCHAR(40),
UNIQUE INDEX user_idx (user)
);
INSERT INTO users2 VALUES ('test_user2', '34F2496C75CF8F8D8EBE14067C9C8B1AA8E80DEF');
SELECT * FROM users2 ORDER BY user;
SET GLOBAL auth_schema_table='auth.users2';
SHOW VARIABLES LIKE 'auth_schema%';
connect(conn2, localhost, test_user2, test_pass,,);
connection conn2;
SELECT 'connection 2 works';
--exec $TOP_BUILDDIR/client/drizzle --host=localhost --port=$MASTER_MYPORT -e "SELECT 'client 2 works'" --user=test_user2 --password=test_pass 2>&1
# Restore the original auth table for subsequent tests (or --repeat 2).
SET GLOBAL auth_schema_table='auth.users';
# Test that auth_schema works with hex strings created MYSQL_PASSWORD().
INSERT INTO auth.users VALUES ('test_user3', MYSQL_PASSWORD('mypass'));
SELECT * FROM auth.users WHERE user='test_user3';
--exec $TOP_BUILDDIR/client/drizzle --host=localhost --port=$MASTER_MYPORT -e "SELECT 'client 3 works'" --user=test_user3 --password=mypass 2>&1
DROP SCHEMA auth;
|