Debian Codegraph @

mysql-test/suite/x/t/connection_auth_mechanism_memory_with_invalidation.test

raw
1 ## Test cases for authorization plugins
2
3 --source include/xplugin_preamble.inc
4
5 #
6 ## Setup
7 #
8
9 --write_file $MYSQL_TMP_DIR/change_passwords_and_login_using_memory.xpl
10 -->import connection_auth_mechanism_memory_helpers.macro
11
12 -->echo
13 -->echo #######################################################################
14 -->echo ## Fill cache with all xuser_* accounts
15 -->echo #
16 -->callmacro Login_all_xusers_using_plain_to_fill_the_cache
17
18 -->echo
19 -->echo #######################################################################
20 -->echo ## Check if the account entries are removed after changing the account.
21 -->echo #
22 -->callmacro Login_ok DISABLED memory xuser_native native
23 -->stmtsql ALTER USER xuser_native@localhost IDENTIFIED BY 'native2';
24 -->recvresult
25 -->callmacro Login_failed DISABLED memory xuser_native native
26 -->callmacro Login_failed DISABLED memory xuser_native native2
27
28 -->callmacro Login_ok DISABLED memory xuser_sha256 sha256
29 -->stmtsql RENAME USER xuser_sha256@localhost TO xuser_sha2@localhost;
30 -->recvresult
31 -->callmacro Login_failed DISABLED memory xuser_sha2 sha256
32 -->callmacro Login_failed DISABLED memory xuser_sha256 sha256
33
34 -->callmacro Login_ok DISABLED memory xuser_cache2 cache2
35 -->stmtsql DROP USER xuser_cache2@localhost;
36 -->recvresult
37 -->callmacro Login_failed DISABLED memory xuser_cache2 cache2
38
39 -->echo
40 -->echo #######################################################################
41 -->echo ## Go back to orginal settings
42 -->echo #
43 -->sql
44 ALTER USER xuser_native@localhost IDENTIFIED BY 'native';
45 RENAME USER xuser_sha2@localhost TO xuser_sha256@localhost;
46 CREATE USER xuser_cache2@localhost IDENTIFIED WITH 'caching_sha2_password' BY 'cache2';
47 GRANT ALL ON *.* TO xuser_cache2@localhost;
48 -->endsql
49
50
51 -->echo
52 -->echo #######################################################################
53 -->echo ## Fill cache again
54 -->echo #
55 -->callmacro Login_all_xusers_using_plain_to_fill_the_cache
56
57 -->callmacro Login_ok DISABLED memory xuser_native native
58 -->stmtsql SET PASSWORD FOR 'xuser_native'@'localhost' = 'native3';
59 -->recvresult
60 -->callmacro Login_failed DISABLED memory xuser_native native3
61 -->callmacro Login_failed DISABLED memory xuser_native native
62
63 -->callmacro Login_ok DISABLED memory xuser_sha256 sha256
64 -->sql
65 GRANT SELECT,LOCK TABLES ON *.* TO xuser_sha256@'localhost';
66 SET PASSWORD FOR 'xuser_sha256'@'localhost' = 'sha256_new';
67 -->endsql
68 -->callmacro Login_failed DISABLED memory xuser_sha256 sha256
69 -->callmacro Login_failed DISABLED memory xuser_sha256 sha256_new
70 EOF
71
72 --let $MYSQLXTEST=$MYSQLXTEST -uroot --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256'
73
74 # Create and configure xuser_* accounts that use native, sha256 and
75 # cache_sha2 authentication plugins.
76
77 --source ../include/create_mysql_accounts_for_xplugin_tests.inc
78
79 GRANT ALL ON *.* TO xuser_native@localhost;
80 GRANT ALL ON *.* TO xuser_sha256@localhost;
81 GRANT ALL ON *.* TO xuser_cache2@localhost;
82
83
84 #
85 ## Test starts here
86 #
87
88 --echo
89 --echo #######################################################################
90 --echo ## 1. Memory mechanism fails after altering an account
91 --echo ##
92 --echo ## when:
93 --echo ## * plain auth is going to fill the cache
94 --echo ## * next test is going that ALTER USER, RENAME USER, DROP USER
95 --echo ## clears the case
96 --echo ##
97 --echo ## Requirements: CI1, CI3, CI4, CI5
98 --echo #
99
100 exec $MYSQLXTEST --file=$MYSQL_TMP_DIR/change_passwords_and_login_using_memory.xpl 2>&1;
101
102
103 #
104 # Postamble
105 #
106 --source ../include/xplugin_cleanup.inc
107
108 --source ../include/remove_mysql_accounts_for_xplugin_tests.inc