MEDIUM: tcpcheck: handle MySQL AuthSwitchRequest in mysql-check post-80 modes
With the post-80 and post-80-sha2 modes, when the authentication
plugin of the check user differs from the announced one, the server
replies to the handshake response with an AuthSwitchRequest. The
check now answers with an empty password for the requested plugin,
then concludes on the authentication result: an OK packet marks the
server as UP, an ERR packet as DOWN, and a full authentication
request fails cleanly as it requires the password.
The AuthSwitchRequest packet is validated before being handled: a
packet with an empty payload or with a plugin name not terminated by
a NUL byte is reported as an invalid response. Otherwise the plugin
name would be searched outside the packet bounds.
To do so, the COM_QUIT command is no longer pipelined right after
the handshake response. It is now sent once the authentication
result is known, packed with the auth switch reply when there is
one, so the session is cleanly closed in every case and no
connection error is recorded on the server. The legacy pre-41 and
post-41 modes keep the pipelined COM_QUIT, they cannot receive an
auth switch request.