summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result21
-rw-r--r--mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test12
-rw-r--r--sql/log_event.cc19
3 files changed, 50 insertions, 2 deletions
diff --git a/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result
new file mode 100644
index 00000000000..67af4a068d6
--- /dev/null
+++ b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result
@@ -0,0 +1,21 @@
+include/master-slave.inc
+[connection master]
+create role r1;
+set role r1;
+grant select on db.* to current_role;
+revoke all privileges, grant option from current_role;
+drop role r1;
+include/rpl_end.inc
+connection server_2;
+connection server_2;
+connection server_2;
+connection server_2;
+connection server_1;
+connection server_1;
+connection server_1;
+connection server_2;
+connection server_1;
+connection server_2;
+connection server_2;
+connection server_1;
+connection server_1;
diff --git a/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test
new file mode 100644
index 00000000000..6a6c4f2a756
--- /dev/null
+++ b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test
@@ -0,0 +1,12 @@
+--source include/master-slave.inc
+--source include/have_binlog_format_mixed.inc
+
+--enable_connect_log
+
+create role r1;
+set role r1;
+grant select on db.* to current_role;
+revoke all privileges, grant option from current_role;
+drop role r1;
+
+--source include/rpl_end.inc
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 82cd82b5e7a..4a1d13a8004 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -3631,10 +3631,25 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
if (time_zone_len)
copy_str_and_move(&time_zone_str, &start, time_zone_len);
- if (user.length > 0)
+ if (user.length)
+ {
copy_str_and_move((const char **)&(user.str), &start, user.length);
- if (host.length > 0)
+ }
+ else
+ {
+ user.str= (char *) start++;
+ user.str[0]= '\0';
+ }
+
+ if (host.length)
+ {
copy_str_and_move((const char **)&(host.str), &start, host.length);
+ }
+ else
+ {
+ host.str= (char *) start++;
+ host.str[0]= '\0';
+ }
/**
if time_zone_len or catalog_len are 0, then time_zone and catalog