blob: 9670bd7ac3f74fde0c96fd09ce840df44387fc28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/bin/bash
SRCDIR=$1
shift 1
[ -z "${SRCDIR}" ] && SRCDIR='.'
if test `id -u` -ne 0 ; then
echo "You need to be root to run the tests"
exit 1
fi
XTESTS="$@"
failed=0
pass=0
all=0
mkdir -p /etc/security
cp /etc/security/access.conf /etc/security/access.conf-pam-xtests
install -m 644 "${SRCDIR}"/access.conf /etc/security/access.conf
for testname in $XTESTS ; do
install -m 644 "${SRCDIR}"/$testname.pamd /etc/pam.d/$testname
if test -x "${SRCDIR}"/$testname.sh ; then
"${SRCDIR}"/$testname.sh > /dev/null
else
./$testname > /dev/null
fi
if test $? -ne 0 ; then
echo "FAIL: $testname"
failed=`expr $failed + 1`
else
echo "PASS: $testname"
pass=`expr $pass + 1`
fi
all=`expr $all + 1`
rm -f /etc/pam.d/$testname
done
mv /etc/security/access.conf-pam-xtests /etc/security/access.conf
if test "$failed" -ne 0; then
echo "==================="
echo "$failed of $all tests failed"
echo "==================="
exit 1
else
echo "=================="
echo "All $all tests passed"
echo "=================="
fi
exit 0
|