Skip to content

Change ErrUnknownPlugin to a func which can take the plugin name #795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

sjmudd
Copy link
Contributor

@sjmudd sjmudd commented May 16, 2018

Description

Change ErrUnknownPlugin to a func which can take the plugin name

MySQL 8.0 brings a new authentication plugin which is enabled by default. This plugin is not yet handled by the go driver.

The error message which is returned is somewhat vague and this is likely to cause confusion.

The change provides the same error message but includes the plugin name which will be easier for people to lookup. So rather than returning the error:

this authentication plugin is not supported

we return something like:

authentication plugin "caching_sha2_password" is not supported

Checklist

  • Code compiles correctly
  • Added myself / the copyright holder to the AUTHORS file

sjmudd added 2 commits May 16, 2018 23:39
MySQL 8.0 brings a new authentication plugin which is enabled by
default. This plugin is not yet handled by the go driver.

The error message which is returned is somewhat vague and this is
likely to cause confusion.

The change provides the same error message but includes the plugin
name which will be easier for people to lookup. So rather than
returning the error:

this authentication plugin is not supported

we return something like:

authentication plugin "caching_sha2_password" is not supported
@sjmudd
Copy link
Contributor Author

sjmudd commented May 16, 2018

FWIW: noticed when trying to build a new app talking to a local MySQL 8.0.11 GA version. I'd forgotten to change the default plugin to something the go driver understands.

@julienschmidt
Copy link
Member

Thank you for this pull request.

I agree that the additional information would be helpful, however I still don't think that it would be a good idea to change the current behavior. We exported the Errs so that 3rd-party packages can use them to compare returned errors against the exported errors efficiently (compare pointers) instead of comparing the error strings, which might change over time.

If we change ErrUnknownPlugin to a function, this doesn't work anymore and it likely breaks existing code.

julienschmidt added a commit that referenced this pull request May 22, 2018
julienschmidt added a commit that referenced this pull request May 23, 2018
julienschmidt added a commit that referenced this pull request May 29, 2018
* log missing auth plugin name

* refactor auth handling

* auth: fix AllowNativePasswords

* auth: remove plugin name print

* packets: attempt to fix writePublicKeyAuthPacket

* packets: do not NUL-terminate auth switch packets

* move handleAuthResult to auth

* add old_password auth tests

* auth: add empty old_password test

* auth: add cleartext auth tests

* auth: add native auth tests

* auth: add caching_sha2 tests

* rename init and auth packets to documented names

* auth: fix plugin name for switched auth methods

* buffer: optimize default branches

* auth: add tests for switch to caching sha2

* auth: add tests for switch to cleartext password

* auth: add tests for switch to native password

* auth: sync NUL termination with official connectors

* packets: handle missing NUL bytes in AuthSwitchRequests

Updates #795
julienschmidt added a commit that referenced this pull request May 31, 2018
* log missing auth plugin name

* refactor auth handling

* auth: fix AllowNativePasswords

* auth: remove plugin name print

* packets: attempt to fix writePublicKeyAuthPacket

* packets: do not NUL-terminate auth switch packets

* move handleAuthResult to auth

* add old_password auth tests

* auth: add empty old_password test

* auth: add cleartext auth tests

* auth: add native auth tests

* auth: add caching_sha2 tests

* rename init and auth packets to documented names

* auth: fix plugin name for switched auth methods

* buffer: optimize default branches

* auth: add tests for switch to caching sha2

* auth: add tests for switch to cleartext password

* auth: add tests for switch to native password

* auth: sync NUL termination with official connectors

* packets: handle missing NUL bytes in AuthSwitchRequests

Updates #795
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants