File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -5744,11 +5744,24 @@ static mysql_state_machine_status authsm_begin_plugin_auth(
5744
5744
}
5745
5745
5746
5746
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
+ }
5752
5765
}
5753
5766
5754
5767
if (check_plugin_enabled (mysql, ctx)) return STATE_MACHINE_FAILED;
You can’t perform that action at this time.
0 commit comments