From 689c02d3019dcb85d07999605d480e1dd43bceb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 4 May 2018 12:42:46 +0300 Subject: [PATCH] Send error on reauthentication failure When the reauthentication of a client fails, the correct error should be sent. --- .../modules/protocol/MySQL/mariadbclient/mysql_client.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index b813d9911..6751ee1ff 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -1481,7 +1481,14 @@ static bool reauthenticate_client(MXS_SESSION* session, GWBUF* packetbuf) proto->scramble, sizeof(proto->scramble), client_sha1, sizeof(client_sha1)); - rval = rc == MXS_AUTH_SUCCEEDED; + if (!(rval = rc == MXS_AUTH_SUCCEEDED)) + { + /** + * First packet is COM_CHANGE_USER, the second is AuthSwitchRequest, + * third is the response and the fourth is the following error. + */ + mysql_client_auth_error_handling(session->client_dcb, rc, 3); + } } return rval;