@@ -383,58 +383,6 @@ def realTestPamAuth(self):
383
383
# recreate the user
384
384
cur .execute (grants )
385
385
386
- # select old_password("crummy p\tassword");
387
- # | old_password("crummy p\tassword") |
388
- # | 2a01785203b08770 |
389
- @pytest .mark .skipif (not socket_auth , reason = "connection to unix_socket required" )
390
- @pytest .mark .skipif (
391
- not mysql_old_password_found , reason = "no mysql_old_password plugin"
392
- )
393
- def testMySQLOldPasswordAuth (self ):
394
- conn = self .connect ()
395
- if self .mysql_server_is (conn , (5 , 7 , 0 )):
396
- pytest .skip ("Old passwords aren't supported in 5.7" )
397
- # pymysql.err.OperationalError: (1045, "Access denied for user 'old_pass_user'@'localhost' (using password: YES)")
398
- # from login in MySQL-5.6
399
- if self .mysql_server_is (conn , (5 , 6 , 0 )):
400
- pytest .skip ("Old passwords don't authenticate in 5.6" )
401
- db = self .db .copy ()
402
- db ["password" ] = "crummy p\t assword"
403
- c = conn .cursor ()
404
-
405
- # deprecated in 5.6
406
- if self .mysql_server_is (conn , (5 , 6 , 0 )):
407
- with self .assertWarns (pymysql .err .Warning ) as cm :
408
- c .execute ("SELECT OLD_PASSWORD('%s')" % db ["password" ])
409
- else :
410
- c .execute ("SELECT OLD_PASSWORD('%s')" % db ["password" ])
411
- v = c .fetchone ()[0 ]
412
- self .assertEqual (v , "2a01785203b08770" )
413
- # only works in MariaDB and MySQL-5.6 - can't separate out by version
414
- # if self.mysql_server_is(self.connect(), (5, 5, 0)):
415
- # with TempUser(c, 'old_pass_user@localhost',
416
- # self.databases[0]['db'], 'mysql_old_password', '2a01785203b08770') as u:
417
- # cur = pymysql.connect(user='old_pass_user', **db).cursor()
418
- # cur.execute("SELECT VERSION()")
419
- c .execute ("SELECT @@secure_auth" )
420
- secure_auth_setting = c .fetchone ()[0 ]
421
- c .execute ("set old_passwords=1" )
422
- # pymysql.err.Warning: 'pre-4.1 password hash' is deprecated and will be removed in a future release. Please use post-4.1 password hash instead
423
- if self .mysql_server_is (conn , (5 , 6 , 0 )):
424
- with self .assertWarns (pymysql .err .Warning ) as cm :
425
- c .execute ("set global secure_auth=0" )
426
- else :
427
- c .execute ("set global secure_auth=0" )
428
- with TempUser (
429
- c ,
430
- "old_pass_user@localhost" ,
431
- self .databases [0 ]["db" ],
432
- password = db ["password" ],
433
- ) as u :
434
- cur = pymysql .connect (user = "old_pass_user" , ** db ).cursor ()
435
- cur .execute ("SELECT VERSION()" )
436
- c .execute ("set global secure_auth=%r" % secure_auth_setting )
437
-
438
386
@pytest .mark .skipif (not socket_auth , reason = "connection to unix_socket required" )
439
387
@pytest .mark .skipif (
440
388
not sha256_password_found ,
0 commit comments