diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2019-12-21 13:46:33 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2019-12-21 13:46:33 +0400 |
commit | aaaf6ceb8bcdfec103fd3131ff8261138d8b5e39 (patch) | |
tree | 86bbf6d63978872428f708b8ea6b04e690997577 /sql/sql_audit.h | |
parent | 8174e68895c468a2286688962a65206e677b7c51 (diff) | |
download | mariadb-git-aaaf6ceb8bcdfec103fd3131ff8261138d8b5e39.tar.gz |
MDE-21369 rpl.rpl_timezone fails with valgrind: Use of uninitialised value.
It's not safe to chenge the THD::thread_id.
So send the thread_id as an argument to the mysql_audit_external_lock.
Diffstat (limited to 'sql/sql_audit.h')
-rw-r--r-- | sql/sql_audit.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sql/sql_audit.h b/sql/sql_audit.h index ff0f049779f..03f2f3aca33 100644 --- a/sql/sql_audit.h +++ b/sql/sql_audit.h @@ -291,7 +291,9 @@ void mysql_audit_notify_connection_change_user(THD *thd) } static inline -void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock) +void mysql_audit_external_lock_ex(THD *thd, my_thread_id thread_id, + const char *user, const char *host, const char *ip, query_id_t query_id, + TABLE_SHARE *share, int lock) { if (lock != F_UNLCK && mysql_audit_table_enabled()) { @@ -300,14 +302,14 @@ void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock) event.event_subclass= MYSQL_AUDIT_TABLE_LOCK; event.read_only= lock == F_RDLCK; - event.thread_id= (unsigned long)thd->thread_id; - event.user= sctx->user; + event.thread_id= (unsigned long)thread_id; + event.user= user; event.priv_user= sctx->priv_user; event.priv_host= sctx->priv_host; event.external_user= sctx->external_user; event.proxy_user= sctx->proxy_user; - event.host= sctx->host; - event.ip= sctx->ip; + event.host= host; + event.ip= ip; event.database= share->db.str; event.database_length= (unsigned int)share->db.length; event.table= share->table_name.str; @@ -316,13 +318,21 @@ void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock) event.new_database_length= 0; event.new_table= 0; event.new_table_length= 0; - event.query_id= thd->query_id; + event.query_id= query_id; mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, &event); } } static inline +void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock) +{ + mysql_audit_external_lock_ex(thd, thd->thread_id, thd->security_ctx->user, + thd->security_ctx->host, thd->security_ctx->ip, thd->query_id, + share, lock); +} + +static inline void mysql_audit_create_table(TABLE *table) { if (mysql_audit_table_enabled()) |