From c237243a2f0b3c19a7df6cfce2edc5930263d7d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Thu, 14 May 2020 20:41:51 +0200 Subject: [PATCH] Fixes #2793: Update capabilities and max_allowed properly in case of 'switching_auth' --- lib/MySQL_Protocol.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index aa6e51fba..849d09624 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -1551,6 +1551,7 @@ bool MySQL_Protocol::process_pkt_handshake_response(unsigned char *pkt, unsigned //(*myds)->switching_auth_stage=2; charset=(*myds)->tmp_charset; proxy_debug(PROXY_DEBUG_MYSQL_PROTOCOL,2,"Session=%p , DS=%p . Encrypted: %d , switching_auth: %d, auth_plugin_id: %d\n", (*myds)->sess, (*myds), (*myds)->encrypted, (*myds)->switching_auth_stage, auth_plugin_id); + capabilities = (*myds)->myconn->options.client_flag; goto __do_auth; } @@ -1558,6 +1559,7 @@ bool MySQL_Protocol::process_pkt_handshake_response(unsigned char *pkt, unsigned (*myds)->myconn->options.client_flag = capabilities; pkt += sizeof(uint32_t); max_pkt = CPY4(pkt); + (*myds)->myconn->options.max_allowed_pkt = max_pkt; pkt += sizeof(uint32_t); charset = *(uint8_t *)pkt; if ( (*myds)->encrypted == false ) { // client wants to use SSL @@ -2002,7 +2004,6 @@ __exit_do_auth: if (ret==true) { - (*myds)->myconn->options.max_allowed_pkt=max_pkt; (*myds)->DSS=STATE_CLIENT_HANDSHAKE; if (!userinfo->username) // if set already, ignore