| 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" "userdel reports failure to write /etc/subgid" |
| 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 "Delete user foo (userdel foo)..." |
| 20 |
LD_PRELOAD=../../../common/rename_failure.so FAILURE_PATH=/etc/subgid userdel foo 2>tmp/userdel.err && exit 1 || { |
| 21 |
status=$? |
| 22 |
} |
| 23 |
echo "OK" |
| 24 |
|
| 25 |
echo -n "Check returned status ($status)..." |
| 26 |
test "$status" = "18" |
| 27 |
echo "OK" |
| 28 |
|
| 29 |
echo "userdel reported:" |
| 30 |
echo "=======================================================================" |
| 31 |
cat tmp/userdel.err |
| 32 |
echo "=======================================================================" |
| 33 |
echo -n "Check that there were a failure message..." |
| 34 |
diff -au data/userdel.err tmp/userdel.err |
| 35 |
echo "error message OK." |
| 36 |
rm -f tmp/userdel.err |
| 37 |
|
| 38 |
echo -n "Check the passwd file..." |
| 39 |
../../../common/compare_file.pl data/passwd /etc/passwd |
| 40 |
echo "OK" |
| 41 |
echo -n "Check the group file..." |
| 42 |
../../../common/compare_file.pl data/group /etc/group |
| 43 |
echo "OK" |
| 44 |
echo -n "Check the shadow file..." |
| 45 |
../../../common/compare_file.pl data/shadow /etc/shadow |
| 46 |
echo "OK" |
| 47 |
echo -n "Check the gshadow file..." |
| 48 |
../../../common/compare_file.pl data/gshadow /etc/gshadow |
| 49 |
echo "OK" |
| 50 |
echo -n "Check the /etc/subgid file..." |
| 51 |
../../../common/compare_file.pl config/etc/subgid /etc/subgid |
| 52 |
echo "OK" |
| 53 |
echo -n "Check the /etc/subuid file..." |
| 54 |
../../../common/compare_file.pl data/subuid /etc/subuid |
| 55 |
echo "OK" |
| 56 |
|
| 57 |
log_status "$0" "SUCCESS" |
| 58 |
restore_config |
| 59 |
trap '' 0 |
| 60 |
|