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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
|
# The numbers represent test cases of the test plan.
--source include/have_plugin_auth.inc
--source include/not_embedded.inc
CREATE DATABASE test_user_db;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo ========== test 1.1.3.2 ====================================
# CREATE...WITH/CREATE...BY/GRANT
CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
GRANT PROXY ON plug_dest TO plug_user;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
REVOKE PROXY ON plug_dest FROM plug_user;
--error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
DROP USER plug_user,plug_dest;
#
# GRANT...WITH
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
GRANT PROXY ON plug_dest TO plug_user;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo 1)
--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
--echo 2)
--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
REVOKE PROXY ON plug_dest FROM plug_user;
--echo 3)
--error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
DROP USER plug_user,plug_dest;
#
# GRANT...WITH/CREATE...BY
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
--echo 1)
--error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
GRANT PROXY ON plug_dest TO plug_user;
--echo 2)
--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
#REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_dest'
# IDENTIFIED BY 'plug_dest_passwd';
DROP USER plug_user,plug_dest;
--echo ========== test 1.2 ========================================
# GRANT...WITH/CREATE...BY
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
GRANT PROXY ON plug_dest TO plug_user;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
RENAME USER plug_dest TO new_dest;
--error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
GRANT PROXY ON new_dest TO plug_user;
--error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug_user,new_dest;
# CREATE...WITH/CREATE...BY
CREATE USER plug_user
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
--error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
GRANT PROXY ON plug_dest TO plug_user;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
RENAME USER plug_dest TO new_dest;
--error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
GRANT PROXY ON new_dest TO plug_user;
--error 1
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user $PLUGIN_AUTH_OPT --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug_user,new_dest;
# CREATE...WITH
CREATE USER plug_user
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
GRANT PROXY ON plug_dest TO plug_user;
--echo connect(plug_user,localhost,plug_user,plug_dest);
connect(plug_user,localhost,plug_user,plug_dest);
select USER(),CURRENT_USER();
--echo connection default;
connection default;
--echo disconnect plug_user;
disconnect plug_user;
RENAME USER plug_user TO new_user;
--echo connect(plug_user,localhost,new_user,plug_dest);
connect(plug_user,localhost,new_user,plug_dest);
select USER(),CURRENT_USER();
--echo connection default;
connection default;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo disconnect plug_user;
disconnect plug_user;
UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
FLUSH PRIVILEGES;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug_dest,plug_user;
--echo ========== test 1.3 ========================================
#
CREATE USER plug_user
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
GRANT PROXY ON plug_dest TO plug_user;
--echo connect(plug_user,localhost,plug_user,plug_dest);
connect(plug_user,localhost,plug_user,plug_dest);
select USER(),CURRENT_USER();
--echo connection default;
connection default;
--echo disconnect plug_user;
disconnect plug_user;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
FLUSH PRIVILEGES;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
FLUSH PRIVILEGES;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
FLUSH PRIVILEGES;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo connect(plug_user,localhost,new_user,new_dest);
--disable_query_log
--error ER_PLUGIN_IS_NOT_LOADED
connect(plug_user,localhost,new_user,new_dest);
--enable_query_log
UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest';
FLUSH PRIVILEGES;
GRANT PROXY ON new_dest TO new_user;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo connect(plug_user,localhost,new_user,new_dest);
connect(plug_user,localhost,new_user,new_dest);
select USER(),CURRENT_USER();
--echo connection default;
connection default;
--echo disconnect plug_user;
disconnect plug_user;
UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest';
FLUSH PRIVILEGES;
CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
GRANT ALL PRIVILEGES ON test.* TO new_user;
--echo connect(plug_user,localhost,new_dest,new_dest_passwd);
connect(plug_user,localhost,new_dest,new_dest_passwd);
select USER(),CURRENT_USER();
--echo connection default;
connection default;
--echo disconnect plug_user;
disconnect plug_user;
DROP USER new_user,new_dest,plug_dest;
--echo ========== test 2, 2.1, 2.2 ================================
CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
SELECT USER(),CURRENT_USER();
--echo ========== test 2.2.1 ======================================
SELECT @@proxy_user;
--echo connection default;
connection default;
--echo disconnect proxy_con;
disconnect proxy_con;
--echo connect(proxy_con,localhost,proxy_user,proxied_user);
--disable_query_log
--error ER_ACCESS_DENIED_ERROR : this should fail : no grant
connect(proxy_con,localhost,proxy_user,proxied_user);
--enable_query_log
GRANT PROXY ON proxied_user TO ''@'';
--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
SELECT USER(),CURRENT_USER();
--echo connection default;
connection default;
--echo disconnect proxy_con;
disconnect proxy_con;
--echo connect(proxy_con,localhost,proxy_user,proxied_user);
connect(proxy_con,localhost,proxy_user,proxied_user);
SELECT USER(),CURRENT_USER();
--echo ========== test 2.2.1 ======================================
SELECT @@proxy_user;
--echo connection default;
connection default;
--echo disconnect proxy_con;
disconnect proxy_con;
DROP USER ''@'',proxied_user;
#
GRANT ALL PRIVILEGES ON test_user_db.* TO ''@''
IDENTIFIED WITH test_plugin_server AS 'proxied_user';
CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
SELECT USER(),CURRENT_USER();
SELECT @@proxy_user;
--echo connection default;
connection default;
--echo disconnect proxy_con;
disconnect proxy_con;
--echo connect(proxy_con,localhost,proxy_user,proxied_user);
--disable_query_log
--error ER_ACCESS_DENIED_ERROR : this should fail : no grant
connect(proxy_con,localhost,proxy_user,proxied_user);
--enable_query_log
GRANT PROXY ON proxied_user TO ''@'';
--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
SELECT USER(),CURRENT_USER();
--echo connection default;
connection default;
--echo disconnect proxy_con;
disconnect proxy_con;
--echo connect(proxy_con,localhost,proxy_user,proxied_user);
connect(proxy_con,localhost,proxy_user,proxied_user);
SELECT USER(),CURRENT_USER();
SELECT @@proxy_user;
--echo connection default;
connection default;
--echo disconnect proxy_con;
disconnect proxy_con;
DROP USER ''@'',proxied_user;
#
CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd';
CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd';
CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd';
CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd';
CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd';
GRANT PROXY ON proxied_user_1 TO ''@'';
GRANT PROXY ON proxied_user_2 TO ''@'';
GRANT PROXY ON proxied_user_3 TO ''@'';
GRANT PROXY ON proxied_user_4 TO ''@'';
GRANT PROXY ON proxied_user_5 TO ''@'';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
--echo connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
--echo connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);
connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);
--echo connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd);
connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd);
--echo connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd);
connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd);
--echo connection proxy_con_1;
connection proxy_con_1;
SELECT USER(),CURRENT_USER();
SELECT @@proxy_user;
--echo connection proxy_con_2;
connection proxy_con_2;
SELECT USER(),CURRENT_USER();
SELECT @@proxy_user;
--echo connection proxy_con_3;
connection proxy_con_3;
SELECT USER(),CURRENT_USER();
SELECT @@proxy_user;
--echo connection proxy_con_4;
connection proxy_con_4;
SELECT USER(),CURRENT_USER();
SELECT @@proxy_user;
--echo connection proxy_con_5;
connection proxy_con_5;
SELECT USER(),CURRENT_USER();
SELECT @@proxy_user;
--echo connection default;
connection default;
--echo disconnect proxy_con_1;
disconnect proxy_con_1;
--echo disconnect proxy_con_2;
disconnect proxy_con_2;
--echo disconnect proxy_con_3;
disconnect proxy_con_3;
--echo disconnect proxy_con_4;
disconnect proxy_con_4;
--echo disconnect proxy_con_5;
disconnect proxy_con_5;
DROP USER ''@'',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5;
--echo ========== test 3 ==========================================
GRANT ALL PRIVILEGES ON *.* TO plug_user
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
GRANT PROXY ON plug_dest TO plug_user;
FLUSH PRIVILEGES;
# Not working with the patch.
#--replace_result $MYSQLADMIN MYSQLADMIN $MASTER_MYPORT MYPORT $MASTER_MYSOCK MYSOCK
#--exec $MYSQLADMIN $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -S $MASTER_MYSOCK -u plug_user --password=plug_dest ping 2>&1
#--replace_result $MYSQL_CHECK MYSQL_CHECK $MASTER_MYPORT MYPORT
#--exec $MYSQL_CHECK $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT -u plug_user --password=plug_dest test
#--replace_result $MYSQL_DUMP MYSQL_DUMP $MASTER_MYPORT MYPORT
#--exec $MYSQL_DUMP -h localhost -P $MASTER_MYPORT $PLUGIN_AUTH_OPT -u plug_user --password=plug_dest test
#--replace_result $MYSQL_SHOW MYSQL_SHOW $MASTER_MYPORT MYPORT
#--exec $MYSQL_SHOW $PLUGIN_AUTH_OPT -h localhost -P $MASTER_MYPORT --plugin_dir=../plugin/auth -u plug_user --password=plug_dest 2>&1
DROP USER plug_user, plug_dest;
DROP DATABASE test_user_db;
--exit
|