diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-09-21 08:12:19 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-09-21 08:12:19 +0300 |
commit | e3d44f5d62672478c40294d6e46d9f066e418cac (patch) | |
tree | 44b4d1b9d94ced780d4f369f84eddc36791470be /plugin | |
parent | d176be8aeaecdb20a963fbd126929ddcd5bd98f3 (diff) | |
parent | f70865bc9e540767d8afc3cc2cbe0e1c92a8c0be (diff) | |
download | mariadb-git-e3d44f5d62672478c40294d6e46d9f066e418cac.tar.gz |
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/server_audit/server_audit.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index af6d2d95a42..2f6c8a8afda 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -15,7 +15,7 @@ #define PLUGIN_VERSION 0x104 -#define PLUGIN_STR_VERSION "1.4.1" +#define PLUGIN_STR_VERSION "1.4.2" #define _my_thread_var loc_thread_var @@ -1087,6 +1087,7 @@ static void setup_connection_connect(struct connection_info *cn, const struct mysql_event_connection *event) { cn->query_id= 0; + cn->query_length= 0; cn->log_always= 0; cn->thread_id= event->thread_id; get_str_n(cn->db, &cn->db_length, sizeof(cn->db), @@ -1128,6 +1129,7 @@ static void setup_connection_initdb(struct connection_info *cn, cn->thread_id= event->general_thread_id; cn->query_id= 0; + cn->query_length= 0; cn->log_always= 0; get_str_n(cn->db, &cn->db_length, sizeof(cn->db), event->general_query, event->general_query_length); @@ -1160,6 +1162,7 @@ static void setup_connection_table(struct connection_info *cn, cn->thread_id= event->thread_id; cn->query_id= query_counter++; cn->log_always= 0; + cn->query_length= 0; get_str_n(cn->db, &cn->db_length, sizeof(cn->db), event->database, event->database_length); get_str_n(cn->user, &cn->user_length, sizeof(cn->db), @@ -1181,6 +1184,7 @@ static void setup_connection_query(struct connection_info *cn, cn->thread_id= event->general_thread_id; cn->query_id= query_counter++; cn->log_always= 0; + cn->query_length= 0; get_str_n(cn->db, &cn->db_length, sizeof(cn->db), "", 0); if (get_user_host(event->general_user, event->general_user_length, @@ -2005,6 +2009,7 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev) event_query_command(event)) { log_statement(cn, event, "QUERY"); + cn->query_length= 0; /* So the log_current_query() won't log this again. */ } } else if (event_class == MYSQL_AUDIT_TABLE_CLASS && FILTER(EVENT_TABLE) && cn) @@ -2520,7 +2525,8 @@ static void log_current_query(MYSQL_THD thd) if (!thd) return; cn= get_loc_info(thd); - if (!ci_needs_setup(cn) && FILTER(EVENT_QUERY) && do_log_user(cn->user)) + if (!ci_needs_setup(cn) && cn->query_length && + FILTER(EVENT_QUERY) && do_log_user(cn->user)) { log_statement_ex(cn, cn->query_time, thd_get_thread_id(thd), cn->query, cn->query_length, 0, "QUERY"); |