summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-11-08 14:17:53 +0100
committerSergei Golubchik <sergii@pisem.net>2012-11-08 14:17:53 +0100
commitd473199744812ee4af52edfa4b85610d834802ca (patch)
tree4eb122ccc0eded04d80889d9e8d6d3e1980212b7 /sql/log.cc
parent06365bf841eab74a1cb4b17e836ff0c372a0dd79 (diff)
downloadmariadb-git-d473199744812ee4af52edfa4b85610d834802ca.tar.gz
MDEV-258 audit plugin only see queries if general log is enabled
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc30
1 files changed, 14 insertions, 16 deletions
diff --git a/sql/log.cc b/sql/log.cc
index effe0e36705..b583c6dfac4 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1279,12 +1279,6 @@ bool LOGGER::general_log_write(THD *thd, enum enum_server_command command,
DBUG_ASSERT(thd);
- lock_shared();
- if (!opt_log)
- {
- unlock();
- return 0;
- }
user_host_len= make_user_name(thd, user_host_buff);
current_time= my_hrtime();
@@ -1295,15 +1289,19 @@ bool LOGGER::general_log_write(THD *thd, enum enum_server_command command,
command_name[(uint) command].length,
query, query_length);
- while (*current_handler)
- error|= (*current_handler++)->
- log_general(thd, current_time, user_host_buff,
- user_host_len, thd->thread_id,
- command_name[(uint) command].str,
- command_name[(uint) command].length,
- query, query_length,
- thd->variables.character_set_client) || error;
- unlock();
+ if (opt_log && log_command(thd, command))
+ {
+ lock_shared();
+ while (*current_handler)
+ error|= (*current_handler++)->
+ log_general(thd, current_time, user_host_buff,
+ user_host_len, thd->thread_id,
+ command_name[(uint) command].str,
+ command_name[(uint) command].length,
+ query, query_length,
+ thd->variables.character_set_client) || error;
+ unlock();
+ }
return error;
}
@@ -5333,7 +5331,7 @@ bool general_log_write(THD *thd, enum enum_server_command command,
const char *query, uint query_length)
{
/* Write the message to the log if we want to log this king of commands */
- if (logger.log_command(thd, command))
+ if (logger.log_command(thd, command) || mysql_audit_general_enabled())
return logger.general_log_write(thd, command, query, query_length);
return FALSE;