Debian Codegraph @

mysql-test/suite/sys_vars/t/secure_auth_func.test

raw
1 ############# mysql-test\t\secure_auth_func.test ##########################
2 # #
3 # Variable Name: secure_auth #
4 # Scope: GLOBAL #
5 # Access Type: Dynamic #
6 # Data Type: boolean #
7 # Default Value: FALSE #
8 # Values: TRUE / 1, FALSE / 0 #
9 # #
10 # #
11 # Creation Date: 2008-02-22 #
12 # Author: Sharique Abdullah #
13 # #
14 # Description: Test Cases of Dynamic System Variable "secure_auth " #
15 # that checks behavior of this variable in the following ways#
16 # * Default Value #
17 # * Valid & Invalid values #
18 # * Scope & Access method #
19 # * Cache behaviors #
20 # #
21 # Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22 # server-system-variables.html#option_mysqld_secure_auth #
23 # #
24 ###########################################################################
25
26 --echo ** Setup **
27 --echo
28 #
29 # Setup
30 #
31
32 --source include/not_embedded.inc
33
34 #
35 # Save initial value
36 #
37
38 SET @old_secure_auth = @@GLOBAL.secure_auth;
39
40 --echo '#--------------------FN_DYNVARS_144_01-------------------------#'
41 #
42 # Testing command line option value
43 #
44
45 SELECT @@GLOBAL.secure_auth;
46 --echo 1 / ON Expected
47
48 --echo '#--------------------FN_DYNVARS_144_02-------------------------#'
49 #
50 # Value OFF
51 #
52 SET GLOBAL secure_auth = OFF;
53
54 #
55 # Creating user with password in NEW format
56 #
57 CREATE USER 'testUser'@'localhost' IDENTIFIED BY 'newpass';
58
59 connect (con_user1,localhost,testUser,newpass,);
60
61 connection default;
62
63 #
64 # Setting password in OLD format
65 #
66 SET PASSWORD FOR 'testUser'@'localhost' = OLD_PASSWORD('newpass');
67
68 connect (con_user2,localhost,testUser,newpass,,,,auth=mysql_old_password:mysql_native_password);
69
70
71 connection default;
72
73 --echo '#--------------------FN_DYNVARS_144_03-------------------------#'
74 #
75 # Value ON
76 #
77 SET GLOBAL secure_auth = ON;
78
79 #
80 # Setting password in NEW format
81 #
82 SET PASSWORD FOR 'testUser'@'localhost' = PASSWORD('newpass');
83
84 connect (con_user3,localhost,testUser,newpass,);
85 connection default;
86
87 #
88 # Setting password in OLD format
89 #
90 SET PASSWORD FOR 'testUser'@'localhost' = OLD_PASSWORD('newpass');
91
92 --disable_query_log
93 --error ER_SERVER_IS_IN_SECURE_AUTH_MODE
94 connect (con_user4,localhost,testUser,newpass,);
95 --enable_query_log
96 --echo Expected error "Server is in secure auth mode"
97
98 connection default;
99
100 #
101 # Setting password back in NEW format
102 #
103 SET PASSWORD FOR 'testUser'@'localhost' = PASSWORD('newpass');
104
105 connect (con_user4,localhost,testUser,newpass,);
106
107 connection default;
108
109 #
110 # Cleanup
111 #
112
113 SET GLOBAL secure_auth = @old_secure_auth;
114
115 disconnect con_user1;
116 disconnect con_user2;
117 disconnect con_user3;
118 disconnect con_user4;
119
120 REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'testUser'@'localhost';
121
122 DROP USER 'testUser'@'localhost';