As part of the login process, MySQL sends a scramble value that is 20 bytes long and meant to be XOR-ed (by MyXQL) with the password supplied by the user. The first line of the backtrace shows that we pass that 20 byte value (stored as auth_plugin_data) to :binary.part and request 50 bytes (the length of the user's password). Naturally, that request fails.
This PR adds tests demonstrating the error and a fix that will cycle through auth_plugin_data when the user's given password exceeds the length of auth_plugin_data.
An argument error is encountered when trying to authenticate with a sha256 or caching_sha2 password longer than 20 bytes:
As part of the login process, MySQL sends a
scramble
value that is 20 bytes long and meant to be XOR-ed (by MyXQL) with the password supplied by the user. The first line of the backtrace shows that we pass that 20 byte value (stored asauth_plugin_data
) to:binary.part
and request 50 bytes (the length of the user's password). Naturally, that request fails.Natively, MySQL will cycle through the
scramble
data as many times as needed, in order to match the length of the given password: https://github.com/mysql/mysql-server/blob/f8cdce86448a211511e8a039c62580ae16cb96f5/mysys/crypt_genhash_impl.cc#L438-L444This PR adds tests demonstrating the error and a fix that will cycle through
auth_plugin_data
when the user's given password exceeds the length ofauth_plugin_data
.