~jlukas79/+junk/mysql-server

« back to all changes in this revision

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

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
--echo ** Connecting con_user1 using testUser **
 
60
connect (con_user1,localhost,testUser,newpass,);
 
61
 
 
62
--echo ** Connection default**
 
63
connection default;
 
64
 
 
65
#
 
66
# Setting password in OLD format
 
67
#
 
68
SET PASSWORD FOR 'testUser'@'localhost' = OLD_PASSWORD('newpass');
 
69
 
 
70
--echo ** Connecting con_user2 using testUser **
 
71
connect (con_user2,localhost,testUser,newpass,);
 
72
 
 
73
--echo ** Connection default**
 
74
connection default;
 
75
 
 
76
--echo '#--------------------FN_DYNVARS_144_03-------------------------#'
 
77
#
 
78
# Value ON
 
79
#
 
80
SET GLOBAL secure_auth = ON;
 
81
 
 
82
#
 
83
# Setting password in NEW format
 
84
#
 
85
SET PASSWORD FOR 'testUser'@'localhost' = PASSWORD('newpass');
 
86
 
 
87
--echo ** Connecting con_user3 using testUser **
 
88
connect (con_user3,localhost,testUser,newpass,);
 
89
--echo ** Connection default **
 
90
connection default;
 
91
 
 
92
#
 
93
# Setting password in OLD format
 
94
#
 
95
SET PASSWORD FOR 'testUser'@'localhost' = OLD_PASSWORD('newpass');
 
96
 
 
97
--echo ** Connecting con_user4 using testUser **
 
98
--disable_query_log
 
99
--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
 
100
connect (con_user4,localhost,testUser,newpass,);
 
101
--enable_query_log
 
102
--echo Expected error "Server is in secure auth mode"
 
103
 
 
104
--echo ** Connection default**
 
105
connection default;
 
106
 
 
107
#
 
108
# Setting password back in NEW format
 
109
#
 
110
SET PASSWORD FOR 'testUser'@'localhost' = PASSWORD('newpass');
 
111
 
 
112
--echo ** Connecting con_user4 using testUser **
 
113
connect (con_user4,localhost,testUser,newpass,);
 
114
 
 
115
--echo ** Connection default **
 
116
connection default;
 
117
 
 
118
#
 
119
# Cleanup
 
120
#
 
121
 
 
122
SET GLOBAL secure_auth = @old_secure_auth;
 
123
 
 
124
--echo Disconnecting Connections con_user1, con_user2, con_user3, con_user4
 
125
disconnect con_user1;
 
126
disconnect con_user2;
 
127
disconnect con_user3;
 
128
disconnect con_user4;
 
129
 
 
130
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'testUser'@'localhost';
 
131
 
 
132
DROP USER 'testUser'@'localhost';