From dca73809f1d8b5ea2c2ce6ea96d1aebd771c0083 Mon Sep 17 00:00:00 2001 From: hongdongjian Date: Fri, 25 Mar 2022 19:47:40 +0800 Subject: [PATCH 1/2] MDEV-28177: server_audit; Update the offset of dbName on the aarch64 platform. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On the aarch64 platform, MySQL 5.7.33 cannot install this version of the audit plugin, but X86_64 can run well。 --- plugin/server_audit/server_audit.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin/server_audit/server_audit.cc b/plugin/server_audit/server_audit.cc index 6dd78638f37..95c65caeaec 100644 --- a/plugin/server_audit/server_audit.cc +++ b/plugin/server_audit/server_audit.cc @@ -1962,6 +1962,9 @@ int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len) #ifdef __x86_64__ db_off= 608; db_len_off= 616; +#elif __aarch64__ + db_off= 632; + db_len_off= 640; #else db_off= 0; db_len_off= 0; @@ -1972,6 +1975,9 @@ int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len) #ifdef __x86_64__ db_off= 536; db_len_off= 544; +#elif __aarch64__ + db_off= 552; + db_len_off= 560; #else db_off= 0; db_len_off= 0; From cffbfe03ddc4e2fa55cf31933e1defc9398c96d9 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Thu, 28 Apr 2022 09:34:21 +0400 Subject: [PATCH 2/2] MDEV-28429 audit plugin report OOOOO. Few initializations to the connection_info structure added. I think they can be removed if we are sure the bug was fixed. --- plugin/server_audit/server_audit.cc | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/plugin/server_audit/server_audit.cc b/plugin/server_audit/server_audit.cc index 95c65caeaec..b8bc2ba9ee1 100644 --- a/plugin/server_audit/server_audit.cc +++ b/plugin/server_audit/server_audit.cc @@ -17,7 +17,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ #define PLUGIN_VERSION 0x104 -#define PLUGIN_STR_VERSION "1.4.11" +#define PLUGIN_STR_VERSION "1.4.14" #define _my_thread_var loc_thread_var @@ -849,7 +849,19 @@ static unsigned long long query_counter= 1; static struct connection_info *get_loc_info(MYSQL_THD thd) { + /* + This is the original code and supposed to be returned + bach to this as the MENT-1438 is finally understood/resolved. return (struct connection_info *) THDVAR(thd, loc_info); + */ + struct connection_info *ci= (struct connection_info *) THDVAR(thd, loc_info); + if ((size_t) ci->user_length > sizeof(ci->user)) + { + ci->user_length= 0; + ci->host_length= 0; + ci->ip_length= 0; + } + return ci; } @@ -1221,6 +1233,16 @@ static size_t log_header(char *message, size_t message_len, host= userip; } + /* + That was added to find the possible cause of the MENT-1438. + Supposed to be removed after that. + */ + if (username_len > 1024) + { + username= "unknown_user"; + username_len= (unsigned int) strlen(username); + } + if (output_type == OUTPUT_SYSLOG) return snprintf(message, message_len, "%.*s,%.*s,%.*s,%d,%lld,%s",