Debian Codegraph @

tests/cktools/pwck/31_pwck_shadow_entry_passwd_no_x/pwck.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" "pwck checks that the password is set to x if there is a shadow entry"
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 "Check user database (pwck -r)..."
20 pwck -r >tmp/pwck.out && exit 1 || {
21 status=$?
22 }
23 echo "OK"
24
25 echo -n "Check returned status ($status)..."
26 test "$status" = "2"
27 echo "OK"
28
29 echo "pwck reported:"
30 echo "======================================================================="
31 cat tmp/pwck.out
32 echo "======================================================================="
33 echo -n "Check the report..."
34 diff -au data/pwck.out tmp/pwck.out
35 echo "report OK."
36 rm -f tmp/pwck.out
37
38 echo -n "Check the passwd file..."
39 ../../../common/compare_file.pl config/etc/passwd /etc/passwd
40 echo "OK"
41 echo -n "Check the group file..."
42 ../../../common/compare_file.pl config/etc/group /etc/group
43 echo "OK"
44 echo -n "Check the shadow file..."
45 ../../../common/compare_file.pl config/etc/shadow /etc/shadow
46 echo "OK"
47 echo -n "Check the gshadow file..."
48 ../../../common/compare_file.pl config/etc/gshadow /etc/gshadow
49 echo "OK"
50
51 log_status "$0" "SUCCESS"
52 restore_config
53 trap '' 0
54