summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/rpl/t/rpl_row_sp012.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/rpl/t/rpl_row_sp012.test')
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp012.test74
1 files changed, 74 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp012.test b/mysql-test/suite/rpl/t/rpl_row_sp012.test
new file mode 100644
index 00000000..2b8549bf
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_sp012.test
@@ -0,0 +1,74 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/22/2005 #
+# Update: 08/29/2005 Added save pos and sync #
+#############################################################################
+#TEST: SP to test security and current_user and user #
+#############################################################################
+
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/not_embedded.inc
+-- source include/master-slave.inc
+
+
+# Begin clean up test section
+connection master;
+--disable_warnings
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP PROCEDURE IF EXISTS test.p3;
+
+
+# Begin test section 1
+# Create user user1 with no particular access rights
+create user user1@localhost;
+grant usage on *.* to user1@localhost;
+flush privileges;
+
+SELECT CURRENT_USER();
+SELECT USER();
+CREATE PROCEDURE test.p1 () SQL SECURITY INVOKER SELECT CURRENT_USER(), USER();
+CREATE PROCEDURE test.p2 () SQL SECURITY DEFINER CALL test.p1();
+CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
+GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
+GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
+GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
+set sql_mode=default;
+
+# Need to wait for the rights to be applied at the slave
+sync_slave_with_master;
+
+connect (muser1,localhost,user1,,);
+connection muser1;
+SELECT CURRENT_USER();
+SELECT USER();
+CALL test.p3();
+CALL test.p2();
+
+connect (suser1,127.0.0.1,user1,,test,$SLAVE_MYPORT,);
+
+connection master;
+save_master_pos;
+connection suser1;
+sync_with_master;
+
+SELECT CURRENT_USER();
+SELECT USER();
+CALL test.p3();
+CALL test.p2();
+
+# Cleanup
+connection master;
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p3;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP USER user1@localhost;
+sync_slave_with_master;
+
+# End of 5.0 test case
+
+--source include/rpl_end.inc