File: sha256_password_proxy_users_log.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (123 lines) | stat: -rw-r--r-- 4,736 bytes parent folder | download
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
############ mysql-test\t\sha256_password_proxy_users_log.test #################
#                                                                              #
#Variable Name: sha256_password                                                #
#Scope: SESSION                                                                #
#Access Type: Dynamic                                                          #
#Data Type: BOOLEAN                                                            #
#Default Value: OFF                                                            #
#Values:      ON, OFF                                                          #
#                                                                              #
#                                                                              #
#Creation Date: 2015-02-12                                                     #
#Author:  Horst Hunger                                                         #
#                                                                              #
#Description: Test Cases of Dynamic System Variable                            #
#             "sha256_password_proxy_users"                                    #
#             to assure entries in general log.                                #
#                                                                              #
################################################################################

--echo ** Setup **
--echo
#
# Setup
#

SET @old_log_output=          @@global.log_output;
SET @old_general_log=         @@global.general_log;
SET @old_general_log_file=    @@global.general_log_file;

--replace_result $MYSQLTEST_VARDIR ...
eval SET GLOBAL general_log_file = '$MYSQLTEST_VARDIR/log/proxy_general.log';
SET GLOBAL log_output =       'FILE,TABLE';
SET GLOBAL general_log=       'ON';


SET @default_sha256_password_proxy_users = @@global.sha256_password_proxy_users;
SET @default_check_proxy_users = @@global.check_proxy_users;

--echo '#----- 2.1.12.1 Test of general log entries. -------------------#'
###################################
#Setting value OFF                #
###################################

SET Global sha256_password_proxy_users=OFF;

###################################
#Setting up proxy accounts        #
###################################

--echo ** Creating new base user **
CREATE USER proxy_base@localhost;
GRANT ALTER ON *.* TO proxy_base@localhost;
--echo ** Creating new proxy user **
CREATE USER proxy_sha256@localhost IDENTIFIED WITH sha256_password;
GRANT CREATE ON *.* TO proxy_sha256@localhost;
GRANT PROXY ON proxy_base@localhost TO proxy_sha256@localhost;

###################################
#Setting value ON                 #
###################################

SET Global sha256_password_proxy_users=ON;

--echo ** Connecting as proxy_sha256 with proxy mapping disabled (native mapping on) **
CONNECT (connd,localhost,proxy_sha256,,);
SELECT CURRENT_USER(), USER(), @@session.proxy_user;
SHOW GRANTS;

--echo ** Connection default **
connection default;

--echo ** Disconnecting connections **
DISCONNECT connd;

###################################
#Setting check_proxy value ON     #
###################################

SET Global check_proxy_users=ON;

--echo ** Connecting as proxy_sha256 with proxy mapping enabled **
CONNECT (connf,localhost,proxy_sha256,,);
SELECT CURRENT_USER(), USER(), @@session.proxy_user;
SHOW GRANTS;

connection default;

--echo ** Disconnecting connections **
DISCONNECT connf;

###################################
#Analyzing general log            #
###################################
SET GLOBAL general_log=       'OFF';

#show general-logging to file is correct
CREATE TABLE test_log (argument TEXT);
--replace_result $MYSQLTEST_VARDIR ...
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/log/proxy_general.log'
     INTO TABLE test_log FIELDS TERMINATED BY '\n' LINES TERMINATED BY '\n';

SELECT count(argument) FROM test_log
       WHERE argument LIKE '%proxy_sha256@localhost on test%';
SELECT count(argument) FROM test_log
        WHERE argument LIKE '%proxy_sha256@localhost as proxy_base on test%';

DROP TABLE test_log;

###################################
#Cleaning up                      #
###################################

DROP USER proxy_base@localhost;
DROP USER proxy_sha256@localhost;

SET @@global.sha256_password_proxy_users = @default_sha256_password_proxy_users;
SET @@global.check_proxy_users = @default_check_proxy_users;

SET GLOBAL general_log_file=  @old_general_log_file;
SET GLOBAL general_log=       @old_general_log;
SET GLOBAL log_output=        @old_log_output;
TRUNCATE TABLE mysql.general_log;
--remove_file '$MYSQLTEST_VARDIR/log/proxy_general.log'