Debian Codegraph @

mysql-test/suite/perfschema/t/hostcache_ipv4_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/have_debug.inc
12 --source include/have_plugin_auth.inc
13
14 # Enforce a clean state
15 --source ../include/wait_for_pfs_thread_count.inc
16 --source ../include/hostcache_set_state.inc
17
18 CREATE USER 'plug'@'santa.claus.ipv4.example.com'
19 IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
20 CREATE USER 'plug_dest'@'santa.claus.ipv4.example.com'
21 IDENTIFIED BY 'plug_test_passwd';
22 GRANT SELECT ON test.* TO 'plug_dest'@'santa.claus.ipv4.example.com';
23
24 connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,);
25 select "Con1 is alive";
26 select current_user();
27 disconnect con1;
28
29 --connection default
30 set global debug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
31 uninstall plugin test_plugin_server;
32
33 --disable_query_log
34 --error ER_PLUGIN_IS_NOT_LOADED
35 connect (con2,"127.0.0.1",plug,plug_dest,test,$MASTER_MYPORT,,,auth_test_plugin);
36 --enable_query_log
37
38 --connection default
39 --source ../include/hostcache_dump.inc
40
41 --disable_query_log
42 --error ER_PLUGIN_IS_NOT_LOADED
43 connect (con3,"127.0.0.1",plug,plug_dest,test,$MASTER_MYPORT,,,auth_test_plugin);
44 --enable_query_log
45
46 --connection default
47 --source ../include/hostcache_dump.inc
48
49 --replace_result $PLUGIN_AUTH PLUGIN_AUTH
50 eval install plugin test_plugin_server soname '$PLUGIN_AUTH';
51
52 --disable_query_log
53 --error ER_ACCESS_DENIED_ERROR
54 connect (con2,"127.0.0.1",plug,plug_dest,test,$MASTER_MYPORT,,,auth_test_plugin);
55 --enable_query_log
56
57 --connection default
58 --source ../include/hostcache_dump.inc
59
60 --disable_query_log
61 --error ER_ACCESS_DENIED_ERROR
62 connect (con3,"127.0.0.1",plug,plug_dest,test,$MASTER_MYPORT,,,auth_test_plugin);
63 --enable_query_log
64
65 --connection default
66 --source ../include/hostcache_dump.inc
67
68 GRANT PROXY ON 'plug_dest'@'santa.claus.ipv4.example.com'
69 TO 'plug'@'santa.claus.ipv4.example.com';
70
71 connect (con4,"127.0.0.1",plug,plug_dest,test,$MASTER_MYPORT,,,auth_test_plugin);
72 select "Con4 is alive";
73 select user();
74 select current_user();
75 disconnect con4;
76
77 --connection default
78 --source ../include/hostcache_dump.inc
79
80 REVOKE ALL PRIVILEGES ON *.* FROM 'plug_dest'@'santa.claus.ipv4.example.com';
81 REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv4.example.com'
82 FROM 'plug'@'santa.claus.ipv4.example.com';
83 DROP USER 'plug'@'santa.claus.ipv4.example.com';
84 DROP USER 'plug_dest'@'santa.claus.ipv4.example.com';
85
86 set global debug= default;
87