diff --git a/AUTHORS b/AUTHORS index a6b845f72..b718b5918 100644 --- a/AUTHORS +++ b/AUTHORS @@ -46,6 +46,7 @@ Olivier Mengué Paul Bonser Peter Schultz Runrioter Wung +Simon J Mudd Soroush Pour Stan Putrya Stanley Gunawan diff --git a/errors.go b/errors.go index 857854e14..3520c6ee9 100644 --- a/errors.go +++ b/errors.go @@ -25,7 +25,6 @@ var ( ErrCleartextPassword = errors.New("this user requires clear text authentication. If you still want to use it, please add 'allowCleartextPasswords=1' to your DSN") ErrNativePassword = errors.New("this user requires mysql native password authentication.") ErrOldPassword = errors.New("this user requires old password authentication. If you still want to use it, please add 'allowOldPasswords=1' to your DSN. See also https://github.com/go-sql-driver/mysql/wiki/old_passwords") - ErrUnknownPlugin = errors.New("this authentication plugin is not supported") ErrOldProtocol = errors.New("MySQL server does not support required protocol 41+") ErrPktSync = errors.New("commands out of sync. You can't run this command now") ErrPktSyncMul = errors.New("commands out of sync. Did you run multiple statements at once?") @@ -33,6 +32,11 @@ var ( ErrBusyBuffer = errors.New("busy buffer") ) +// ErrUnknownPlugin returns an error with the name of the plugin that is not supported +func ErrUnknownPlugin(name string) error { + return fmt.Errorf("authentication plugin %q is not supported", name) +} + var errLog = Logger(log.New(os.Stderr, "[mysql] ", log.Ldate|log.Ltime|log.Lshortfile)) // Logger is used to log critical error messages. diff --git a/packets.go b/packets.go index 41b4d3d55..1c5f974ac 100644 --- a/packets.go +++ b/packets.go @@ -496,7 +496,7 @@ func (mc *mysqlConn) readResultOK() ([]byte, error) { // using mysql default authentication method return cipher, ErrNativePassword } else { - return cipher, ErrUnknownPlugin + return cipher, ErrUnknownPlugin(plugin) } } else { // https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::OldAuthSwitchRequest