summaryrefslogtreecommitdiff
path: root/sql/sql_trigger.cc
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2015-04-16 16:29:02 -0400
committerNirbhay Choubey <nirbhay@mariadb.com>2015-04-16 16:29:02 -0400
commit0095697784a12cbb269238b354ac6f31800418fb (patch)
tree1be094b0b32b35672707812db4890918b3df1cfc /sql/sql_trigger.cc
parent84a4db263a1d98e9a2f3c6b5816a9b6b9a019128 (diff)
downloadmariadb-git-0095697784a12cbb269238b354ac6f31800418fb.tar.gz
MDEV-7996 : CURRENT_USER definer does not replicate for triggers
THD's lex->definer initially holds "*current_user" for CURRENT_USER(). As a result when wsrep tries to create the trigger query, it incorrectly uses "*current_user". Fixed by calling get_current_user() to get the real current user. Merged galera_create_trigger.test from github.com/codership/mysql-wsrep.
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r--sql/sql_trigger.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index cf5b4a39b1f..a2b5f9a68c9 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -2464,9 +2464,13 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
if (lex->definer)
{
/* SUID trigger. */
+ LEX_USER *d= get_current_user(thd, lex->definer);
- definer_user= lex->definer->user;
- definer_host= lex->definer->host;
+ if (!d)
+ return 1;
+
+ definer_user= d->user;
+ definer_host= d->host;
}
else
{