| 1 |
############ mysql-test\t\mysql_native_password_log.test ####################### |
| 2 |
# # |
| 3 |
#Variable Name: mysql_native_password # |
| 4 |
#Scope: SESSION # |
| 5 |
#Access Type: Dynamic # |
| 6 |
#Data Type: BOOLEAN # |
| 7 |
#Default Value: OFF # |
| 8 |
#Values: ON, OFF # |
| 9 |
# # |
| 10 |
# # |
| 11 |
#Creation Date: 2015-02-12 # |
| 12 |
#Author: Horst Hunger # |
| 13 |
# # |
| 14 |
#Description: Test Cases of Dynamic System Variable # |
| 15 |
# "mysql_native_password" # |
| 16 |
# to assure entries in general log. # |
| 17 |
# # |
| 18 |
#Reference: http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html# |
| 19 |
# option_mysqld_mysql_native_password # |
| 20 |
# # |
| 21 |
################################################################################ |
| 22 |
|
| 23 |
--echo ** Setup ** |
| 24 |
--echo |
| 25 |
# |
| 26 |
# Setup |
| 27 |
# |
| 28 |
|
| 29 |
SET @old_log_output= @@global.log_output; |
| 30 |
SET @old_general_log= @@global.general_log; |
| 31 |
SET @old_general_log_file= @@global.general_log_file; |
| 32 |
|
| 33 |
--replace_result $MYSQLTEST_VARDIR ... |
| 34 |
eval SET GLOBAL general_log_file = '$MYSQLTEST_VARDIR/log/proxy_general.log'; |
| 35 |
SET GLOBAL log_output = 'FILE,TABLE'; |
| 36 |
SET GLOBAL general_log= 'ON'; |
| 37 |
|
| 38 |
|
| 39 |
SET @default_mysql_native_password_proxy_users = @@global.mysql_native_password_proxy_users; |
| 40 |
SET @default_check_proxy_users = @@global.check_proxy_users; |
| 41 |
|
| 42 |
--echo '#----- 2.1.12.1 Test of general log entries. -------------------#' |
| 43 |
################################### |
| 44 |
#Setting value OFF # |
| 45 |
################################### |
| 46 |
|
| 47 |
SET Global mysql_native_password_proxy_users=OFF; |
| 48 |
|
| 49 |
################################### |
| 50 |
#Setting up proxy accounts # |
| 51 |
################################### |
| 52 |
|
| 53 |
--echo ** Creating new base user ** |
| 54 |
CREATE USER proxy_base@localhost; |
| 55 |
GRANT ALTER ON *.* TO proxy_base@localhost; |
| 56 |
--echo ** Creating new proxy user ** |
| 57 |
CREATE USER proxy_native@localhost IDENTIFIED WITH mysql_native_password; |
| 58 |
GRANT CREATE ON *.* TO proxy_native@localhost; |
| 59 |
GRANT PROXY ON proxy_base@localhost TO proxy_native@localhost; |
| 60 |
|
| 61 |
################################### |
| 62 |
#Setting value ON # |
| 63 |
################################### |
| 64 |
|
| 65 |
SET Global mysql_native_password_proxy_users=ON; |
| 66 |
|
| 67 |
--echo ** Connecting as proxy_native with proxy mapping disabled (native mapping on) ** |
| 68 |
CONNECT (connd,localhost,proxy_native,,); |
| 69 |
SELECT CURRENT_USER(), USER(), @@session.proxy_user; |
| 70 |
SHOW GRANTS; |
| 71 |
|
| 72 |
--echo ** Connection default ** |
| 73 |
connection default; |
| 74 |
|
| 75 |
--echo ** Disconnecting connections ** |
| 76 |
DISCONNECT connd; |
| 77 |
|
| 78 |
################################### |
| 79 |
#Setting check_proxy value ON # |
| 80 |
################################### |
| 81 |
|
| 82 |
SET Global check_proxy_users=ON; |
| 83 |
|
| 84 |
--echo ** Connecting as proxy_native with proxy mapping enabled ** |
| 85 |
CONNECT (connf,localhost,proxy_native,,); |
| 86 |
SELECT CURRENT_USER(), USER(), @@session.proxy_user; |
| 87 |
SHOW GRANTS; |
| 88 |
|
| 89 |
connection default; |
| 90 |
|
| 91 |
--echo ** Disconnecting connections ** |
| 92 |
DISCONNECT connf; |
| 93 |
|
| 94 |
################################### |
| 95 |
#Analyzing general log # |
| 96 |
################################### |
| 97 |
SET GLOBAL general_log= 'OFF'; |
| 98 |
|
| 99 |
#show general-logging to file is correct |
| 100 |
CREATE TABLE test_log (argument TEXT); |
| 101 |
--replace_result $MYSQLTEST_VARDIR ... |
| 102 |
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/log/proxy_general.log' |
| 103 |
INTO TABLE test_log FIELDS TERMINATED BY '\n' LINES TERMINATED BY '\n'; |
| 104 |
|
| 105 |
SELECT count(argument) FROM test_log |
| 106 |
WHERE argument LIKE '%proxy_native@localhost on test%'; |
| 107 |
SELECT count(argument) FROM test_log |
| 108 |
WHERE argument LIKE '%proxy_native@localhost as proxy_base on test%'; |
| 109 |
|
| 110 |
DROP TABLE test_log; |
| 111 |
|
| 112 |
################################### |
| 113 |
#Cleaning up # |
| 114 |
################################### |
| 115 |
|
| 116 |
DROP USER proxy_base@localhost; |
| 117 |
DROP USER proxy_native@localhost; |
| 118 |
|
| 119 |
SET @@global.mysql_native_password_proxy_users = @default_mysql_native_password_proxy_users; |
| 120 |
SET @@global.check_proxy_users = @default_check_proxy_users; |
| 121 |
|
| 122 |
SET GLOBAL general_log_file= @old_general_log_file; |
| 123 |
SET GLOBAL general_log= @old_general_log; |
| 124 |
SET GLOBAL log_output= @old_log_output; |
| 125 |
TRUNCATE TABLE mysql.general_log; |
| 126 |
--remove_file '$MYSQLTEST_VARDIR/log/proxy_general.log' |