File: password_reuse_check.test

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (100 lines) | stat: -rw-r--r-- 2,607 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
--source include/not_embedded.inc

if (!$PASSWORD_REUSE_CHECK_SO) {
  skip No PASSWORD_REUSE_CHECK plugin;
}

install soname "password_reuse_check";

set global password_reuse_check_interval= 0;

--echo # Default value (sould be unlimited i.e. 0)
SHOW GLOBAL VARIABLES like "password_reuse_check%";

--echo # insert user
grant select on *.* to user_name@localhost identified by 'test_pwd';

--error ER_NOT_VALID_PASSWORD
grant select on *.* to user_name@localhost identified by 'test_pwd';
show warnings;

--error ER_CANNOT_USER
alter user user_name@localhost identified by 'test_pwd';
show warnings;

# Plugin does not work for it
#--error ER_NOT_VALID_PASSWORD
#SET PASSWORD FOR user_name@localhost = PASSWORD('test_pwd');

--echo # check exparation

set global password_reuse_check_interval= 10;

--error ER_CANNOT_USER
alter user user_name@localhost identified by 'test_pwd';
show warnings;
select hex(hash) from mysql.password_reuse_check_history;

--echo # emulate old password
update mysql.password_reuse_check_history set time= date_sub(now(), interval
11 day);

alter user user_name@localhost identified by 'test_pwd';
show warnings;

drop user user_name@localhost;

show create table mysql.password_reuse_check_history;
select count(*) from mysql.password_reuse_check_history;

drop table mysql.password_reuse_check_history;

--echo # test error messages

set global password_reuse_check_interval= 0;

drop table if exists mysql.password_reuse_check_history;

--echo # test error messages

create table mysql.password_reuse_check_history (wrong_structure int);

--error ER_NOT_VALID_PASSWORD
grant select on *.* to user_name@localhost identified by 'test_pwd';
show warnings;

set global password_reuse_check_interval= 10;

--error ER_NOT_VALID_PASSWORD
grant select on *.* to user_name@localhost identified by 'test_pwd';
show warnings;

drop table mysql.password_reuse_check_history;

--echo #
--echo # MDEV-28838: password_reuse_check plugin mixes username and password
--echo #

grant select on *.* to user_name@localhost identified by 'test_pwd';

grant select on *.* to user_nam@localhost identified by 'etest_pwd';
show warnings;

drop user user_name@localhost;
drop user user_nam@localhost;
drop table mysql.password_reuse_check_history;

grant select on *.* to user_name@localhost identified by 'test_pwd';

grant select on *.* to tuser_name@localhos identified by 'test_pwd';
show warnings;

drop user user_name@localhost;
drop user tuser_name@localhos;

--echo #
--echo # End of 10.7 tests
--echo #

drop table mysql.password_reuse_check_history;
uninstall plugin password_reuse_check;