diff --git a/include/MySQL_Data_Stream.h b/include/MySQL_Data_Stream.h index 88231b785..489c9cf97 100644 --- a/include/MySQL_Data_Stream.h +++ b/include/MySQL_Data_Stream.h @@ -159,6 +159,8 @@ class MySQL_Data_Stream int switching_auth_stage; enum proxysql_auth_plugins switching_auth_type; + // Updated **only** when an 'auth_switch' has been sent to client + enum proxysql_auth_plugins switching_auth_sent; int auth_in_progress; // if 0 , no authentication is in progress. Any value greater than 0 depends from the implementation unsigned int tmp_charset; diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index 67bc9f1e0..7cca30427 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -1207,6 +1207,8 @@ bool MySQL_Protocol::generate_pkt_auth_switch_request(bool send, void **ptr, uns (*myds)->DSS=STATE_SERVER_HANDSHAKE; (*myds)->sess->status=CONNECTING_CLIENT; } + (*myds)->switching_auth_sent = (*myds)->switching_auth_type; + if (len) { *len=size; } if (ptr) { *ptr=(void *)_ptr; } #ifdef DEBUG diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 78d632540..6f24c474e 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -1163,6 +1163,7 @@ void MySQL_Session::generate_proxysql_internal_session_json(json &j) { } } j["client"]["DSS"] = client_myds->DSS; + j["client"]["switching_auth_sent"] = client_myds->switching_auth_sent; j["client"]["switching_auth_type"] = client_myds->switching_auth_type; j["client"]["prot"]["sent_auth_plugin_id"] = client_myds->myprot.sent_auth_plugin_id; j["client"]["prot"]["auth_plugin_id"] = client_myds->myprot.auth_plugin_id; diff --git a/lib/mysql_data_stream.cpp b/lib/mysql_data_stream.cpp index 7082b98d0..eec961f99 100644 --- a/lib/mysql_data_stream.cpp +++ b/lib/mysql_data_stream.cpp @@ -306,6 +306,7 @@ MySQL_Data_Stream::MySQL_Data_Stream() { encrypted=false; switching_auth_stage = 0; switching_auth_type = AUTH_UNKNOWN_PLUGIN; + switching_auth_sent = AUTH_UNKNOWN_PLUGIN; auth_in_progress = 0; x509_subject_alt_name=NULL; ssl=NULL;