Debian Codegraph @

mysql-test/suite/plugins/t/password_reuse_check.test

raw
1 --source include/not_embedded.inc
2
3 if (!$PASSWORD_REUSE_CHECK_SO) {
4 skip No PASSWORD_REUSE_CHECK plugin;
5 }
6
7 install soname "password_reuse_check";
8
9 set global password_reuse_check_interval= 0;
10
11 --echo # Default value (sould be unlimited i.e. 0)
12 SHOW GLOBAL VARIABLES like "password_reuse_check%";
13
14 --echo # insert user
15 grant select on *.* to user_name@localhost identified by 'test_pwd';
16
17 --error ER_NOT_VALID_PASSWORD
18 grant select on *.* to user_name@localhost identified by 'test_pwd';
19 show warnings;
20
21 --error ER_CANNOT_USER
22 alter user user_name@localhost identified by 'test_pwd';
23 show warnings;
24
25 # Plugin does not work for it
26 #--error ER_NOT_VALID_PASSWORD
27 #SET PASSWORD FOR user_name@localhost = PASSWORD('test_pwd');
28
29 --echo # check exparation
30
31 set global password_reuse_check_interval= 10;
32
33 --error ER_CANNOT_USER
34 alter user user_name@localhost identified by 'test_pwd';
35 show warnings;
36 select hex(hash) from mysql.password_reuse_check_history;
37
38 --echo # emulate old password
39 update mysql.password_reuse_check_history set time= date_sub(now(), interval
40 11 day);
41
42 alter user user_name@localhost identified by 'test_pwd';
43 show warnings;
44
45 drop user user_name@localhost;
46
47 show create table mysql.password_reuse_check_history;
48 select count(*) from mysql.password_reuse_check_history;
49
50 drop table mysql.password_reuse_check_history;
51
52 --echo # test error messages
53
54 set global password_reuse_check_interval= 0;
55
56 drop table if exists mysql.password_reuse_check_history;
57
58 --echo # test error messages
59
60 create table mysql.password_reuse_check_history (wrong_structure int);
61
62 --error ER_NOT_VALID_PASSWORD
63 grant select on *.* to user_name@localhost identified by 'test_pwd';
64 show warnings;
65
66 set global password_reuse_check_interval= 10;
67
68 --error ER_NOT_VALID_PASSWORD
69 grant select on *.* to user_name@localhost identified by 'test_pwd';
70 show warnings;
71
72 drop table mysql.password_reuse_check_history;
73
74 --echo #
75 --echo # MDEV-28838: password_reuse_check plugin mixes username and password
76 --echo #
77
78 grant select on *.* to user_name@localhost identified by 'test_pwd';
79
80 grant select on *.* to user_nam@localhost identified by 'etest_pwd';
81 show warnings;
82
83 drop user user_name@localhost;
84 drop user user_nam@localhost;
85 drop table mysql.password_reuse_check_history;
86
87 grant select on *.* to user_name@localhost identified by 'test_pwd';
88
89 grant select on *.* to tuser_name@localhos identified by 'test_pwd';
90 show warnings;
91
92 drop user user_name@localhost;
93 drop user tuser_name@localhos;
94
95 --echo #
96 --echo # End of 10.7 tests
97 --echo #
98
99 drop table mysql.password_reuse_check_history;
100 uninstall plugin password_reuse_check;