bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_shadow-utils/40-pwck_tests

Athmane Madjoudj 536354
#!/bin/bash
Athmane Madjoudj 536354
# Author: Iain Douglas <centos@1n6.org.uk>
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# Even on a completely new clean system pwck fails because some accounts
Athmane Madjoudj 536354
# (e.g. adm) aren't created correctly so all we can really test is dummy 
Athmane Madjoudj 536354
# files. 
Athmane Madjoudj 536354
Christoph Galuschka 06c925
t_Log "Running $0"
Athmane Madjoudj 536354
Athmane Madjoudj 536354
echo "Check pwck passes correctly formed files"
Athmane Madjoudj 536354
echo "test:x:500:500::/tmp:/bin/bash" >/var/tmp/passwd
Athmane Madjoudj 536354
echo "test:$6$.vxxSAQB$4hvumoZoQ/83Z9PGKFYnFyEzFztcYky6zLUBKf/40MUTJzfzjWCHd/0bVdYXWc8OgyA31.:15656:0:99999:7:::" >/var/tmp/shadow
Athmane Madjoudj 536354
pwck -rq /var/tmp/passwd /var/tmp/shadow
Athmane Madjoudj 536354
t_CheckExitStatus "$?"
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# Check for malformed files
Athmane Madjoudj 536354
echo "Checking pwck detects malformed files"
Athmane Madjoudj 536354
echo ":test:x:500:500::/tmp:/bin/bash" >/var/tmp/passwd
Athmane Madjoudj 536354
echo "test:$6$.vxxSAQB$4hvumoZoQ/83Z9PGKFYnFyEzFztcYky6zLUBKf/40MUTJzfzjWCHd/0bVdYXWc8OgyA31.:15656:0:99999:7:::" >/var/tmp/shadow
Athmane Madjoudj 536354
pwck -rq /var/tmp/passwd /var/tmp/shadow && { t_Log "FAIL: Malformed files not detected"; exit $FAIL; }
Athmane Madjoudj 536354
t_Log "PASS"
Athmane Madjoudj 536354
rm /var/tmp/passwd /var/tmp/shadow