[CONJ-383] OldAuthSwitchRequest not handled correctly Created: 2016-11-02 Updated: 2016-11-07 Resolved: 2016-11-07 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | 1.5.4 |
| Fix Version/s: | 1.5.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Glen Ritchie | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
5.5.31-MariaDB |
||
| Description |
DescriptionMariaDB Connector/J does not check the packet length of a OldAuthSwitchRequest and assumes it is AuthSwitchRequest. During authentication, if a OldAuthSwitchRequest is recieved and the server has PLUGIN_AUTH capability, the Connector/J assumes the request is a AuthSwitchRequest. As per the protocol documentation: https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchRequest When the Connector/J recieves a OldAuthSwitchRequest it will assume it is a AuthSwitchRequest and throw an exception:
ReproductionI was able to reproduce this by using MariaDB ( 5.5.31-MariaDB ) and setting a user with an OLD_PASSWORD format.
Then connecting with a simple JDBC test program. WorkaroundUpdate the password on the server to the new format ResolutionAdd a check for the packet length into AbstractConnectProtocol.java and only treat it as a AuthSwitchRequest if it's length is greater than 1 From:
To:
|
| Comments |
| Comment by Glen Ritchie [ 2016-11-02 ] |
|
On subsequent reading of the page linked, I don't think this is a "bug" as such, more of a protocol 'quirk'.
If the server and client both advertised CLIENT_PLUGIN_AUTH support, then that paragraph implies that an Old Password Request should never have been sent in the first place. Though it would be nice for the client to downgrade itself to talk to the server, it probably isn't best practice ( Indeed, support for old passwords has been removed entirely in MySQL 5.7.5 ) I think here, the biggest issue might be that the client doesn't indicate why the server rejected the connection, rather it just echoes the server response about the client being too old! Perhaps it would be better if this specific case of OldAuthSwitchRequest handling could be enabled with a configuration option rather than being part of the main protocol logic. Or, it could simply be an addendum that this particular old-password/server/client configuration is not supported. |