summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2020-03-18 22:54:31 +0200
committerAndrei Elkin <andrei.elkin@mariadb.com>2020-03-18 22:54:57 +0200
commit14ef6a2c10d0ce8a4c080584efee1b71e0ab8301 (patch)
tree98f6cce3b4350fce8302db20684664074bd13112
parent12b7d5dc46b3f866bf941e40ef41ece318ec024e (diff)
downloadmariadb-git-14ef6a2c10d0ce8a4c080584efee1b71e0ab8301.tar.gz
MDEV-21975 Add BINLOG REPLAY privilege and bind new privileges to ...
Testing is extended with a block added up to binlog_grant.
-rw-r--r--mysql-test/suite/binlog/r/binlog_grant.result24
-rw-r--r--mysql-test/suite/binlog/t/binlog_grant.test37
2 files changed, 61 insertions, 0 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_grant.result b/mysql-test/suite/binlog/r/binlog_grant.result
index f715a9a719e..1ed21b0f4c1 100644
--- a/mysql-test/suite/binlog/r/binlog_grant.result
+++ b/mysql-test/suite/binlog/r/binlog_grant.result
@@ -124,5 +124,29 @@ disconnect user1;
connection default;
DROP USER user1@localhost;
#
+# MDEV-21975 Add BINLOG REPLAY privilege and bind new privileges to
+# gtid_seq_no, preudo_thread_id, server_id, gtid_domain_id
+#
+# Test combinations of BINLOG REPLAY guarded features which typically
+# arise in mysqlbinlog output replay on server.
+#
+CREATE USER user1@localhost;
+GRANT BINLOG REPLAY ON *.* TO user1@localhost;
+RESET MASTER;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+connect user1,localhost,user1,,;
+RENAME TABLE t1 to t2;
+connection default;
+REVOKE BINLOG REPLAY ON *.* FROM user1@localhost;
+call mtr.add_suppression("Access denied; you need (at least one of) the SUPER, BINLOG REPLAY privilege(s) for this operation");
+# Privilege errors are expected now:
+connection user1;
+connection default;
+include/diff_tables.inc [t1,t2]
+# Test cleanup
+DROP TABLE t2,t1;
+DROP USER user1@localhost;
+#
# End of 10.5 test
#
diff --git a/mysql-test/suite/binlog/t/binlog_grant.test b/mysql-test/suite/binlog/t/binlog_grant.test
index 72a94a5273b..ec8d2aeccd2 100644
--- a/mysql-test/suite/binlog/t/binlog_grant.test
+++ b/mysql-test/suite/binlog/t/binlog_grant.test
@@ -173,5 +173,42 @@ connection default;
DROP USER user1@localhost;
--echo #
+--echo # MDEV-21975 Add BINLOG REPLAY privilege and bind new privileges to
+--echo # gtid_seq_no, preudo_thread_id, server_id, gtid_domain_id
+--echo #
+--echo # Test combinations of BINLOG REPLAY guarded features which typically
+--echo # arise in mysqlbinlog output replay on server.
+--echo #
+
+CREATE USER user1@localhost;
+GRANT BINLOG REPLAY ON *.* TO user1@localhost;
+RESET MASTER;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+--connect(user1,localhost,user1,,)
+# Genuine mysqlbinlog output
+--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+RENAME TABLE t1 to t2;
+
+--exec $MYSQL --user=user1 test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+
+--connection default
+REVOKE BINLOG REPLAY ON *.* FROM user1@localhost;
+call mtr.add_suppression("Access denied; you need (at least one of) the SUPER, BINLOG REPLAY privilege(s) for this operation");
+--echo # Privilege errors are expected now:
+--connection user1
+--error 1
+--exec $MYSQL --user=user1 test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+
+--connection default
+--let $diff_tables=t1,t2
+--source include/diff_tables.inc
+
+--echo # Test cleanup
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+DROP TABLE t2,t1;
+DROP USER user1@localhost;
+
+--echo #
--echo # End of 10.5 test
--echo #