4
# Test of the authentification interface. The plugin checks the expected values set
5
# by this application and the application checks the values set the the plugin.
6
--source include/have_plugin_interface.inc
7
--source include/not_embedded.inc
9
CREATE DATABASE test_user_db;
11
--echo ========== test 1.1.3.2 ====================================
12
--echo === check contens of components of info ====================
14
CREATE USER qa_test_1_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_1_dest';
15
CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd';
16
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd';
17
GRANT PROXY ON qa_test_1_dest TO qa_test_1_user;
19
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
21
SELECT @@external_user;
23
--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
24
--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
27
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
29
DROP USER qa_test_1_user;
30
DROP USER qa_test_1_dest;
32
--echo === Assign values to components of info ====================
34
CREATE USER qa_test_2_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_2_dest';
35
CREATE USER qa_test_2_dest IDENTIFIED BY 'dest_passwd';
36
CREATE USER authenticated_as IDENTIFIED BY 'dest_passwd';
37
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_passwd';
38
GRANT PROXY ON qa_test_2_dest TO qa_test_2_user;
39
GRANT PROXY ON authenticated_as TO qa_test_2_user;
41
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
43
SELECT @@external_user;
45
--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
46
--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
49
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
51
DROP USER qa_test_2_user;
52
DROP USER qa_test_2_dest;
53
DROP USER authenticated_as;
55
--echo === Assign too high values for *length, which should have no effect ====
57
CREATE USER qa_test_3_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_3_dest';
58
CREATE USER qa_test_3_dest IDENTIFIED BY 'dest_passwd';
59
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_passwd';
60
GRANT PROXY ON qa_test_3_dest TO qa_test_3_user;
62
--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
63
--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
65
DROP USER qa_test_3_user;
66
DROP USER qa_test_3_dest;
68
--echo === Assign too low values for *length, which should have no effect ====
70
CREATE USER qa_test_4_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_4_dest';
71
CREATE USER qa_test_4_dest IDENTIFIED BY 'dest_passwd';
72
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_passwd';
73
GRANT PROXY ON qa_test_4_dest TO qa_test_4_user;
75
--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
76
--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
78
DROP USER qa_test_4_user;
79
DROP USER qa_test_4_dest;
81
--echo === Assign empty string especially to authenticated_as (in plugin) ====
83
CREATE USER qa_test_5_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_5_dest';
84
CREATE USER qa_test_5_dest IDENTIFIED BY 'dest_passwd';
85
CREATE USER ''@'localhost' IDENTIFIED BY 'dest_passwd';
86
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_5_dest identified by 'dest_passwd';
87
GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'localhost' identified by 'dest_passwd';
88
GRANT PROXY ON qa_test_5_dest TO qa_test_5_user;
89
GRANT PROXY ON qa_test_5_dest TO ''@'localhost';
92
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
94
--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
96
--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
98
DROP USER qa_test_5_user;
99
DROP USER qa_test_5_dest;
100
DROP USER ''@'localhost';
102
--echo === Assign 'root' especially to authenticated_as (in plugin) ====
104
CREATE USER qa_test_6_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
105
CREATE USER qa_test_6_dest IDENTIFIED BY 'dest_passwd';
106
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_6_dest identified by 'dest_passwd';
107
GRANT PROXY ON qa_test_6_dest TO qa_test_6_user;
110
SELECT user,plugin,authentication_string,password FROM mysql.user;
112
--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
114
--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
116
GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
118
SELECT user,plugin,authentication_string,password FROM mysql.user;
120
--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
122
--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
124
REVOKE PROXY ON qa_test_6_dest FROM root;
126
SELECT user,plugin,authentication_string FROM mysql.user;
128
--echo exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
130
--exec $MYSQL $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
132
DROP USER qa_test_6_user;
133
DROP USER qa_test_6_dest;
134
DELETE FROM mysql.user WHERE user='root' AND plugin='qa_auth_interface';
136
SELECT user,plugin,authentication_string,password FROM mysql.user;
139
--echo === Test of the --default_auth option for clients ====
141
CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_dest';
142
CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd';
143
GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
144
GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
146
--echo exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
148
--exec $MYSQL $PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P $MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
150
DROP USER qa_test_11_user, qa_test_11_dest;
151
DROP DATABASE test_user_db;