File: 03_rename.sql

package info (click to toggle)
credcheck 4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 424 kB
  • sloc: ansic: 1,994; sql: 859; makefile: 21; sh: 1
file content (78 lines) | stat: -rwxr-xr-x 2,116 bytes parent folder | download | duplicates (2)
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
--suppress "MD5 password cleared because of role rename" messages
SET client_min_messages TO warning;

CREATE USER aaa PASSWORD 'DummY';
CREATE USER bbb;

LOAD 'credcheck';
--
--reset all settings
--
SET credcheck.username_min_length TO DEFAULT;
SET credcheck.username_min_special TO DEFAULT;
SET credcheck.username_min_upper TO DEFAULT;
SET credcheck.username_min_upper TO DEFAULT;
SET credcheck.username_min_digit TO DEFAULT;
SET credcheck.username_contain_password TO DEFAULT;
SET credcheck.username_ignore_case TO DEFAULT;
SET credcheck.username_contain TO DEFAULT;
SET credcheck.username_not_contain TO DEFAULT;
SET credcheck.username_min_repeat TO DEFAULT;
SET credcheck.password_min_length TO DEFAULT;
SET credcheck.password_min_special TO DEFAULT;
SET credcheck.password_min_upper TO DEFAULT;
SET credcheck.password_min_upper TO DEFAULT;
SET credcheck.password_min_digit TO DEFAULT;
SET credcheck.password_contain_username TO DEFAULT;
SET credcheck.password_ignore_case TO DEFAULT;
SET credcheck.password_contain TO DEFAULT;
SET credcheck.password_not_contain TO DEFAULT;
SET credcheck.password_min_repeat TO DEFAULT;

--
--length must be >=2
--
SET credcheck.username_min_length TO 2;
ALTER USER aaa RENAME TO b;
-- Check that renaiming a user without password also invoke the extension
ALTER USER bbb RENAME TO b;
DROP USER bbb;
CREATE USER b;

--
--min user repeat
--
SET credcheck.username_min_repeat TO 5;
ALTER USER aaa RENAME TO abbbaaaaaa;
--
--min special >= 1
--
SET credcheck.username_min_special TO 1;
ALTER USER aaa RENAME TO bbb;
--
--min upper >=1
--
SET credcheck.username_min_upper TO 1;
ALTER USER aaa RENAME TO "b$bb";
--
--min lower >=2
--
SET credcheck.username_min_lower TO 1;
ALTER USER aaa RENAME TO "B$BB";
--
--must contain one of the characters 'a','b','c'
--
SET credcheck.username_contain TO 'a,b,c';
ALTER USER aaa RENAME TO "d$eF";
--
--must not contain one of the characters 'x','z'
--
SET credcheck.username_not_contain TO 'x,z';
ALTER USER aaa RENAME TO "a$exF";
--
--min digit >=1
--
SET credcheck.username_min_digit TO 1;
ALTER USER aaa RENAME TO "a$eFD";

DROP USER aaa;