~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to mysql-test/suite/auth_sec/t/mysql_sha256_plugin.test

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
###############################################################################
 
2
#                                                                             #
 
3
# Authorization and authentication using the SHA256_PASSWORD plugin at        # 
 
4
# server and client side                                                      #
 
5
#                                                                             #
 
6
#                                                                             #
 
7
#                                                                             #
 
8
# Creation Date: 2012-12-10                                                   #
 
9
# Author : Tanjot Singh Uppal                                                 #
 
10
#                                                                             #
 
11
#                                                                             #
 
12
# Description:Test Cases of authenticating the hashed password using the      #
 
13
# sha256_password plugin at the server side as well as the client side        #
 
14
#                                                                             #
 
15
#                                                                             #
 
16
###############################################################################
 
17
 
 
18
--source include/not_embedded.inc
 
19
--source include/have_ssl.inc
 
20
--source include/have_sha256_rsa_auth.inc
 
21
--source include/mysql_upgrade_preparation.inc
 
22
 
 
23
# This test will intentionally generate errors in the server error log
 
24
# when a broken password is inserted into the mysql.user table.
 
25
# The below suppression is to clear those errors.
 
26
 
 
27
 
 
28
--disable_query_log
 
29
call mtr.add_suppression(".*Password salt for user.*");
 
30
--enable_query_log
 
31
 
 
32
--echo
 
33
--echo 
 
34
--echo ===========================================================================================================================================
 
35
--echo Checking the password authentication using the sha256_password plugin at the client and mysql_native_password plugin at the server side
 
36
--echo ===========================================================================================================================================
 
37
--echo 
 
38
 
 
39
select @@Global.old_passwords;
 
40
--echo 0 Expected
 
41
 
 
42
select @@session.old_passwords;
 
43
--echo 0 Expected
 
44
 
 
45
# Checking the password authentication with sha256_password plugin
 
46
# Creating 2 users and encrypting the server side password with the sha256_password plugin
 
47
 
 
48
CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'sha256_password';
 
49
 
 
50
CREATE USER 'Tanjotuser2'@'127.0.0.1' IDENTIFIED WITH 'sha256_password';
 
51
 
 
52
# Verifying the server side plugin used to be sha256_password
 
53
 
 
54
select (select plugin from mysql.user where User='Tanjotuser1' and Host='localhost')='sha256_password';
 
55
--echo 1 Expected
 
56
 
 
57
select (select plugin from mysql.user where User='Tanjotuser2' and Host='127.0.0.1')='sha256_password';
 
58
--echo 1 Expected
 
59
 
 
60
# Verifying the client connection using the same sha256_password plugin and NULL password
 
61
 
 
62
connect(con1,localhost,Tanjotuser1,,,);
 
63
connect(con2,127.0.0.1,Tanjotuser2,,,);
 
64
 
 
65
# Verifying the client connection using the same sha256_password plugin and junk password
 
66
 
 
67
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
68
--replace_result "NO" "" "YES" ""
 
69
--disable_query_log
 
70
--error ER_ACCESS_DENIED_ERROR
 
71
connect(con3,localhost,Tanjotuser1," ",,);
 
72
--enable_query_log
 
73
 
 
74
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
75
--replace_result "NO" "" "YES" ""
 
76
--disable_query_log
 
77
--error ER_ACCESS_DENIED_ERROR
 
78
connect(con4,127.0.0.1,Tanjotuser2," ",,);
 
79
--enable_query_log
 
80
 
 
81
# setting the password for the 2 users using the sha256_password plugin
 
82
 
 
83
connection default;
 
84
 
 
85
# setting the old_passwords in sync with the sha256 plugin
 
86
 
 
87
set @@session.old_passwords=2;
 
88
 
 
89
 
 
90
SET PASSWORD FOR 'Tanjotuser1'@'localhost'=PASSWORD('abc');
 
91
SET PASSWORD FOR 'Tanjotuser2'@'127.0.0.1'=PASSWORD('abc');
 
92
 
 
93
# Validating the old_passwords value from the created users.
 
94
 
 
95
 
 
96
--echo **** connecting Tanjotuser1 with server 
 
97
--exec $MYSQL -uTanjotuser1 -pabc -hlocalhost --default_auth=mysql_native_password -e "select @@session.old_passwords"
 
98
--echo 2 Expected
 
99
 
 
100
--echo **** connecting Tanjotuser2 with server 
 
101
--exec $MYSQL -uTanjotuser2 -pabc -h127.0.0.1 --default_auth=mysql_native_password -e "select @@session.old_passwords"
 
102
--echo 2 Expected
 
103
 
 
104
 
 
105
 
 
106
--echo **** connecting Tanjotuser1 with server 
 
107
--exec $MYSQL -uTanjotuser1 -pabc -hlocalhost --default_auth=mysql_old_password -e "select @@session.old_passwords"
 
108
--echo 2 Expected
 
109
 
 
110
--echo **** connecting Tanjotuser2 with server 
 
111
--exec $MYSQL -uTanjotuser2 -pabc -h127.0.0.1 --default_auth=mysql_old_password -e "select @@session.old_passwords"
 
112
--echo 2 Expected
 
113
 
 
114
 
 
115
 
 
116
--echo **** connecting Tanjotuser1 with server 
 
117
--exec $MYSQL -uTanjotuser1 -pabc -hlocalhost --default_auth=sha256_password -e "select @@session.old_passwords"
 
118
--echo 2 Expected
 
119
 
 
120
--echo **** connecting Tanjotuser2 with server 
 
121
--exec $MYSQL -uTanjotuser2 -pabc -h127.0.0.1 --default_auth=sha256_password -e "select @@session.old_passwords"
 
122
--echo 2 Expected
 
123
 
 
124
 
 
125
 
 
126
--echo **** connecting Tanjotuser1 with server 
 
127
--exec $MYSQL -uTanjotuser1 -pabc -hlocalhost -e "select @@session.old_passwords"
 
128
--echo 2 Expected
 
129
 
 
130
--echo **** connecting Tanjotuser2 with server 
 
131
--exec $MYSQL -uTanjotuser2 -pabc -h127.0.0.1 -e "select @@session.old_passwords"
 
132
--echo 2 Expected
 
133
 
 
134
 
 
135
# Verifying the client connection using the  sha256_password plugin and NULL password
 
136
 
 
137
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
138
--replace_result "NO" "" "YES" ""
 
139
--disable_query_log
 
140
--error ER_ACCESS_DENIED_ERROR
 
141
connect(con5,localhost,Tanjotuser1,,,);
 
142
--enable_query_log
 
143
 
 
144
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
145
--replace_result "NO" "" "YES" ""
 
146
--disable_query_log
 
147
--error ER_ACCESS_DENIED_ERROR
 
148
connect(con6,127.0.0.1,Tanjotuser2,,,);
 
149
--enable_query_log
 
150
 
 
151
# Verifying the client connection using the  sha256_password plugin and junk password
 
152
 
 
153
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
154
--replace_result "NO" "" "YES" ""
 
155
--disable_query_log
 
156
--error ER_ACCESS_DENIED_ERROR
 
157
connect(con7,localhost,Tanjotuser1," ",,);
 
158
--enable_query_log
 
159
 
 
160
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
161
--replace_result "NO" "" "YES" ""
 
162
--disable_query_log
 
163
--error ER_ACCESS_DENIED_ERROR
 
164
connect(con8,127.0.0.1,Tanjotuser2," ",,);
 
165
--enable_query_log
 
166
 
 
167
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
168
--replace_result "NO" "" "YES" ""
 
169
--disable_query_log
 
170
--error ER_ACCESS_DENIED_ERROR
 
171
connect(con9,localhost,Tanjotuser1,"%",,);
 
172
--enable_query_log
 
173
 
 
174
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
175
--replace_result "NO" "" "YES" ""
 
176
--disable_query_log
 
177
--error ER_ACCESS_DENIED_ERROR
 
178
connect(con10,127.0.0.1,Tanjotuser2,"%",,);
 
179
--enable_query_log
 
180
 
 
181
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
182
--replace_result "NO" "" "YES" ""
 
183
--disable_query_log
 
184
--error ER_ACCESS_DENIED_ERROR
 
185
connect(con11,localhost,Tanjotuser1,"_",,);
 
186
--enable_query_log
 
187
 
 
188
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
189
--replace_result "NO" "" "YES" ""
 
190
--disable_query_log
 
191
--error ER_ACCESS_DENIED_ERROR
 
192
connect(con12,127.0.0.1,Tanjotuser2,"_",,);
 
193
--enable_query_log
 
194
 
 
195
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
196
--replace_result "NO" "" "YES" ""
 
197
--disable_query_log
 
198
--error ER_ACCESS_DENIED_ERROR
 
199
connect(con13,localhost,Tanjotuser1,"0",,);
 
200
--enable_query_log
 
201
 
 
202
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
203
--replace_result "NO" "" "YES" ""
 
204
--disable_query_log
 
205
--error ER_ACCESS_DENIED_ERROR
 
206
connect(con14,127.0.0.1,Tanjotuser2,"0",,);
 
207
--enable_query_log
 
208
 
 
209
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
210
--replace_result "NO" "" "YES" ""
 
211
--disable_query_log
 
212
--error ER_ACCESS_DENIED_ERROR
 
213
connect(con15,localhost,Tanjotuser1,"^",,);
 
214
--enable_query_log
 
215
 
 
216
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
217
--replace_result "NO" "" "YES" ""
 
218
--disable_query_log
 
219
--error ER_ACCESS_DENIED_ERROR
 
220
connect(con16,127.0.0.1,Tanjotuser2,"^",,);
 
221
--enable_query_log
 
222
 
 
223
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
224
--replace_result "NO" "" "YES" ""
 
225
--disable_query_log
 
226
--error ER_ACCESS_DENIED_ERROR
 
227
connect(con17,localhost,Tanjotuser1,'\$',,);
 
228
--enable_query_log
 
229
 
 
230
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
231
--replace_result "NO" "" "YES" ""
 
232
--disable_query_log
 
233
--error ER_ACCESS_DENIED_ERROR
 
234
connect(con18,127.0.0.1,Tanjotuser2,'\$',,);
 
235
--enable_query_log
 
236
 
 
237
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
238
--replace_result "NO" "" "YES" ""
 
239
--disable_query_log
 
240
--error ER_ACCESS_DENIED_ERROR
 
241
connect(con19,localhost,Tanjotuser1,"&",,);
 
242
--enable_query_log
 
243
 
 
244
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
245
--replace_result "NO" "" "YES" ""
 
246
--disable_query_log
 
247
--error ER_ACCESS_DENIED_ERROR
 
248
connect(con20,127.0.0.1,Tanjotuser2,"&",,);
 
249
--enable_query_log
 
250
 
 
251
 
 
252
# Verifying the client connection using the same sha256_password plugin and correct password with secure auth enabled
 
253
 
 
254
connection default;
 
255
 
 
256
select @@global.secure_auth;
 
257
--echo 1 Expected
 
258
 
 
259
connect(con21,localhost,Tanjotuser1,abc,,);
 
260
connect(con22,127.0.0.1,Tanjotuser2,abc,,);
 
261
 
 
262
# Verifying the client connection using the same sha256_password plugin and correct password with secure_auth disabled
 
263
 
 
264
connection default;
 
265
 
 
266
--disable_warnings
 
267
set @@global.secure_auth=0;
 
268
--enable_warnings
 
269
 
 
270
--disable_warnings
 
271
connect(con23,localhost,Tanjotuser1,abc,,);
 
272
connect(con24,127.0.0.1,Tanjotuser2,abc,,);
 
273
--enable_warnings
 
274
 
 
275
# Below section is hashed till the bug16040690 is fixed.
 
276
 
 
277
#--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
 
278
#connect(con25,localhost,Tanjotuser1,"abc ",,);
 
279
#--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
 
280
#connect(con26,127.0.0.1,Tanjotuser2,"abc ",,);
 
281
 
 
282
#--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
 
283
#connect(con27,localhost,Tanjotuser1," abc",,);
 
284
#--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
 
285
#connect(con28,127.0.0.1,Tanjotuser2," abc",,);
 
286
 
 
287
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
288
--replace_result "NO" "" "YES" ""
 
289
--disable_query_log
 
290
--error ER_ACCESS_DENIED_ERROR
 
291
connect(con29,localhost,Tanjotuser1,"0abc",,);
 
292
--enable_query_log
 
293
 
 
294
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
295
--replace_result "NO" "" "YES" ""
 
296
--disable_query_log
 
297
--error ER_ACCESS_DENIED_ERROR
 
298
connect(con30,127.0.0.1,Tanjotuser2,"0abc",,);
 
299
--enable_query_log
 
300
 
 
301
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
302
--replace_result "NO" "" "YES" ""
 
303
--disable_query_log
 
304
--error ER_ACCESS_DENIED_ERROR
 
305
connect(con31,localhost,Tanjotuser1,"abc0",,);
 
306
--enable_query_log
 
307
 
 
308
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
309
--replace_result "NO" "" "YES" ""
 
310
--disable_query_log
 
311
--error ER_ACCESS_DENIED_ERROR
 
312
connect(con32,127.0.0.1,Tanjotuser2,"abc0",,);
 
313
--enable_query_log
 
314
 
 
315
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
316
--replace_result "NO" "" "YES" ""
 
317
--disable_query_log
 
318
--error ER_ACCESS_DENIED_ERROR
 
319
connect(con33,localhost,Tanjotuser1,"@abc",,);
 
320
--enable_query_log
 
321
 
 
322
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
323
--replace_result "NO" "" "YES" ""
 
324
--disable_query_log
 
325
--error ER_ACCESS_DENIED_ERROR
 
326
connect(con34,127.0.0.1,Tanjotuser2,"@abc",,);
 
327
--enable_query_log
 
328
 
 
329
# Dropping the created users
 
330
 
 
331
connection default;
 
332
 
 
333
DROP USER 'Tanjotuser1'@'localhost';
 
334
DROP USER 'Tanjotuser2'@'127.0.0.1';
 
335
 
 
336
--echo
 
337
--echo 
 
338
--echo ====================================================================================================
 
339
--echo checking the integrity of long password (more than 40 chars) using sha256_password plugin
 
340
--echo ====================================================================================================
 
341
--echo
 
342
 
 
343
 
 
344
# Checking the password authentication with sha256_password plugin
 
345
# Creating 2 users and encrypting the server side password with the sha256_password plugin
 
346
 
 
347
CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'sha256_password';
 
348
 
 
349
CREATE USER 'Tanjotuser2'@'127.0.0.1' IDENTIFIED WITH 'sha256_password';
 
350
 
 
351
# setting the password for the 2 users using the sha256_password plugin
 
352
 
 
353
SET @@session.old_passwords=2;
 
354
 
 
355
SET PASSWORD FOR 'Tanjotuser1'@'localhost'=PASSWORD('$$$$$$$$$$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________');
 
356
SET PASSWORD FOR 'Tanjotuser2'@'127.0.0.1'=PASSWORD('$$$$$$$$$$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________');
 
357
 
 
358
 
 
359
# Verifying the client connection using the same sha256_password plugin and correct password with secure_auth disabled
 
360
 
 
361
--disable_warnings
 
362
set @@global.secure_auth=0;
 
363
--enable_warnings
 
364
 
 
365
--disable_warnings
 
366
connect(con35,localhost,Tanjotuser1,"\$\$\$\$\$\$\$\$\$\$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________",,);
 
367
connect(con36,127.0.0.1,Tanjotuser2,"\$\$\$\$\$\$\$\$\$\$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________",,);
 
368
--enable_warnings
 
369
 
 
370
 
 
371
# Verifying the client connection using the same sha256_password plugin and correct password with secure_auth enabled
 
372
 
 
373
connection default;
 
374
 
 
375
--disable_warnings
 
376
set @@global.secure_auth=1;
 
377
--enable_warnings
 
378
 
 
379
--disable_warnings
 
380
connect(con37,localhost,Tanjotuser1,"\$\$\$\$\$\$\$\$\$\$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________",,);
 
381
connect(con38,127.0.0.1,Tanjotuser2,"\$\$\$\$\$\$\$\$\$\$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________",,);
 
382
--enable_warnings
 
383
 
 
384
 
 
385
# Verifying the client access denied passing null password
 
386
 
 
387
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
388
--replace_result "NO" "" "YES" ""
 
389
--disable_query_log
 
390
--error ER_ACCESS_DENIED_ERROR
 
391
connect(con39,localhost,Tanjotuser1," ",,);
 
392
--enable_query_log
 
393
 
 
394
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
395
--replace_result "NO" "" "YES" ""
 
396
--disable_query_log
 
397
--error ER_ACCESS_DENIED_ERROR
 
398
connect(con40,127.0.0.1,Tanjotuser2," ",,);
 
399
--enable_query_log
 
400
 
 
401
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
402
--replace_result "NO" "" "YES" ""
 
403
--disable_query_log
 
404
--error ER_ACCESS_DENIED_ERROR
 
405
connect(con41,localhost,Tanjotuser1,,,);
 
406
--enable_query_log
 
407
 
 
408
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
409
--replace_result "NO" "" "YES" ""
 
410
--disable_query_log
 
411
--error ER_ACCESS_DENIED_ERROR
 
412
connect(con42,127.0.0.1,Tanjotuser2,,,);
 
413
--enable_query_log
 
414
 
 
415
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
416
--replace_result "NO" "" "YES" ""
 
417
--disable_query_log
 
418
--error ER_ACCESS_DENIED_ERROR
 
419
connect(con43,localhost,Tanjotuser1,"@_",,);
 
420
--enable_query_log
 
421
 
 
422
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
423
--replace_result "NO" "" "YES" ""
 
424
--disable_query_log
 
425
--error ER_ACCESS_DENIED_ERROR
 
426
connect(con44,127.0.0.1,Tanjotuser2,"@_",,);
 
427
--enable_query_log
 
428
 
 
429
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
430
--replace_result "NO" "" "YES" ""
 
431
--disable_query_log
 
432
--error ER_ACCESS_DENIED_ERROR
 
433
connect(con45,localhost,Tanjotuser1,"$_",,);
 
434
--enable_query_log
 
435
 
 
436
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
437
--replace_result "NO" "" "YES" ""
 
438
--disable_query_log
 
439
--error ER_ACCESS_DENIED_ERROR
 
440
connect(con46,127.0.0.1,Tanjotuser2,"$_",,);
 
441
--enable_query_log
 
442
 
 
443
 
 
444
# Dropping the created users
 
445
 
 
446
connection default;
 
447
 
 
448
DROP USER 'Tanjotuser1'@'localhost';
 
449
DROP USER 'Tanjotuser2'@'127.0.0.1';
 
450
 
 
451
--echo
 
452
--echo 
 
453
--echo ============================================================================================================================================
 
454
--echo Checking the password authentication using the sha256_password plugin at the client and sha256_password plugin at the server side
 
455
--echo ============================================================================================================================================
 
456
--echo 
 
457
 
 
458
--echo # Restart server with default-authentication-plugin=sha256_password;
 
459
 
 
460
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
 
461
--exec echo "wait" > $restart_file
 
462
--shutdown_server 10
 
463
--source include/wait_until_disconnected.inc
 
464
-- exec echo "restart:--default-authentication-plugin=sha256_password  " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
 
465
-- enable_reconnect
 
466
-- source include/wait_until_connected_again.inc
 
467
 
 
468
 
 
469
 
 
470
select @@Global.old_passwords;
 
471
--echo 2 Expected
 
472
 
 
473
select @@session.old_passwords;
 
474
--echo 0 Expected
 
475
 
 
476
# Checking the password authentication with sha256_password plugin
 
477
# Creating 2 users and encrypting the server side password with the sha256_password plugin
 
478
 
 
479
CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'sha256_password';
 
480
 
 
481
CREATE USER 'Tanjotuser2'@'127.0.0.1' IDENTIFIED WITH 'sha256_password';
 
482
 
 
483
# Verifying the server side plugin used to be sha256_password
 
484
 
 
485
select (select plugin from mysql.user where User='Tanjotuser1' and Host='localhost')='sha256_password';
 
486
--echo 1 Expected
 
487
 
 
488
select (select plugin from mysql.user where User='Tanjotuser2' and Host='127.0.0.1')='sha256_password';
 
489
--echo 1 Expected
 
490
 
 
491
# Verifying the client connection using the same sha256_password plugin and NULL password
 
492
 
 
493
connect(con89,localhost,Tanjotuser1,,,);
 
494
connect(con90,127.0.0.1,Tanjotuser2,,,);
 
495
 
 
496
# Verifying the client connection using the same sha256_password plugin and junk password
 
497
 
 
498
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
499
--replace_result "NO" "" "YES" ""
 
500
--disable_query_log
 
501
--error ER_ACCESS_DENIED_ERROR
 
502
connect(con91,localhost,Tanjotuser1," ",,);
 
503
--enable_query_log
 
504
 
 
505
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
506
--replace_result "NO" "" "YES" ""
 
507
--disable_query_log
 
508
--error ER_ACCESS_DENIED_ERROR
 
509
connect(con92,127.0.0.1,Tanjotuser2," ",,);
 
510
--enable_query_log
 
511
 
 
512
# setting the password for the 2 users using the sha256_password plugin
 
513
 
 
514
connection default;
 
515
 
 
516
SET @@session.old_passwords=2;
 
517
 
 
518
SET PASSWORD FOR 'Tanjotuser1'@'localhost'=PASSWORD('abc');
 
519
SET PASSWORD FOR 'Tanjotuser2'@'127.0.0.1'=PASSWORD('abc');
 
520
 
 
521
 
 
522
# Validating the old_passwords value from the created users.
 
523
 
 
524
 
 
525
--echo **** connecting Tanjotuser1 with server 
 
526
--exec $MYSQL -uTanjotuser1 -pabc -hlocalhost --default_auth=mysql_native_password -e "select @@session.old_passwords"
 
527
--echo 2 Expected
 
528
 
 
529
--echo **** connecting Tanjotuser2 with server 
 
530
--exec $MYSQL -uTanjotuser2 -pabc -h127.0.0.1 --default_auth=mysql_native_password -e "select @@session.old_passwords"
 
531
--echo 2 Expected
 
532
 
 
533
 
 
534
 
 
535
--echo **** connecting Tanjotuser1 with server 
 
536
--exec $MYSQL -uTanjotuser1 -pabc -hlocalhost --default_auth=mysql_old_password -e "select @@session.old_passwords"
 
537
--echo 2 Expected
 
538
 
 
539
--echo **** connecting Tanjotuser2 with server 
 
540
--exec $MYSQL -uTanjotuser2 -pabc -h127.0.0.1 --default_auth=mysql_old_password -e "select @@session.old_passwords"
 
541
--echo 2 Expected
 
542
 
 
543
 
 
544
 
 
545
--echo **** connecting Tanjotuser1 with server 
 
546
--exec $MYSQL -uTanjotuser1 -pabc -hlocalhost --default_auth=sha256_password -e "select @@session.old_passwords"
 
547
--echo 2 Expected
 
548
 
 
549
--echo **** connecting Tanjotuser2 with server 
 
550
--exec $MYSQL -uTanjotuser2 -pabc -h127.0.0.1 --default_auth=sha256_password -e "select @@session.old_passwords"
 
551
--echo 2 Expected
 
552
 
 
553
 
 
554
 
 
555
--echo **** connecting Tanjotuser1 with server 
 
556
--exec $MYSQL -uTanjotuser1 -pabc -hlocalhost -e "select @@session.old_passwords"
 
557
--echo 2 Expected
 
558
 
 
559
--echo **** connecting Tanjotuser2 with server 
 
560
--exec $MYSQL -uTanjotuser2 -pabc -h127.0.0.1 -e "select @@session.old_passwords"
 
561
--echo 2 Expected
 
562
 
 
563
 
 
564
# Verifying the client connection using the same sha256_password plugin and NULL password
 
565
 
 
566
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
567
--replace_result "NO" "" "YES" ""
 
568
--disable_query_log
 
569
--error ER_ACCESS_DENIED_ERROR
 
570
connect(con93,localhost,Tanjotuser1,,,);
 
571
--enable_query_log
 
572
 
 
573
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
574
--replace_result "NO" "" "YES" ""
 
575
--disable_query_log
 
576
--error ER_ACCESS_DENIED_ERROR
 
577
connect(con94,127.0.0.1,Tanjotuser2,,,);
 
578
--enable_query_log
 
579
 
 
580
# Verifying the client connection using the same sha256_password plugin and junk password
 
581
 
 
582
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
583
--replace_result "NO" "" "YES" ""
 
584
--disable_query_log
 
585
--error ER_ACCESS_DENIED_ERROR
 
586
connect(con95,localhost,Tanjotuser1," ",,);
 
587
--enable_query_log
 
588
 
 
589
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
590
--replace_result "NO" "" "YES" ""
 
591
--disable_query_log
 
592
--error ER_ACCESS_DENIED_ERROR
 
593
connect(con96,127.0.0.1,Tanjotuser2," ",,);
 
594
--enable_query_log
 
595
 
 
596
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
597
--replace_result "NO" "" "YES" ""
 
598
--disable_query_log
 
599
--error ER_ACCESS_DENIED_ERROR
 
600
connect(con97,localhost,Tanjotuser1,"%",,);
 
601
--enable_query_log
 
602
 
 
603
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
604
--replace_result "NO" "" "YES" ""
 
605
--disable_query_log
 
606
--error ER_ACCESS_DENIED_ERROR
 
607
connect(con98,127.0.0.1,Tanjotuser2,"%",,);
 
608
--enable_query_log
 
609
 
 
610
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
611
--replace_result "NO" "" "YES" ""
 
612
--disable_query_log
 
613
--error ER_ACCESS_DENIED_ERROR
 
614
connect(con99,localhost,Tanjotuser1,"_",,);
 
615
--enable_query_log
 
616
 
 
617
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
618
--replace_result "NO" "" "YES" ""
 
619
--disable_query_log
 
620
--error ER_ACCESS_DENIED_ERROR
 
621
connect(con100,127.0.0.1,Tanjotuser2,"_",,);
 
622
--enable_query_log
 
623
 
 
624
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
625
--replace_result "NO" "" "YES" ""
 
626
--disable_query_log
 
627
--error ER_ACCESS_DENIED_ERROR
 
628
connect(con101,localhost,Tanjotuser1,"0",,);
 
629
--enable_query_log
 
630
 
 
631
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
632
--replace_result "NO" "" "YES" ""
 
633
--disable_query_log
 
634
--error ER_ACCESS_DENIED_ERROR
 
635
connect(con102,127.0.0.1,Tanjotuser2,"0",,);
 
636
--enable_query_log
 
637
 
 
638
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
639
--replace_result "NO" "" "YES" ""
 
640
--disable_query_log
 
641
--error ER_ACCESS_DENIED_ERROR
 
642
connect(con103,localhost,Tanjotuser1,"^",,);
 
643
--enable_query_log
 
644
 
 
645
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
646
--replace_result "NO" "" "YES" ""
 
647
--disable_query_log
 
648
--error ER_ACCESS_DENIED_ERROR
 
649
connect(con104,127.0.0.1,Tanjotuser2,"^",,);
 
650
--enable_query_log
 
651
 
 
652
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
653
--replace_result "NO" "" "YES" ""
 
654
--disable_query_log
 
655
--error ER_ACCESS_DENIED_ERROR
 
656
connect(con105,localhost,Tanjotuser1,"\$",,);
 
657
--enable_query_log
 
658
 
 
659
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
660
--replace_result "NO" "" "YES" ""
 
661
--disable_query_log
 
662
--error ER_ACCESS_DENIED_ERROR
 
663
connect(con106,127.0.0.1,Tanjotuser2,"\$",,);
 
664
--enable_query_log
 
665
 
 
666
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
667
--replace_result "NO" "" "YES" ""
 
668
--disable_query_log
 
669
--error ER_ACCESS_DENIED_ERROR
 
670
connect(con107,localhost,Tanjotuser1,"&",,);
 
671
--enable_query_log
 
672
 
 
673
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
674
--replace_result "NO" "" "YES" ""
 
675
--disable_query_log
 
676
--error ER_ACCESS_DENIED_ERROR
 
677
connect(con108,127.0.0.1,Tanjotuser2,"&",,);
 
678
--enable_query_log
 
679
 
 
680
 
 
681
# Verifying the client connection using the same sha256_password plugin and correct password with secure_auth enabled
 
682
 
 
683
connection default;
 
684
 
 
685
select @@global.secure_auth;
 
686
--echo 1 Expected
 
687
 
 
688
connect(con109,localhost,Tanjotuser1,abc,,);
 
689
connect(con110,127.0.0.1,Tanjotuser2,abc,,);
 
690
 
 
691
# Verifying the client connection using the same sha256_password plugin and correct password with secure_auth disabled
 
692
 
 
693
connection default;
 
694
 
 
695
--disable_warnings
 
696
set @@global.secure_auth=0;
 
697
--enable_warnings
 
698
 
 
699
--disable_warnings
 
700
connect(con111,localhost,Tanjotuser1,abc,,);
 
701
connect(con112,127.0.0.1,Tanjotuser2,abc,,);
 
702
--enable_warnings
 
703
 
 
704
# Below section is hashed till the bug16040690 is fixed.
 
705
 
 
706
#--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
 
707
#connect(con113,localhost,Tanjotuser1,"abc ",,);
 
708
#--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
 
709
#connect(con114,127.0.0.1,Tanjotuser2,"abc ",,);
 
710
 
 
711
#--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
 
712
#connect(con115,localhost,Tanjotuser1," abc",,);
 
713
#--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
 
714
#connect(con116,127.0.0.1,Tanjotuser2," abc",,);
 
715
 
 
716
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
717
--replace_result "NO" "" "YES" ""
 
718
--disable_query_log
 
719
--error ER_ACCESS_DENIED_ERROR
 
720
connect(con117,localhost,Tanjotuser1,"0abc",,);
 
721
--enable_query_log
 
722
 
 
723
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
724
--replace_result "NO" "" "YES" ""
 
725
--disable_query_log
 
726
--error ER_ACCESS_DENIED_ERROR
 
727
connect(con118,127.0.0.1,Tanjotuser2,"0abc",,);
 
728
--enable_query_log
 
729
 
 
730
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
731
--replace_result "NO" "" "YES" ""
 
732
--disable_query_log
 
733
--error ER_ACCESS_DENIED_ERROR
 
734
connect(con119,localhost,Tanjotuser1,"abc0",,);
 
735
--enable_query_log
 
736
 
 
737
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
738
--replace_result "NO" "" "YES" ""
 
739
--disable_query_log
 
740
--error ER_ACCESS_DENIED_ERROR
 
741
connect(con120,127.0.0.1,Tanjotuser2,"abc0",,);
 
742
--enable_query_log
 
743
 
 
744
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
745
--replace_result "NO" "" "YES" ""
 
746
--disable_query_log
 
747
--error ER_ACCESS_DENIED_ERROR
 
748
connect(con121,localhost,Tanjotuser1,"@abc",,);
 
749
--enable_query_log
 
750
 
 
751
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
752
--replace_result "NO" "" "YES" ""
 
753
--disable_query_log
 
754
--error ER_ACCESS_DENIED_ERROR
 
755
connect(con122,127.0.0.1,Tanjotuser2,"@abc",,);
 
756
--enable_query_log
 
757
 
 
758
# Dropping the created users
 
759
 
 
760
connection default;
 
761
 
 
762
DROP USER 'Tanjotuser1'@'localhost';
 
763
DROP USER 'Tanjotuser2'@'127.0.0.1';
 
764
 
 
765
--echo
 
766
--echo 
 
767
--echo ====================================================================================================
 
768
--echo checking the integrity of long password (more than 40 chars) using sha256_password plugin
 
769
--echo ====================================================================================================
 
770
--echo
 
771
 
 
772
 
 
773
# Checking the password authentication with sha256_password plugin
 
774
# Creating 2 users and encrypting the server side password with the sha256_password plugin
 
775
 
 
776
CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'sha256_password';
 
777
 
 
778
CREATE USER 'Tanjotuser2'@'127.0.0.1' IDENTIFIED WITH 'sha256_password';
 
779
 
 
780
# setting the password for the 2 users using the sha256_password plugin
 
781
 
 
782
SET @@session.old_passwords=2;
 
783
 
 
784
SET PASSWORD FOR 'Tanjotuser1'@'localhost'=PASSWORD('$$$$$$$$$$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________');
 
785
SET PASSWORD FOR 'Tanjotuser2'@'127.0.0.1'=PASSWORD('$$$$$$$$$$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________');
 
786
 
 
787
 
 
788
# Verifying the client connection using the same sha256_password plugin and correct password with secure_auth disabled
 
789
 
 
790
--disable_warnings
 
791
set @@global.secure_auth=0;
 
792
--enable_warnings
 
793
 
 
794
--disable_warnings
 
795
connect(con123,localhost,Tanjotuser1,"\$\$\$\$\$\$\$\$\$\$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________",,);
 
796
connect(con124,127.0.0.1,Tanjotuser2,"\$\$\$\$\$\$\$\$\$\$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________",,);
 
797
--enable_warnings
 
798
 
 
799
# Verifying the client connection using the same sha256_password plugin and correct password with secure_auth enabled
 
800
 
 
801
connection default;
 
802
 
 
803
--disable_warnings
 
804
set @@global.secure_auth=1;
 
805
--enable_warnings
 
806
 
 
807
--disable_warnings
 
808
connect(con125,localhost,Tanjotuser1,"\$\$\$\$\$\$\$\$\$\$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________",,);
 
809
connect(con126,127.0.0.1,Tanjotuser2,"\$\$\$\$\$\$\$\$\$\$^^^^^^^^^^&&&&&&&&&&**********((((((((((##########!!!!!!!!!!@@@@@@@@@@          @@@@@@@@@@__________",,);
 
810
--enable_warnings
 
811
 
 
812
# Verifying the client access denied passing null password
 
813
 
 
814
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
815
--replace_result "NO" "" "YES" ""
 
816
--disable_query_log
 
817
--error ER_ACCESS_DENIED_ERROR
 
818
connect(con127,localhost,Tanjotuser1," ",,);
 
819
--enable_query_log
 
820
 
 
821
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
822
--replace_result "NO" "" "YES" ""
 
823
--disable_query_log
 
824
--error ER_ACCESS_DENIED_ERROR
 
825
connect(con128,127.0.0.1,Tanjotuser2," ",,);
 
826
--enable_query_log
 
827
 
 
828
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
829
--replace_result "NO" "" "YES" ""
 
830
--disable_query_log
 
831
--error ER_ACCESS_DENIED_ERROR
 
832
connect(con127,localhost,Tanjotuser1,,,);
 
833
--enable_query_log
 
834
 
 
835
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
836
--replace_result "NO" "" "YES" ""
 
837
--disable_query_log
 
838
--error ER_ACCESS_DENIED_ERROR
 
839
connect(con128,127.0.0.1,Tanjotuser2,,,);
 
840
--enable_query_log
 
841
 
 
842
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
843
--replace_result "NO" "" "YES" ""
 
844
--disable_query_log
 
845
--error ER_ACCESS_DENIED_ERROR
 
846
connect(con129,localhost,Tanjotuser1,"@_",,);
 
847
--enable_query_log
 
848
 
 
849
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
850
--replace_result "NO" "" "YES" ""
 
851
--disable_query_log
 
852
--error ER_ACCESS_DENIED_ERROR
 
853
connect(con130,127.0.0.1,Tanjotuser2,"@_",,);
 
854
--enable_query_log
 
855
 
 
856
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
857
--replace_result "NO" "" "YES" ""
 
858
--disable_query_log
 
859
--error ER_ACCESS_DENIED_ERROR
 
860
connect(con131,localhost,Tanjotuser1,"$_",,);
 
861
--enable_query_log
 
862
 
 
863
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
 
864
--replace_result "NO" "" "YES" ""
 
865
--disable_query_log
 
866
--error ER_ACCESS_DENIED_ERROR
 
867
connect(con132,127.0.0.1,Tanjotuser2,"$_",,);
 
868
--enable_query_log
 
869
 
 
870
 
 
871
# Dropping the created users
 
872
 
 
873
disconnect con1;
 
874
disconnect con2;
 
875
#disconnect con3;
 
876
#disconnect con4;
 
877
#disconnect con5;
 
878
#disconnect con6;
 
879
#disconnect con7;
 
880
#disconnect con8;
 
881
#disconnect con9;
 
882
#disconnect con10;
 
883
#disconnect con11;
 
884
#disconnect con12;
 
885
#disconnect con13;
 
886
#disconnect con14;
 
887
#disconnect con15;
 
888
#disconnect con16;
 
889
#disconnect con17;
 
890
#disconnect con18;
 
891
#disconnect con19;
 
892
#disconnect con20;
 
893
disconnect con21;
 
894
disconnect con22;
 
895
disconnect con23;
 
896
disconnect con24;
 
897
#disconnect con25;
 
898
#disconnect con26;
 
899
#disconnect con27;
 
900
#disconnect con28;
 
901
#disconnect con29;
 
902
#disconnect con30;
 
903
#disconnect con31;
 
904
#disconnect con32;
 
905
#disconnect con33;
 
906
#disconnect con34;
 
907
disconnect con35;
 
908
disconnect con36;
 
909
disconnect con37;
 
910
disconnect con38;
 
911
#disconnect con39;
 
912
#disconnect con40;
 
913
#disconnect con41;
 
914
#disconnect con42;
 
915
#disconnect con43;
 
916
#disconnect con44;
 
917
#disconnect con45;
 
918
#disconnect con46;
 
919
#disconnect con47;
 
920
#disconnect con48;
 
921
#disconnect con49;
 
922
#disconnect con50;
 
923
#disconnect con51;
 
924
#disconnect con52;
 
925
#disconnect con53;
 
926
#disconnect con54;
 
927
#disconnect con55;
 
928
#disconnect con56;
 
929
#disconnect con57;
 
930
#disconnect con58;
 
931
#disconnect con59;
 
932
#disconnect con60;
 
933
#disconnect con61;
 
934
#disconnect con62;
 
935
#disconnect con63;
 
936
#disconnect con64;
 
937
#disconnect con65;
 
938
#disconnect con66;
 
939
#disconnect con67;
 
940
#disconnect con68;
 
941
#disconnect con69;
 
942
#disconnect con70;
 
943
#disconnect con71;
 
944
#disconnect con72;
 
945
#disconnect con73;
 
946
#disconnect con74;
 
947
#disconnect con75;
 
948
#disconnect con76;
 
949
#disconnect con77;
 
950
#disconnect con78;
 
951
#disconnect con79;
 
952
#disconnect con80;
 
953
#disconnect con81;
 
954
#disconnect con82;
 
955
#disconnect con83;
 
956
#disconnect con84;
 
957
#disconnect con85;
 
958
#disconnect con86;
 
959
#disconnect con87;
 
960
#disconnect con88;
 
961
disconnect con89;
 
962
disconnect con90;
 
963
#disconnect con91;
 
964
#disconnect con92;
 
965
#disconnect con93;
 
966
#disconnect con94;
 
967
#disconnect con95;
 
968
#disconnect con96;
 
969
#disconnect con97;
 
970
#disconnect con98;
 
971
#disconnect con99;
 
972
#disconnect con100;
 
973
#disconnect con101;
 
974
#disconnect con102;
 
975
#disconnect con103;
 
976
#disconnect con104;
 
977
#disconnect con105;
 
978
#disconnect con106;
 
979
#disconnect con107;
 
980
#disconnect con108;
 
981
disconnect con109;
 
982
disconnect con110;
 
983
disconnect con111;
 
984
disconnect con112;
 
985
#disconnect con113;
 
986
#disconnect con114;
 
987
#disconnect con115;
 
988
#disconnect con116;
 
989
#disconnect con117;
 
990
#disconnect con118;
 
991
#disconnect con119;
 
992
#disconnect con120;
 
993
#disconnect con121;
 
994
#disconnect con122;
 
995
disconnect con123;
 
996
disconnect con124;
 
997
disconnect con125;
 
998
disconnect con126;
 
999
#disconnect con127;
 
1000
#disconnect con128;
 
1001
#disconnect con129;
 
1002
#disconnect con130;
 
1003
#disconnect con131;
 
1004
#disconnect con132;
 
1005
 
 
1006
 
 
1007
connection default;
 
1008
 
 
1009
DROP USER 'Tanjotuser1'@'localhost';
 
1010
DROP USER 'Tanjotuser2'@'127.0.0.1';
 
1011
SET @@global.secure_auth=default;
 
1012
SET @@global.old_passwords=default;
 
1013
SET @@session.old_passwords=default;