From a947b33769716ef226e371824d2a501ca490ffe9 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Thu, 18 Feb 2016 17:23:27 +0200 Subject: [PATCH] MXS-585: Fixed buffer length instead of packet length being used in a calculation The usage of the buffer length in the authentication success checks causes the authentication to fail with routers that don't require statement input. --- server/modules/protocol/mysql_client.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/modules/protocol/mysql_client.c b/server/modules/protocol/mysql_client.c index 12d740d77..a98be6cce 100644 --- a/server/modules/protocol/mysql_client.c +++ b/server/modules/protocol/mysql_client.c @@ -771,7 +771,9 @@ int gw_read_client_event(DCB* dcb) } } - if (stmt_input) + /** If the router requires statement input or we are still authenticating + * we need to make sure that a complete SQL packet is read before continuing */ + if (stmt_input || protocol->protocol_auth_state == MYSQL_AUTH_SENT) { /** @@ -832,9 +834,8 @@ int gw_read_client_event(DCB* dcb) { case MYSQL_AUTH_SENT: { - int auth_val; - - auth_val = gw_mysql_do_authentication(dcb, &read_buffer); + read_buffer = gwbuf_make_contiguous(read_buffer); + int auth_val = gw_mysql_do_authentication(dcb, &read_buffer); if (protocol->protocol_auth_state == MYSQL_AUTH_SSL_REQ || protocol->protocol_auth_state == MYSQL_AUTH_SSL_HANDSHAKE_ONGOING ||