From 32fa7b6800b7fec40fff77ccc9213805f38ba8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 7 Jul 2020 08:40:30 +0300 Subject: [PATCH] MXS-3069: Fix plugin name comparison Connectors that wouldn't send the plugin name even when the plugin authentication capability was enabled would have to do an extra step in the authentication. --- server/modules/authenticator/MariaDBAuth/mysql_auth.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/modules/authenticator/MariaDBAuth/mysql_auth.cc b/server/modules/authenticator/MariaDBAuth/mysql_auth.cc index 125c5420b..9d8b6e46c 100644 --- a/server/modules/authenticator/MariaDBAuth/mysql_auth.cc +++ b/server/modules/authenticator/MariaDBAuth/mysql_auth.cc @@ -645,8 +645,11 @@ static bool mysql_auth_set_client_data(MYSQL_session* client_data, else { // Check that the plugin is as expected. If not, make a note so the - // authentication function switches the plugin. - bool correct_auth = strcmp(plugin_name, DEFAULT_MYSQL_AUTH_PLUGIN) == 0; + // authentication function switches the plugin. An empty auth plugin + // name should be interpreted as the connector using the same plugin + // we sent in the initial handshake. + bool correct_auth = strcmp(plugin_name, DEFAULT_MYSQL_AUTH_PLUGIN) == 0 + || *plugin_name == '\0'; client_data->correct_authenticator = correct_auth; if (!correct_auth) {