Skip to content

Commit

Permalink
Merge branch 'mysql-8.0' into mysql-trunk
Browse files Browse the repository at this point in the history
Change-Id: I26bf4bce503d5549f8ba40a98de3c33dc1c62121
  • Loading branch information
gkodinov committed Aug 23, 2023
2 parents 5b43246 + 4c04e51 commit b11b0e0
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions sql-common/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5744,11 +5744,24 @@ static mysql_state_machine_status authsm_begin_plugin_auth(
}

if (ctx->auth_plugin_name == nullptr || ctx->auth_plugin == nullptr) {
/*
If everything else fail we use the built in plugin
*/
ctx->auth_plugin = &caching_sha2_password_client_plugin;
ctx->auth_plugin_name = ctx->auth_plugin->name;
auth_plugin_t *client_plugin{nullptr};
if (mysql->options.extension && mysql->options.extension->default_auth &&
(client_plugin = (auth_plugin_t *)mysql_client_find_plugin(
mysql, mysql->options.extension->default_auth,
MYSQL_CLIENT_AUTHENTICATION_PLUGIN))) {
// try default_auth again in case CLIENT_PLUGIN_AUTH wasn't on.
ctx->auth_plugin_name = mysql->options.extension->default_auth;
ctx->auth_plugin = client_plugin;
} else {
/*
If everything else fail we use the built in plugin: caching sha if the
server is new enough or native if not.
*/
ctx->auth_plugin = (mysql->server_capabilities & CLIENT_PLUGIN_AUTH)
? &caching_sha2_password_client_plugin
: &native_password_client_plugin;
ctx->auth_plugin_name = ctx->auth_plugin->name;
}
}

if (check_plugin_enabled(mysql, ctx)) return STATE_MACHINE_FAILED;
Expand Down

0 comments on commit b11b0e0

Please sign in to comment.