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