mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-9106 Audit Plugin doesn't run with MySQL 5.7.
MariaDB 5.5 built in debug gets unhappy with mutexes. Although everything is correct, some DBUG_ASSERT can happen. So this patch keeps safe_mutex silent.
This commit is contained in:
@@ -1920,11 +1920,8 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
|
|||||||
|
|
||||||
flogger_mutex_lock(&lock_operations);
|
flogger_mutex_lock(&lock_operations);
|
||||||
|
|
||||||
cn= get_loc_info(thd);
|
if (maria_55_started && debug_server_started &&
|
||||||
|
event_class == MYSQL_AUDIT_GENERAL_CLASS)
|
||||||
if (ci_needs_setup(cn) && maria_55_started &&
|
|
||||||
(event_class == MYSQL_AUDIT_GENERAL_CLASS &&
|
|
||||||
*((int*)ev) == MYSQL_AUDIT_GENERAL_ERROR))
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
There's a bug in MariaDB 5.5 that prevents using thread local
|
There's a bug in MariaDB 5.5 that prevents using thread local
|
||||||
@@ -1932,9 +1929,24 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
|
|||||||
The 'select * from notexisting_table;' query produces such case.
|
The 'select * from notexisting_table;' query produces such case.
|
||||||
So just use the static buffer in this case.
|
So just use the static buffer in this case.
|
||||||
*/
|
*/
|
||||||
|
const struct mysql_event_general *event =
|
||||||
|
(const struct mysql_event_general *) ev;
|
||||||
|
|
||||||
|
if (event->event_subclass == MYSQL_AUDIT_GENERAL_ERROR ||
|
||||||
|
(event->event_subclass == MYSQL_AUDIT_GENERAL_STATUS &&
|
||||||
|
event->general_query_length == 0 &&
|
||||||
|
cn_error_buffer.query_id == event->query_id))
|
||||||
|
{
|
||||||
cn= &cn_error_buffer;
|
cn= &cn_error_buffer;
|
||||||
cn->header= 1;
|
cn->header= 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
cn= get_loc_info(thd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cn= get_loc_info(thd);
|
||||||
|
}
|
||||||
|
|
||||||
update_connection_info(cn, event_class, ev, &after_action);
|
update_connection_info(cn, event_class, ev, &after_action);
|
||||||
|
|
||||||
@@ -2474,6 +2486,7 @@ static void update_file_path(MYSQL_THD thd,
|
|||||||
{
|
{
|
||||||
char *new_name= (*(char **) save) ? *(char **) save : empty_str;
|
char *new_name= (*(char **) save) ? *(char **) save : empty_str;
|
||||||
|
|
||||||
|
if (!maria_55_started || !debug_server_started)
|
||||||
flogger_mutex_lock(&lock_operations);
|
flogger_mutex_lock(&lock_operations);
|
||||||
internal_stop_logging= 1;
|
internal_stop_logging= 1;
|
||||||
error_header();
|
error_header();
|
||||||
@@ -2510,6 +2523,7 @@ static void update_file_path(MYSQL_THD thd,
|
|||||||
file_path= path_buffer;
|
file_path= path_buffer;
|
||||||
exit_func:
|
exit_func:
|
||||||
internal_stop_logging= 0;
|
internal_stop_logging= 0;
|
||||||
|
if (!maria_55_started || !debug_server_started)
|
||||||
flogger_mutex_unlock(&lock_operations);
|
flogger_mutex_unlock(&lock_operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2554,6 +2568,7 @@ static void update_incl_users(MYSQL_THD thd,
|
|||||||
void *var_ptr __attribute__((unused)), const void *save)
|
void *var_ptr __attribute__((unused)), const void *save)
|
||||||
{
|
{
|
||||||
char *new_users= (*(char **) save) ? *(char **) save : empty_str;
|
char *new_users= (*(char **) save) ? *(char **) save : empty_str;
|
||||||
|
if (!maria_55_started || !debug_server_started)
|
||||||
flogger_mutex_lock(&lock_operations);
|
flogger_mutex_lock(&lock_operations);
|
||||||
mark_always_logged(thd);
|
mark_always_logged(thd);
|
||||||
strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer));
|
strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer));
|
||||||
@@ -2561,6 +2576,7 @@ static void update_incl_users(MYSQL_THD thd,
|
|||||||
user_coll_fill(&incl_user_coll, incl_users, &excl_user_coll, 1);
|
user_coll_fill(&incl_user_coll, incl_users, &excl_user_coll, 1);
|
||||||
error_header();
|
error_header();
|
||||||
fprintf(stderr, "server_audit_incl_users set to '%s'.\n", incl_users);
|
fprintf(stderr, "server_audit_incl_users set to '%s'.\n", incl_users);
|
||||||
|
if (!maria_55_started || !debug_server_started)
|
||||||
flogger_mutex_unlock(&lock_operations);
|
flogger_mutex_unlock(&lock_operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2570,6 +2586,7 @@ static void update_excl_users(MYSQL_THD thd __attribute__((unused)),
|
|||||||
void *var_ptr __attribute__((unused)), const void *save)
|
void *var_ptr __attribute__((unused)), const void *save)
|
||||||
{
|
{
|
||||||
char *new_users= (*(char **) save) ? *(char **) save : empty_str;
|
char *new_users= (*(char **) save) ? *(char **) save : empty_str;
|
||||||
|
if (!maria_55_started || !debug_server_started)
|
||||||
flogger_mutex_lock(&lock_operations);
|
flogger_mutex_lock(&lock_operations);
|
||||||
mark_always_logged(thd);
|
mark_always_logged(thd);
|
||||||
strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer));
|
strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer));
|
||||||
@@ -2577,6 +2594,7 @@ static void update_excl_users(MYSQL_THD thd __attribute__((unused)),
|
|||||||
user_coll_fill(&excl_user_coll, excl_users, &incl_user_coll, 0);
|
user_coll_fill(&excl_user_coll, excl_users, &incl_user_coll, 0);
|
||||||
error_header();
|
error_header();
|
||||||
fprintf(stderr, "server_audit_excl_users set to '%s'.\n", excl_users);
|
fprintf(stderr, "server_audit_excl_users set to '%s'.\n", excl_users);
|
||||||
|
if (!maria_55_started || !debug_server_started)
|
||||||
flogger_mutex_unlock(&lock_operations);
|
flogger_mutex_unlock(&lock_operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2653,6 +2671,7 @@ static void update_logging(MYSQL_THD thd,
|
|||||||
if (new_logging == logging)
|
if (new_logging == logging)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!maria_55_started || !debug_server_started)
|
||||||
flogger_mutex_lock(&lock_operations);
|
flogger_mutex_lock(&lock_operations);
|
||||||
internal_stop_logging= 1;
|
internal_stop_logging= 1;
|
||||||
if ((logging= new_logging))
|
if ((logging= new_logging))
|
||||||
@@ -2670,6 +2689,7 @@ static void update_logging(MYSQL_THD thd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal_stop_logging= 0;
|
internal_stop_logging= 0;
|
||||||
|
if (!maria_55_started || !debug_server_started)
|
||||||
flogger_mutex_unlock(&lock_operations);
|
flogger_mutex_unlock(&lock_operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2682,6 +2702,7 @@ static void update_mode(MYSQL_THD thd __attribute__((unused)),
|
|||||||
if (mode_readonly || new_mode == mode)
|
if (mode_readonly || new_mode == mode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!maria_55_started || !debug_server_started)
|
||||||
flogger_mutex_lock(&lock_operations);
|
flogger_mutex_lock(&lock_operations);
|
||||||
internal_stop_logging= 1;
|
internal_stop_logging= 1;
|
||||||
mark_always_logged(thd);
|
mark_always_logged(thd);
|
||||||
@@ -2689,6 +2710,7 @@ static void update_mode(MYSQL_THD thd __attribute__((unused)),
|
|||||||
fprintf(stderr, "Logging mode was changed from %d to %d.\n", mode, new_mode);
|
fprintf(stderr, "Logging mode was changed from %d to %d.\n", mode, new_mode);
|
||||||
mode= new_mode;
|
mode= new_mode;
|
||||||
internal_stop_logging= 0;
|
internal_stop_logging= 0;
|
||||||
|
if (!maria_55_started || !debug_server_started)
|
||||||
flogger_mutex_unlock(&lock_operations);
|
flogger_mutex_unlock(&lock_operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user