Debian Codegraph @

mysql-test/suite/ndb_rpl/r/ndb_rpl_stored_grants.result

raw
1 include/rpl_init.inc [topology=1->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
6 [Server A]
7 CREATE DATABASE auth_test_db;
8 USE auth_test_db;
9 CREATE TABLE t1 (pk INT PRIMARY KEY, a INT) engine = ndb;
10
11 Test 1:
12 [Server A]
13 CREATE USER 'ndb_u1'@'localhost' IDENTIFIED by 'pass1';
14 GRANT SELECT ON t1 TO 'ndb_u1'@'localhost';
15 GRANT NDB_STORED_USER ON *.* to 'ndb_u1'@'localhost';
16 INSERT INTO t1 VALUES(1,1);
17 [Connected to server C as ndb_u1]
18 SELECT * FROM t1 ORDER BY pk;
19 pk a
20 1 1
21 [Connected to server D as ndb_u1]
22 SELECT * FROM t1 ORDER BY pk;
23 pk a
24 1 1
25
26 [Test 1C: Server C binlog events]
27 ** Expect log_replica_updates=0, and no binlog events
28 SHOW VARIABLES LIKE 'log_replica_updates';
29 Variable_name Value
30 log_replica_updates OFF
31 include/show_binlog_events.inc
32 Log_name Pos Event_type Server_id End_log_pos Info
33
34 [Test 1D: Server D binlog events]
35 ** Expect 4 Query events: 1 CREATE USER + 3 GRANTs.
36 ** These must have server_id = 1.
37 include/show_binlog_events.inc
38 Log_name Pos Event_type Server_id End_log_pos Info
39 # # Query 1 # CREATE USER 'ndb_u1'@'localhost' IDENTIFIED WITH 'caching_sha2_password' AS '<non-deterministic-password-hash>' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT
40 # # Query 1 # GRANT USAGE ON *.* TO 'ndb_u1'@'localhost'
41 # # Query 1 # GRANT NDB_STORED_USER ON *.* TO 'ndb_u1'@'localhost'
42 # # Query 1 # GRANT SELECT ON `auth_test_db`.`t1` TO 'ndb_u1'@'localhost'
43
44 Test 2:
45 [Server B]
46 CREATE USER 'ndb_u2'@'localhost' IDENTIFIED by 'pass2';
47 GRANT NDB_STORED_USER ON *.* to 'ndb_u2'@'localhost';
48 GRANT SELECT ON t1 TO 'ndb_u2'@'localhost';
49 INSERT INTO t1 VALUES(2,2);
50 [Connected to Server A as ndb_u2]
51 SELECT * FROM t1 ORDER BY pk;
52 pk a
53 1 1
54 2 2
55 [Connected to Server C as ndb_u2]
56 SELECT * FROM t1 ORDER BY pk;
57 pk a
58 1 1
59 2 2
60 [Connected to Server D as ndb_u2]
61 SELECT * FROM t1 ORDER BY pk;
62 pk a
63 1 1
64 2 2
65
66 Test 3:
67 [Server A]
68 CREATE USER 'local_user_1'@'localhost' IDENTIFIED BY 'local1';
69 [Connected to Server C as local_user_1]
70 [Server D]
71 SHOW CREATE USER local_user_1@localhost;
72 ERROR HY000: Operation SHOW CREATE USER failed for 'local_user_1'@'localhost'
73
74 Test 4:
75 [Server B]
76 CREATE USER local_user_2@b;
77 [Server A]
78 [Server C]
79 SHOW CREATE USER local_user_2@b;
80 ERROR HY000: Operation SHOW CREATE USER failed for 'local_user_2'@'b'
81
82 Test 5:
83 [Server A]
84 SET sql_log_bin=0;
85 CREATE USER 'ndb_u5'@'localhost' IDENTIFIED by 'pass5';
86 GRANT NDB_STORED_USER ON *.* to 'ndb_u5'@'localhost';
87 GRANT SELECT ON t1 TO 'ndb_u5'@'localhost';
88 INSERT INTO t1 VALUES(3,3);
89 SET sql_log_bin=1;
90 ERROR 28000: Access denied for user 'ndb_u5'@'localhost' (using password: YES)
91
92 Test 6:
93 [Server B]
94 SET sql_log_bin=0;
95 CREATE USER 'ndb_u6'@'localhost' IDENTIFIED by 'pass6';
96 GRANT NDB_STORED_USER ON *.* to 'ndb_u6'@'localhost';
97 GRANT SELECT ON t1 TO 'ndb_u6'@'localhost';
98 INSERT INTO t1 VALUES(4,4);
99 SET sql_log_bin=1;
100 ERROR 28000: Access denied for user 'ndb_u6'@'localhost' (using password: YES)
101
102 Test 7:
103 [Server A]
104 Creating user u7 with random password
105 GRANT SELECT ON t1 TO 'u7'@'127.%';
106 [Server C]
107 select current_user(), @@server_id;
108 current_user() @@server_id
109 u7@127.% 3
110 [Server A]
111 GRANT ndb_stored_user on *.* to u7@'127.%';
112 select current_user(), @@server_id;
113 current_user() @@server_id
114 root@localhost 1
115 [Server B]
116 select current_user(), @@server_id;
117 current_user() @@server_id
118 u7@127.% 2
119
120 Cleanup:
121 SET sql_log_bin=1;
122 drop user local_user_1@localhost;
123 drop user ndb_u1@localhost;
124 drop user ndb_u2@localhost;
125 drop user if exists ndb_u5@localhost;
126 drop user if exists ndb_u6@localhost;
127 drop user if exists u7@'127.%';
128 drop table t1;
129 drop database auth_test_db;
130 drop user local_user_2@b;
131 FLUSH BINARY LOGS;
132 include/rpl_end.inc