File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 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) {
486486 plugin := string (data [1 :pluginEndIndex ])
487487 cipher := data [pluginEndIndex + 1 : len (data )- 1 ]
488488
489- if plugin == "mysql_old_password" {
489+ switch plugin {
490+ case "mysql_old_password" :
490491 // using old_passwords
491492 return cipher , ErrOldPassword
492- } else if plugin == "mysql_clear_password" {
493+ case "mysql_clear_password" :
493494 // using clear text password
494495 return cipher , ErrCleartextPassword
495- } else if plugin == "mysql_native_password" {
496+ case "mysql_native_password" :
496497 // using mysql default authentication method
497498 return cipher , ErrNativePassword
498- } else {
499+ default :
499500 return cipher , ErrUnknownPlugin
500501 }
501- } else {
502- // https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::OldAuthSwitchRequest
503- return nil , ErrOldPassword
504502 }
505503
504+ // https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::OldAuthSwitchRequest
505+ return nil , ErrOldPassword
506+
506507 default : // Error otherwise
507508 return nil , mc .handleErrorPacket (data )
508509 }
You can’t perform that action at this time.
0 commit comments