Debian Codegraph @

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

raw
1
2 #
3 # Tests for the performance_schema host_cache.
4 #
5 # Test authorization with auth plugins.
6 # error reporting in:
7 # - column COUNT_AUTH_PLUGIN_ERRORS
8 # - column COUNT_PROXY_USER_ERRORS
9 # - column COUNT_PROXY_USER_ACL_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 --source include/have_hostname_cache.inc
16 --source include/have_plugin_auth.inc
17
18 # Enforce a clean state
19 --source ../include/wait_for_pfs_thread_count.inc
20 --source ../include/hostcache_set_state.inc
21
22 CREATE USER 'plug'@'santa.claus.ipv6.example.com'
23 IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
24 CREATE USER 'plug_dest'@'santa.claus.ipv6.example.com'
25 IDENTIFIED BY 'plug_test_passwd';
26 GRANT SELECT ON test.* TO 'plug_dest'@'santa.claus.ipv6.example.com';
27
28 connect (con1,"::1",root,,test,$MASTER_MYPORT,);
29 select "Con1 is alive";
30 select current_user();
31 disconnect con1;
32
33 --connection default
34 SET @saved_dbug = @@GLOBAL.debug_dbug;
35 set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
36 uninstall plugin test_plugin_server;
37
38 --disable_query_log
39 --error ER_PLUGIN_IS_NOT_LOADED
40 connect (con2,"::1",plug,plug_dest,test,$MASTER_MYPORT,,,auth_test_plugin);
41 --enable_query_log
42
43 --connection default
44 --source ../include/hostcache_dump.inc
45
46 --disable_query_log
47 --error ER_PLUGIN_IS_NOT_LOADED
48 connect (con3,"::1",plug,plug_dest,test,$MASTER_MYPORT,,,auth_test_plugin);
49 --enable_query_log
50
51 --connection default
52 --source ../include/hostcache_dump.inc
53
54 --replace_result $AUTH_TEST_PLUGIN_SO PLUGIN_AUTH
55 eval install plugin test_plugin_server soname '$AUTH_TEST_PLUGIN_SO';
56
57 --disable_query_log
58 --error ER_ACCESS_DENIED_ERROR
59 connect (con2,"::1",plug,plug_dest,test,$MASTER_MYPORT,,,auth_test_plugin);
60 --enable_query_log
61
62 --connection default
63 --source ../include/hostcache_dump.inc
64
65 --disable_query_log
66 --error ER_ACCESS_DENIED_ERROR
67 connect (con3,"::1",plug,plug_dest,test,$MASTER_MYPORT,,,auth_test_plugin);
68 --enable_query_log
69
70 --connection default
71 --source ../include/hostcache_dump.inc
72
73 GRANT PROXY ON 'plug_dest'@'santa.claus.ipv6.example.com'
74 TO 'plug'@'santa.claus.ipv6.example.com';
75
76 connect (con4,"::1",plug,plug_dest,test,$MASTER_MYPORT,,,auth_test_plugin);
77 select "Con4 is alive";
78 select user();
79 select current_user();
80 disconnect con4;
81
82 --connection default
83 --source ../include/hostcache_dump.inc
84
85 REVOKE ALL PRIVILEGES ON *.* FROM 'plug_dest'@'santa.claus.ipv6.example.com';
86 REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv6.example.com'
87 FROM 'plug'@'santa.claus.ipv6.example.com';
88 DROP USER 'plug'@'santa.claus.ipv6.example.com';
89 DROP USER 'plug_dest'@'santa.claus.ipv6.example.com';
90
91 SET @@GLOBAL.debug_dbug = @saved_dbug;
92 delete from mysql.plugin where name='test_plugin_server';
93