Skip to content

Commit b11b0e0

Browse files
committed
Merge branch 'mysql-8.0' into mysql-trunk
Change-Id: I26bf4bce503d5549f8ba40a98de3c33dc1c62121
2 parents 5b43246 + 4c04e51 commit b11b0e0

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

sql-common/client.cc

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5744,11 +5744,24 @@ static mysql_state_machine_status authsm_begin_plugin_auth(
57445744
}
57455745

57465746
if (ctx->auth_plugin_name == nullptr || ctx->auth_plugin == nullptr) {
5747-
/*
5748-
If everything else fail we use the built in plugin
5749-
*/
5750-
ctx->auth_plugin = &caching_sha2_password_client_plugin;
5751-
ctx->auth_plugin_name = ctx->auth_plugin->name;
5747+
auth_plugin_t *client_plugin{nullptr};
5748+
if (mysql->options.extension && mysql->options.extension->default_auth &&
5749+
(client_plugin = (auth_plugin_t *)mysql_client_find_plugin(
5750+
mysql, mysql->options.extension->default_auth,
5751+
MYSQL_CLIENT_AUTHENTICATION_PLUGIN))) {
5752+
// try default_auth again in case CLIENT_PLUGIN_AUTH wasn't on.
5753+
ctx->auth_plugin_name = mysql->options.extension->default_auth;
5754+
ctx->auth_plugin = client_plugin;
5755+
} else {
5756+
/*
5757+
If everything else fail we use the built in plugin: caching sha if the
5758+
server is new enough or native if not.
5759+
*/
5760+
ctx->auth_plugin = (mysql->server_capabilities & CLIENT_PLUGIN_AUTH)
5761+
? &caching_sha2_password_client_plugin
5762+
: &native_password_client_plugin;
5763+
ctx->auth_plugin_name = ctx->auth_plugin->name;
5764+
}
57525765
}
57535766

57545767
if (check_plugin_enabled(mysql, ctx)) return STATE_MACHINE_FAILED;

0 commit comments

Comments
 (0)