Debian Codegraph @

tests/usertools/chpasswd-PAM/03_chpasswd_no_shadow_file/chpasswd.test

raw
1 #!/bin/sh
2
3 set -e
4
5 cd $(dirname $0)
6
7 . ../../../common/config.sh
8 . ../../../common/log.sh
9
10 log_start "$0" "chpasswd changes the passwd file if shadow does not exist"
11
12 save_config
13
14 # restore the files on exit
15 trap 'log_status "$0" "FAILURE"; restore_config' 0
16
17 change_config
18
19 echo -n "Remove /etc/shadow..."
20 rm -f /etc/shadow
21 echo "OK"
22
23 echo -n "Change nobody's and lp's password..."
24 echo 'nobody:test
25 lp:test2' | chpasswd
26 echo "OK"
27
28 echo -n "Check the passwd file..."
29 ../../../common/compare_file.pl data/passwd /etc/passwd
30 echo "OK"
31 echo -n "Check the group file..."
32 ../../../common/compare_file.pl config/etc/group /etc/group
33 echo "OK"
34 echo -n "Check that shadow does not exist..."
35 test ! -f /etc/shadow
36 echo "OK"
37 echo -n "Check the gshadow file..."
38 ../../../common/compare_file.pl config/etc/gshadow /etc/gshadow
39 echo "OK"
40
41 log_status "$0" "SUCCESS"
42 restore_config
43 trap '' 0
44