diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-05-02 17:55:00 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-05-12 10:16:45 +0200 |
commit | 4203f572aeebb55ad97c9576d58c0a14ed73862a (patch) | |
tree | 50771d8f00bc1264024c6b30626f7d09c52a4d0f /mysql-test/suite/sys_vars/inc | |
parent | bbf5cf4ddf1b5fe6f5c8604ce57502b9e12a7088 (diff) | |
download | mariadb-git-4203f572aeebb55ad97c9576d58c0a14ed73862a.tar.gz |
MDEV-15923 option to control who can set session @@timestamp
--secure-timestamp=NO|SUPER|REPLICATION|YES
Diffstat (limited to 'mysql-test/suite/sys_vars/inc')
-rw-r--r-- | mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc b/mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc new file mode 100644 index 00000000000..8bc3e42df59 --- /dev/null +++ b/mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc @@ -0,0 +1,49 @@ +# +# MDEV-15923 option to control who can set session @@timestamp +# +source include/have_binlog_format_statement.inc; +source include/master-slave.inc; + +connection slave; +select @@secure_timestamp; + +### SUPER +disable_abort_on_error; +set timestamp=1234567890.101112; +enable_abort_on_error; +select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'SUPER'; + +### non-privileged user +create user foo@127.0.0.1; +connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +disable_abort_on_error; +set timestamp=1234567890.101112; +enable_abort_on_error; +select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'non-privileged'; +disconnect con2; +connection slave; +drop user foo@127.0.0.1; + +### replication +connection master; +set time_zone='+00:00'; +set timestamp=1234567890.101112; +select @@timestamp, now(6); + +create table t1 (b varchar(20), a timestamp(6) default current_timestamp(6)); +insert t1 (b) values ('replicated'); +sync_slave_with_master; +create trigger t1rbr before insert on t1 for each row set new.a=now(6); +set @@global.slave_run_triggers_for_rbr= yes; +binlog 'LQfqWg8BAAAA/AAAAAABAAABAAQAMTAuMy42LU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtB+paEzgNAAgAEgAEBAQEEgAA5AAEGggAAAAICAgCAAAACgoKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEEwQADQgICAoKCgFlBcaR'; +binlog '0gKWSRMBAAAAMQAAAHQDAAAAAB8AAAAAAAEABHRlc3QAAnQxAAIPEQMUAAYBQFUzwA==0gKWSRcBAAAAMAAAAKQDAAAAAB8AAAAAAAEAAv/8BmJpbmxvZ0mWAtIBivg3mwo+'; +set @@global.slave_run_triggers_for_rbr= default; +select b, if(a > 20100101, 'READONLY', 'EDITABLE') as 'REPLICATION' from t1; +connection master; +#set binlog_format=row; +#insert t1 (b) values ('binlog'); +#let datadir=`select @@datadir`; +#exec $MYSQL_BINLOG $datadir/master-bin.000001; +drop table t1; + +source include/rpl_end.inc; |