|
@@ -486,23 +486,24 @@ func (mc *mysqlConn) readResultOK() ([]byte, error) {
|
|
|
plugin := string(data[1:pluginEndIndex])
|
|
plugin := string(data[1:pluginEndIndex])
|
|
|
cipher := data[pluginEndIndex+1 : len(data)-1]
|
|
cipher := data[pluginEndIndex+1 : len(data)-1]
|
|
|
|
|
|
|
|
- if plugin == "mysql_old_password" {
|
|
|
|
|
|
|
+ switch plugin {
|
|
|
|
|
+ case "mysql_old_password":
|
|
|
// using old_passwords
|
|
// using old_passwords
|
|
|
return cipher, ErrOldPassword
|
|
return cipher, ErrOldPassword
|
|
|
- } else if plugin == "mysql_clear_password" {
|
|
|
|
|
|
|
+ case "mysql_clear_password":
|
|
|
// using clear text password
|
|
// using clear text password
|
|
|
return cipher, ErrCleartextPassword
|
|
return cipher, ErrCleartextPassword
|
|
|
- } else if plugin == "mysql_native_password" {
|
|
|
|
|
|
|
+ case "mysql_native_password":
|
|
|
// using mysql default authentication method
|
|
// using mysql default authentication method
|
|
|
return cipher, ErrNativePassword
|
|
return cipher, ErrNativePassword
|
|
|
- } else {
|
|
|
|
|
|
|
+ default:
|
|
|
return cipher, ErrUnknownPlugin
|
|
return cipher, ErrUnknownPlugin
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- // https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::OldAuthSwitchRequest
|
|
|
|
|
- return nil, ErrOldPassword
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::OldAuthSwitchRequest
|
|
|
|
|
+ return nil, ErrOldPassword
|
|
|
|
|
+
|
|
|
default: // Error otherwise
|
|
default: // Error otherwise
|
|
|
return nil, mc.handleErrorPacket(data)
|
|
return nil, mc.handleErrorPacket(data)
|
|
|
}
|
|
}
|