Debian Codegraph @

mysql-test/suite/rpl/t/rpl_row_sp012.test

raw
1 #############################################################################
2 # Original Author: JBM #
3 # Original Date: Aug/22/2005 #
4 # Update: 08/29/2005 Added save pos and sync #
5 #############################################################################
6 #TEST: SP to test security and current_user and user #
7 #############################################################################
8
9
10 # Includes
11 -- source include/have_binlog_format_row.inc
12 -- source include/not_embedded.inc
13 -- source include/master-slave.inc
14
15
16 # Begin clean up test section
17 connection master;
18 --disable_warnings
19 DROP PROCEDURE IF EXISTS test.p1;
20 DROP PROCEDURE IF EXISTS test.p2;
21 DROP PROCEDURE IF EXISTS test.p3;
22
23
24 # Begin test section 1
25 # Create user user1 with no particular access rights
26 create user user1@localhost;
27 grant usage on *.* to user1@localhost;
28 flush privileges;
29
30 SELECT CURRENT_USER();
31 SELECT USER();
32 CREATE PROCEDURE test.p1 () SQL SECURITY INVOKER SELECT CURRENT_USER(), USER();
33 CREATE PROCEDURE test.p2 () SQL SECURITY DEFINER CALL test.p1();
34 CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
35 GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
36 GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
37 GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
38 set sql_mode=default;
39
40 # Need to wait for the rights to be applied at the slave
41 sync_slave_with_master;
42
43 connect (muser1,localhost,user1,,);
44 connection muser1;
45 SELECT CURRENT_USER();
46 SELECT USER();
47 CALL test.p3();
48 CALL test.p2();
49
50 connect (suser1,127.0.0.1,user1,,test,$SLAVE_MYPORT,);
51
52 connection master;
53 save_master_pos;
54 connection suser1;
55 sync_with_master;
56
57 SELECT CURRENT_USER();
58 SELECT USER();
59 CALL test.p3();
60 CALL test.p2();
61
62 # Cleanup
63 connection master;
64 DROP PROCEDURE IF EXISTS test.p1;
65 DROP PROCEDURE IF EXISTS test.p3;
66 DROP PROCEDURE IF EXISTS test.p2;
67 DROP TABLE IF EXISTS test.t1;
68 DROP TABLE IF EXISTS test.t2;
69 DROP USER user1@localhost;
70 sync_slave_with_master;
71
72 # End of 5.0 test case
73
74 --source include/rpl_end.inc