From 0db24e35a54beac7e6e43d36c7bfe776071f9891 Mon Sep 17 00:00:00 2001 From: lxc-19092808 <122571730+lxc-19092808@users.noreply.github.com> Date: Sun, 15 Jan 2023 01:07:51 +0800 Subject: [PATCH 1/2] Fix for errors: Plugin sha256_password reported In the absence of --skip-grant-table, the database creates an acl_user object through the function decoy_user() when a non-existent user is logged into the database. When this object is created, its plugin property is randomly selected from cached_plugins_enum. This makes it possible to select the PLUGIN_SHA256_PASSWORD plug-in. But at the entrance to sha256_password_authenticate(), a Warning message is generated indicating that PLUGIN_SHA256_PASSWORD is deprecated: 2023-01-10T01:07:23.035479Z 13 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead' When invalid database access occurs due to objective reasons, a large number of Warning logs are generated in the database error log. As a result, alarms and log files are too large. Therefore, the decoy_user() function removes PLUGIN_SHA256_PASSWORD to fix the problem without affecting other functions. --- sql/auth/sql_authentication.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/auth/sql_authentication.cc b/sql/auth/sql_authentication.cc index c1d91e72ec23..72d802bc0ecd 100644 --- a/sql/auth/sql_authentication.cc +++ b/sql/auth/sql_authentication.cc @@ -2060,7 +2060,7 @@ ACL_USER *decoy_user(const LEX_CSTRING &username, const LEX_CSTRING &hostname, } else { const int DECIMAL_SHIFT = 1000; const int random_number = static_cast(my_rnd(rand) * DECIMAL_SHIFT); - uint plugin_num = (uint)(random_number % ((uint)PLUGIN_LAST)); + uint plugin_num = (uint)(random_number % ((uint)PLUGIN_LAST-1)); user->plugin = Cached_authentication_plugins::cached_plugins_names[plugin_num]; unknown_accounts->clear_if_greater(MAX_UNKNOWN_ACCOUNTS); From 4a77e410af1280dec34e5c70e6642ae9a4689117 Mon Sep 17 00:00:00 2001 From: lxc-19092808 <122571730+lxc-19092808@users.noreply.github.com> Date: Sun, 15 Jan 2023 01:33:15 +0800 Subject: [PATCH 2/2] Update sql_authentication.cc --- sql/auth/sql_authentication.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/auth/sql_authentication.cc b/sql/auth/sql_authentication.cc index 72d802bc0ecd..3985722a5e1f 100644 --- a/sql/auth/sql_authentication.cc +++ b/sql/auth/sql_authentication.cc @@ -2060,6 +2060,7 @@ ACL_USER *decoy_user(const LEX_CSTRING &username, const LEX_CSTRING &hostname, } else { const int DECIMAL_SHIFT = 1000; const int random_number = static_cast(my_rnd(rand) * DECIMAL_SHIFT); + /* SHA256_PASSWORD plugin is excluded. */ uint plugin_num = (uint)(random_number % ((uint)PLUGIN_LAST-1)); user->plugin = Cached_authentication_plugins::cached_plugins_names[plugin_num];