bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_shadow-utils/35-grpck-tests

Athmane Madjoudj 536354
#!/bin/bash
Athmane Madjoudj 536354
# Author: Iain Douglas <centos@1n6.org.uk>
Athmane Madjoudj 536354
Athmane Madjoudj 536354
echo "Running $0"
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# If we're on C5 delete the group 990991 which was added by newusers
Athmane Madjoudj 536354
if (( $centos_ver == 5 ))
Athmane Madjoudj 536354
then
Athmane Madjoudj 536354
    sed -i /990991/d /etc/group
Athmane Madjoudj 536354
fi
Athmane Madjoudj 536354
echo "Testing valid files"
Athmane Madjoudj 536354
[[ -e /etc/group ]] || { t_Log { "FAIL: /etc/group doesn't exist"; exit $FAIL; }
Athmane Madjoudj 536354
#Check system files
Athmane Madjoudj 536354
echo "Checking /etc files are correect"
Athmane Madjoudj 536354
grpck 
Athmane Madjoudj 536354
t_CheckExitStatus $? 
Athmane Madjoudj 536354
echo "Checking malformed files are detected"
Athmane Madjoudj 536354
Athmane Madjoudj 536354
echo "test:x::" >/var/tmp/gshadow
Athmane Madjoudj 536354
echo ":test:x:0::" >/var/tmp/group
Athmane Madjoudj 536354
grpck -r /var/tmp/group /var/tmp/gshadow && { t_Log "FAIL: Malformed files not detected"; exit $FAIL; }
Athmane Madjoudj 536354
t_Log "PASS"
Athmane Madjoudj 536354
rm /var/tmp/group /var/tmp/gshadow