~ubuntu-branches/ubuntu/precise/mysql-5.5/precise-201203300109

« back to all changes in this revision

Viewing changes to mysql-test/t/plugin_auth_qa_2.test

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2011-11-08 11:31:13 UTC
  • Revision ID: package-import@ubuntu.com-20111108113113-3ulw01fvi4vn8m25
Tags: upstream-5.5.17
ImportĀ upstreamĀ versionĀ 5.5.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Horst Hunger
 
2
# Created: 2010-10-06
 
3
 
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
 
8
 
 
9
CREATE DATABASE test_user_db;
 
10
 
 
11
--echo ========== test 1.1.3.2 ====================================
 
12
--echo === check contens of components of info ====================
 
13
 
 
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;
 
18
--sorted_result
 
19
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 
20
SELECT @@proxy_user;
 
21
SELECT @@external_user;
 
22
 
 
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
 
25
 
 
26
--sorted_result
 
27
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 
28
 
 
29
DROP USER qa_test_1_user;
 
30
DROP USER qa_test_1_dest;
 
31
 
 
32
--echo === Assign values to components of info ====================
 
33
 
 
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;
 
40
--sorted_result
 
41
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 
42
SELECT @@proxy_user;
 
43
SELECT @@external_user;
 
44
 
 
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
 
47
 
 
48
--sorted_result
 
49
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 
50
 
 
51
DROP USER qa_test_2_user;
 
52
DROP USER qa_test_2_dest;
 
53
DROP USER authenticated_as;
 
54
 
 
55
--echo === Assign too high values for *length, which should have no effect ====
 
56
 
 
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;
 
61
 
 
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
 
64
 
 
65
DROP USER qa_test_3_user;
 
66
DROP USER qa_test_3_dest;
 
67
 
 
68
--echo === Assign too low values for *length, which should have no effect ====
 
69
 
 
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;
 
74
 
 
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
 
77
 
 
78
DROP USER qa_test_4_user;
 
79
DROP USER qa_test_4_dest;
 
80
 
 
81
--echo === Assign empty string especially to authenticated_as (in plugin) ====
 
82
 
 
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';
 
90
 
 
91
--sorted_result
 
92
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
 
93
 
 
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
 
95
--error 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
 
97
 
 
98
DROP USER qa_test_5_user;
 
99
DROP USER qa_test_5_dest;
 
100
DROP USER ''@'localhost';
 
101
 
 
102
--echo === Assign 'root' especially to authenticated_as (in plugin) ====
 
103
 
 
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;
 
108
 
 
109
--sorted_result
 
110
SELECT user,plugin,authentication_string,password FROM mysql.user;
 
111
 
 
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
 
113
--error 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
 
115
 
 
116
GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
 
117
--sorted_result
 
118
SELECT user,plugin,authentication_string,password FROM mysql.user;
 
119
 
 
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
 
121
--error 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
 
123
 
 
124
REVOKE PROXY ON qa_test_6_dest FROM root;
 
125
--sorted_result
 
126
SELECT user,plugin,authentication_string FROM mysql.user;
 
127
 
 
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
 
129
--error 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
 
131
 
 
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';
 
135
--sorted_result
 
136
SELECT user,plugin,authentication_string,password FROM mysql.user;
 
137
 
 
138
 
 
139
--echo === Test of the --default_auth option for clients ====
 
140
 
 
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;
 
145
 
 
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
 
147
--error 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
 
149
 
 
150
DROP USER qa_test_11_user, qa_test_11_dest;
 
151
DROP DATABASE test_user_db;
 
152
 
 
153
--exit