Debian Codegraph @

mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test

raw
1
2 #
3 # Tests for the performance_schema host_cache.
4 #
5 # Simulate failures from client / server protocol:
6 # - reported in COUNT_HANDSHAKE_ERRORS
7 # aud further causes blocking errors:
8 # - reported in SUM_CONNECT_ERRORS
9 # - reported in COUNT_HOST_BLOCKED_ERRORS
10
11 --source include/not_embedded.inc
12 --source include/have_debug.inc
13 --source include/check_ipv6.inc
14 --source include/have_perfschema.inc
15
16 # Enforce a clean state
17 --source ../include/wait_for_pfs_thread_count.inc
18 --source ../include/hostcache_set_state.inc
19
20 --disable_cursor_protocol
21 select @@global.max_connect_errors into @saved_max_connect_errors;
22 --enable_cursor_protocol
23
24 set global max_connect_errors = 3;
25
26 create user 'root'@'santa.claus.ipv6.example.com';
27 grant select on test.* to 'root'@'santa.claus.ipv6.example.com';
28
29 create user 'quota'@'santa.claus.ipv6.example.com';
30 grant select on test.* to 'quota'@'santa.claus.ipv6.example.com';
31
32 connect (con1,"::1",root,,test,$MASTER_MYPORT,);
33 select "Con1 is alive";
34 select current_user();
35 disconnect con1;
36
37 --connection default
38 SET @saved_dbug = @@GLOBAL.debug_dbug;
39 set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6,native_password_bad_reply";
40
41 --disable_query_log
42 --error ER_HANDSHAKE_ERROR
43 connect (con2a,"::1",quota,,test,$MASTER_MYPORT,);
44 --enable_query_log
45
46 --connection default
47 --source ../include/hostcache_dump.inc
48
49 --disable_query_log
50 --error ER_HANDSHAKE_ERROR
51 connect (con2b,"::1",quota,,test,$MASTER_MYPORT,);
52 --enable_query_log
53
54 --connection default
55 --source ../include/hostcache_dump.inc
56
57 --disable_query_log
58 --error ER_HANDSHAKE_ERROR
59 connect (con2c,"::1",quota,,test,$MASTER_MYPORT,);
60 --enable_query_log
61
62 --connection default
63 --source ../include/hostcache_dump.inc
64
65 --disable_query_log
66 --error ER_HOST_IS_BLOCKED
67 connect (con2d,"::1",quota,,test,$MASTER_MYPORT,);
68 --enable_query_log
69
70 --connection default
71 --source ../include/hostcache_dump.inc
72
73 --disable_query_log
74 --error ER_HOST_IS_BLOCKED
75 connect (con2e,"::1",quota,,test,$MASTER_MYPORT,);
76 --enable_query_log
77
78 --connection default
79 --source ../include/hostcache_dump.inc
80
81 # Now that the host is blocked, check that flush works
82 flush hosts;
83
84 --disable_query_log
85 --error ER_HANDSHAKE_ERROR
86 connect (con3a,"::1",quota,,test,$MASTER_MYPORT,);
87 --enable_query_log
88
89 --connection default
90 --source ../include/hostcache_dump.inc
91
92 --disable_query_log
93 --error ER_HANDSHAKE_ERROR
94 connect (con3b,"::1",quota,,test,$MASTER_MYPORT,);
95 --enable_query_log
96
97 --connection default
98 --source ../include/hostcache_dump.inc
99
100 --connection default
101 set global debug_dbug= "-d,native_password_bad_reply";
102
103 --disable_query_log
104 connect (con4,"::1",quota,,test,$MASTER_MYPORT,);
105 select "Valid connection should reset SUM_CONNECT_ERROR counter" as message;
106 --disconnect con4
107 --enable_query_log
108
109 --connection default
110 set global debug_dbug= "+d,native_password_bad_reply";
111
112 --connection default
113 --source ../include/hostcache_dump.inc
114
115 --disable_query_log
116 --error ER_HANDSHAKE_ERROR
117 connect (con5a,"::1",quota,,test,$MASTER_MYPORT,);
118 --enable_query_log
119
120 --connection default
121 --source ../include/hostcache_dump.inc
122
123 --disable_query_log
124 --error ER_HANDSHAKE_ERROR
125 connect (con5b,"::1",quota,,test,$MASTER_MYPORT,);
126 --enable_query_log
127
128 --connection default
129 --source ../include/hostcache_dump.inc
130
131 --disable_query_log
132 --error ER_HANDSHAKE_ERROR
133 connect (con5c,"::1",quota,,test,$MASTER_MYPORT,);
134 --enable_query_log
135
136 --connection default
137 --source ../include/hostcache_dump.inc
138
139 --disable_query_log
140 --error ER_HOST_IS_BLOCKED
141 connect (con5d,"::1",quota,,test,$MASTER_MYPORT,);
142 --enable_query_log
143
144 --connection default
145 --source ../include/hostcache_dump.inc
146
147 --disable_query_log
148 --error ER_HOST_IS_BLOCKED
149 connect (con5e,"::1",quota,,test,$MASTER_MYPORT,);
150 --enable_query_log
151
152 --connection default
153 --source ../include/hostcache_dump.inc
154
155 revoke select on test.* from 'root'@'santa.claus.ipv6.example.com';
156 drop user 'root'@'santa.claus.ipv6.example.com';
157
158 revoke select on test.* from 'quota'@'santa.claus.ipv6.example.com';
159 drop user 'quota'@'santa.claus.ipv6.example.com';
160
161 set global max_connect_errors = @saved_max_connect_errors;
162 SET @@GLOBAL.debug_dbug = @saved_dbug;
163