File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -486,23 +486,24 @@ func (mc *mysqlConn) readResultOK() ([]byte, error) {
486
486
plugin := string (data [1 :pluginEndIndex ])
487
487
cipher := data [pluginEndIndex + 1 : len (data )- 1 ]
488
488
489
- if plugin == "mysql_old_password" {
489
+ switch plugin {
490
+ case "mysql_old_password" :
490
491
// using old_passwords
491
492
return cipher , ErrOldPassword
492
- } else if plugin == "mysql_clear_password" {
493
+ case "mysql_clear_password" :
493
494
// using clear text password
494
495
return cipher , ErrCleartextPassword
495
- } else if plugin == "mysql_native_password" {
496
+ case "mysql_native_password" :
496
497
// using mysql default authentication method
497
498
return cipher , ErrNativePassword
498
- } else {
499
+ default :
499
500
return cipher , ErrUnknownPlugin
500
501
}
501
- } else {
502
- // https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::OldAuthSwitchRequest
503
- return nil , ErrOldPassword
504
502
}
505
503
504
+ // https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::OldAuthSwitchRequest
505
+ return nil , ErrOldPassword
506
+
506
507
default : // Error otherwise
507
508
return nil , mc .handleErrorPacket (data )
508
509
}
You can’t perform that action at this time.
0 commit comments