Debian Codegraph @

mysql-test/suite/rpl_gtid/r/rpl_current_user.result

raw
1 include/rpl_init.inc [topology=1->2->3]
2 Warnings:
3 Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4 Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
5 Warnings:
6 Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
7 Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
8 include/rpl_connect.inc [creating master]
9 include/rpl_connect.inc [creating slave]
10 CREATE TABLE t1(c1 char(100));
11 CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%';
12 CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%';
13 CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%';
14 CREATE VIEW test.v_event AS SELECT definer FROM information_schema.events WHERE event_name = 'e1';
15 CREATE PROCEDURE p1() SELECT 1;
16 # bug48321_1-01234 has the max length(16) of user.
17 CREATE USER 'bug48321_1-01234'@'localhost';
18 GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
19
20 # Make sure the max lengths of user and host
21 # the user name is too lengh
22 GRANT CREATE USER ON *.* TO '012345678901234567890123456789012'@'fakehost';
23 ERROR HY000: String '012345678901234567890123456789012' is too long for user name (should be no longer than 32)
24 # the host name is too lengh
25 GRANT CREATE USER ON *.* TO 'fakename'@'host_1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890X';
26 ERROR HY000: String 'host_1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij12345' is too long for host name (should be no longer than 255)
27
28 # User 'bug48321_1-01234' connects to master by conn1
29 # [On conn1]
30 # Verify 'REVOKE ALL' statement
31 REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER();
32 include/rpl_sync.inc
33 include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user]
34
35 # Verify 'GRANT ... ON TABLE ...' statement
36 GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
37 include/rpl_sync.inc
38 include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv]
39
40 # Verify 'GRANT ... ON PROCEDURE...' statement
41 GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER();
42 include/rpl_sync.inc
43 include/diff_tables.inc [server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv]
44
45 # Verify 'GRANT ... ON *.* ...' statement
46 GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION;
47 include/rpl_sync.inc
48 include/diff_tables.inc [server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv]
49
50 # Verify 'REVOKE ... ON TABLE ...' statement
51 REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
52 include/rpl_sync.inc
53 include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv]
54
55 # Verify 'REVOKE ... ON PROCEDURE...' statement
56 REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER();
57 include/rpl_sync.inc
58 include/diff_tables.inc [server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv]
59
60 # Verify 'REVOKE ... ON *.* ...' statement
61 REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER();
62 include/rpl_sync.inc
63 include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user]
64
65 # Verify 'GRANT ...' statement in the procedure
66 CREATE PROCEDURE my_grant()
67 GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
68 call my_grant;
69 include/rpl_sync.inc
70 include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv]
71
72 # Verify 'REVOKE ... ON TABLE ...' statement in the procedure
73 CREATE PROCEDURE my_revoke()
74 REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
75 call my_revoke;
76 include/rpl_sync.inc
77 include/diff_tables.inc [server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv]
78
79 # Verify 'RENAME USER ...' statement
80 RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost';
81 include/rpl_sync.inc
82 include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user]
83
84 # Verify 'DROP USER ...' statement
85 GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost';
86 DROP USER CURRENT_USER();
87 include/rpl_sync.inc
88 include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user]
89
90 # Verify 'ALTER EVENT...' statement
91 CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
92 # Explicitly assign CURRENT_USER() to definer
93 ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE;
94 include/rpl_sync.inc
95 include/diff_tables.inc [server_1:v_event, server_2:v_event, server_3:v_event]
96
97 # Session user will be set as definer, if the statement does not assign
98 # a definer
99 ALTER EVENT e1 ENABLE;
100 include/rpl_sync.inc
101 include/diff_tables.inc [server_1:v_event, server_2:v_event, server_3:v_event]
102
103 # Verify that this patch does not affect the calling of CURRENT_USER()
104 # in the other statements
105 # [On master]
106 INSERT INTO t1 VALUES(CURRENT_USER()), ('1234');
107 Warnings:
108 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the replica.
109 SELECT * FROM t1;
110 c1
111 root@localhost
112 1234
113 include/sync_slave_sql_with_master.inc
114 # [On slave]
115 SELECT * FROM t1;
116 c1
117 skip-grants user@skip-grants host
118 1234
119 # [On server_3]
120 include/sync_slave_sql_with_master.inc
121 SELECT * FROM t1;
122 c1
123 skip-grants user@skip-grants host
124 1234
125 # [On master]
126 UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234';
127 Warnings:
128 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the replica.
129 SELECT * FROM t1;
130 c1
131 root@localhost
132 root@localhost
133 include/sync_slave_sql_with_master.inc
134 # [On slave]
135 SELECT * FROM t1;
136 c1
137 skip-grants user@skip-grants host
138 skip-grants user@skip-grants host
139 include/sync_slave_sql_with_master.inc
140 # [On server_3]
141 SELECT * FROM t1;
142 c1
143 skip-grants user@skip-grants host
144 skip-grants user@skip-grants host
145 # [On master]
146 DELETE FROM t1 WHERE c1=CURRENT_USER();
147 Warnings:
148 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the replica.
149 SELECT * FROM t1;
150 c1
151 include/sync_slave_sql_with_master.inc
152 # [On slave]
153 SELECT * FROM t1;
154 c1
155 include/sync_slave_sql_with_master.inc
156 # [On server_3]
157 SELECT * FROM t1;
158 c1
159 # [On master]
160 CREATE TABLE t2(c1 char(100));
161 CREATE FUNCTION my_user() RETURNS VARCHAR(64)
162 SQL SECURITY INVOKER
163 BEGIN
164 INSERT INTO t2 VALUES(CURRENT_USER());
165 RETURN CURRENT_USER();
166 END |
167 INSERT INTO t1 VALUES(my_user());
168 Warnings:
169 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the replica.
170 SELECT * FROM t1;
171 c1
172 root@localhost
173 SELECT * FROM t2;
174 c1
175 root@localhost
176 include/sync_slave_sql_with_master.inc
177 # [On slave]
178 SELECT * FROM t1;
179 c1
180 skip-grants user@skip-grants host
181 SELECT * FROM t2;
182 c1
183 skip-grants user@skip-grants host
184 include/sync_slave_sql_with_master.inc
185 # [On server_3]
186 SELECT * FROM t1;
187 c1
188 skip-grants user@skip-grants host
189 SELECT * FROM t2;
190 c1
191 skip-grants user@skip-grants host
192
193 # END
194 DROP TABLE t1, t2;
195 DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event;
196 DROP PROCEDURE p1;
197 DROP PROCEDURE my_grant;
198 DROP PROCEDURE my_revoke;
199 DROP FUNCTION my_user;
200 DROP EVENT e1;
201 include/rpl_end.inc