| 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" "root can unlock a password with passwd -u" |
| 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 "unlock foo's password (passwd -u foo)..." |
| 20 |
passwd -u foo > tmp/passwd.out |
| 21 |
echo "OK" |
| 22 |
|
| 23 |
echo "passwd reported:" |
| 24 |
echo "=======================================================================" |
| 25 |
cat tmp/passwd.out |
| 26 |
echo "=======================================================================" |
| 27 |
echo -n "Check the message..." |
| 28 |
diff -au data/passwd.out tmp/passwd.out |
| 29 |
echo "message OK." |
| 30 |
rm -f tmp/passwd.out |
| 31 |
|
| 32 |
echo -n "Check the passwd file..." |
| 33 |
../../common/compare_file.pl config/etc/passwd /etc/passwd |
| 34 |
echo "OK" |
| 35 |
echo -n "Check the group file..." |
| 36 |
../../common/compare_file.pl config/etc/group /etc/group |
| 37 |
echo "OK" |
| 38 |
echo -n "Check the shadow file..." |
| 39 |
../../common/compare_file.pl data/shadow /etc/shadow |
| 40 |
echo "OK" |
| 41 |
echo -n "Check the gshadow file..." |
| 42 |
../../common/compare_file.pl config/etc/gshadow /etc/gshadow |
| 43 |
echo "OK" |
| 44 |
|
| 45 |
log_status "$0" "SUCCESS" |
| 46 |
restore_config |
| 47 |
trap '' 0 |
| 48 |
|