mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug#27606 GRANT statement should be replicated with DEFINER information
"Grantor" columns' data is lost when replicating mysql.tables_priv. Slave SQL thread used its default user ''@'' as the grantor of GRANT|REVOKE statements executing on it. In this patch, current user is put in query log event for all GRANT and REVOKE statement, SQL thread uses the user in query log event as grantor.
This commit is contained in:
@@ -3923,6 +3923,10 @@ end_with_restore_list:
|
||||
if (check_access(thd, UPDATE_ACL, "mysql", 0, 1, 1, 0) &&
|
||||
check_global_access(thd,CREATE_USER_ACL))
|
||||
break;
|
||||
|
||||
/* Replicate current user as grantor */
|
||||
thd->binlog_invoker();
|
||||
|
||||
/* Conditionally writes to binlog */
|
||||
if (!(res = mysql_revoke_all(thd, lex->users_list)))
|
||||
my_ok(thd);
|
||||
@@ -3943,6 +3947,9 @@ end_with_restore_list:
|
||||
is_schema_db(select_lex->db) : 0))
|
||||
goto error;
|
||||
|
||||
/* Replicate current user as grantor */
|
||||
thd->binlog_invoker();
|
||||
|
||||
if (thd->security_ctx->user) // If not replication
|
||||
{
|
||||
LEX_USER *user, *tmp_user;
|
||||
|
||||
Reference in New Issue
Block a user