6 files changed +50
-1
lines changed Original file line number Diff line number Diff line change
1
+ # Generated subdirectories
2
+ /log /
3
+ /results /
4
+ /tmp_check /
Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ PGFILEDESC = "passwordcheck - strengthen user password checks"
8
8
# PG_CPPFLAGS = -DUSE_CRACKLIB '-DCRACKLIB_DICTPATH="/usr/lib/cracklib_dict"'
9
9
# SHLIB_LINK = -lcrack
10
10
11
+ REGRESS_OPTS = --temp-config $(srcdir ) /passwordcheck.conf
12
+ REGRESS = passwordcheck
13
+ # disabled because these tests require setting shared_preload_libraries
14
+ NO_INSTALLCHECK = 1
15
+
11
16
ifdef USE_PGXS
12
17
PG_CONFIG = pg_config
13
18
PGXS := $(shell $(PG_CONFIG ) --pgxs)
Original file line number Diff line number Diff line change
1
+ CREATE USER regress_user1;
2
+ -- ok
3
+ ALTER USER regress_user1 PASSWORD 'a_nice_long_password';
4
+ -- error: too short
5
+ ALTER USER regress_user1 PASSWORD 'tooshrt';
6
+ ERROR: password is too short
7
+ -- error: contains user name
8
+ ALTER USER regress_user1 PASSWORD 'xyzregress_user1';
9
+ ERROR: password must not contain user name
10
+ -- error: contains only letters
11
+ ALTER USER regress_user1 PASSWORD 'alessnicelongpassword';
12
+ ERROR: password must contain both letters and nonletters
13
+ -- encrypted ok (password is "secret")
14
+ ALTER USER regress_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
15
+ -- error: password is user name
16
+ ALTER USER regress_user1 PASSWORD 'md5e589150ae7d28f93333afae92b36ef48';
17
+ ERROR: password must not equal user name
18
+ DROP USER regress_user1;
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ check_password(const char *username,
70
70
if (plain_crypt_verify (username , shadow_pass , username , & logdetail ) == STATUS_OK )
71
71
ereport (ERROR ,
72
72
(errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
73
- errmsg ("password must not contain user name" )));
73
+ errmsg ("password must not equal user name" )));
74
74
}
75
75
else
76
76
{
Original file line number Diff line number Diff line change
1
+ shared_preload_libraries = 'passwordcheck'
Original file line number Diff line number Diff line change
1
+ CREATE USER regress_user1 ;
2
+
3
+ -- ok
4
+ ALTER USER regress_user1 PASSWORD ' a_nice_long_password' ;
5
+
6
+ -- error: too short
7
+ ALTER USER regress_user1 PASSWORD ' tooshrt' ;
8
+
9
+ -- error: contains user name
10
+ ALTER USER regress_user1 PASSWORD ' xyzregress_user1' ;
11
+
12
+ -- error: contains only letters
13
+ ALTER USER regress_user1 PASSWORD ' alessnicelongpassword' ;
14
+
15
+ -- encrypted ok (password is "secret")
16
+ ALTER USER regress_user1 PASSWORD ' md51a44d829a20a23eac686d9f0d258af13' ;
17
+
18
+ -- error: password is user name
19
+ ALTER USER regress_user1 PASSWORD ' md5e589150ae7d28f93333afae92b36ef48' ;
20
+
21
+ DROP USER regress_user1;
0 commit comments