mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-13060 Server Audit Plugin Crashes with AWS KMS plugin
don't do auditing if thd is NULL. Collaterals: * copy-paste bugs server_audit.c * uninitialized user field when thd in NULL
This commit is contained in:
@ -1145,7 +1145,7 @@ static void setup_connection_initdb(struct connection_info *cn,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
get_str_n(cn->user, &cn->user_length, sizeof(cn->db),
|
get_str_n(cn->user, &cn->user_length, sizeof(cn->user),
|
||||||
uh_buffer, user_len);
|
uh_buffer, user_len);
|
||||||
get_str_n(cn->host, &cn->host_length, sizeof(cn->host),
|
get_str_n(cn->host, &cn->host_length, sizeof(cn->host),
|
||||||
uh_buffer+user_len+1, host_len);
|
uh_buffer+user_len+1, host_len);
|
||||||
@ -1196,7 +1196,7 @@ static void setup_connection_query(struct connection_info *cn,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
get_str_n(cn->user, &cn->user_length, sizeof(cn->db),
|
get_str_n(cn->user, &cn->user_length, sizeof(cn->user),
|
||||||
uh_buffer, user_len);
|
uh_buffer, user_len);
|
||||||
get_str_n(cn->host, &cn->host_length, sizeof(cn->host),
|
get_str_n(cn->host, &cn->host_length, sizeof(cn->host),
|
||||||
uh_buffer+user_len+1, host_len);
|
uh_buffer+user_len+1, host_len);
|
||||||
@ -1956,7 +1956,7 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
|
|||||||
/* That one is important as this function can be called with */
|
/* That one is important as this function can be called with */
|
||||||
/* &lock_operations locked when the server logs an error reported */
|
/* &lock_operations locked when the server logs an error reported */
|
||||||
/* by this plugin. */
|
/* by this plugin. */
|
||||||
if (internal_stop_logging)
|
if (!thd || internal_stop_logging)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
flogger_mutex_lock(&lock_operations);
|
flogger_mutex_lock(&lock_operations);
|
||||||
|
@ -170,6 +170,8 @@ void mysql_audit_general(THD *thd, uint event_subtype,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
event.general_user= NULL;
|
||||||
|
event.general_user_length= 0;
|
||||||
event.general_thread_id= 0;
|
event.general_thread_id= 0;
|
||||||
event.general_query= NULL;
|
event.general_query= NULL;
|
||||||
event.general_query_length= 0;
|
event.general_query_length= 0;
|
||||||
|
Reference in New Issue
Block a user