linux-pam/xtests/run-xtests.sh
Tomas Mraz 695f6e358d Relevant BUGIDs:
Purpose of commit: new feature

Commit summary:
---------------
2007-10-19  Tomas Mraz  <t8m@centrum.cz>

        * xtests/tst-pam_access1.c: Use different name for user and group.
        * xtests/tst-pam_access1.sh: Likewise.
        * xtests/tst-pam_access2.c: Likewise.
        * xtests/tst-pam_access2.sh: Likewise.
        * xtests/tst-pam_access4.c: Likewise.
        * xtests/tst-pam_access4.sh: Likewise.
        * xtests/group.conf: Likewise.
        * xtests/tst-pam_group1.c: Likewise.
        * xtests/tst-pam_group1.sh: Likewise.

        * libpam/pam_dispatch.c (_pam_dispatch_aux): Save states for substacks,
        record substack level, skip over virtual substack modules, implement
        evaluation of done, die, reset and jumps in substacks. Also fixes
        too far jumps in substacks.
        * libpam/pam_end.c (pam_end): Drop substack evaluation states.
        * libpam/pam_handlers.c (_pam_parse_conf_file): Add substack level
        parameter, instead of must_fail use handler_type needed for virtual
        substack modules.
        (_pam_load_conf_file): Add substack level parameter.
        (_pam_init_handlers): Substack level parameter added to
        _pam_parse_conf_file() calls.
        (_pam_load_module): New function.
        (_pam_add_handler): Refactor code into the _pam_load_module(). Add
        support for virtual substack modules.
        * libpam/pam_private.h: Rename must_fail to handler_type, add stack_level
        to struct handler. Define handler type constants. Add struct
        for substack evaluation states. Define constant for maximum
        substack level. Add substack states pointer to former state struct.
        * libpam/pam_start.c (pam_start): Initialize pointer to substack states.
        * doc/man/pam.conf-syntax.xml: Document substack control.
        * xtests/Makefile.am: Add new tests for substack evaluation.
        * xtests/run_xtests.sh: Support multiple .pamd files in a test.
        * xtests/tst-pam_authfail.pamd: New tests for substack evaluation.
        * xtests/tst-pam_authsucceed.pamd: Likewise.
        * xtests/tst-pam_substack1.pamd: Likewise.
        * xtests/tst-pam_substack1a.pamd: Likewise.
        * xtests/tst-pam_substack1.sh: Likewise.
        * xtests/tst-pam_substack2.pamd: Likewise.
        * xtests/tst-pam_substack2a.pamd: Likewise.
        * xtests/tst-pam_substack2.sh: Likewise.
        * xtests/tst-pam_substack3.pamd: Likewise.
        * xtests/tst-pam_substack3a.pamd: Likewise.
        * xtests/tst-pam_substack3.sh: Likewise.
        * xtests/tst-pam_substack4.pamd: Likewise.
        * xtests/tst-pam_substack4a.pamd: Likewise.
        * xtests/tst-pam_substack4.sh: Likewise.
        * xtests/tst-pam_substack5.pamd: Likewise.
        * xtests/tst-pam_substack5a.pamd: Likewise.
        * xtests/tst-pam_substack5.sh: Likewise.
2007-10-19 17:06:29 +00:00

65 lines
1.7 KiB
Bash
Executable File

#!/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
skiped=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
cp /etc/security/group.conf /etc/security/group.conf-pam-xtests
install -m 644 "${SRCDIR}"/group.conf /etc/security/group.conf
cp /etc/security/limits.conf /etc/security/limits.conf-pam-xtests
install -m 644 "${SRCDIR}"/limits.conf /etc/security/limits.conf
for testname in $XTESTS ; do
for cfg in "${SRCDIR}"/$testname*.pamd ; do
install -m 644 $cfg /etc/pam.d/$(basename $cfg .pamd)
done
if test -x "${SRCDIR}"/$testname.sh ; then
"${SRCDIR}"/$testname.sh > /dev/null
else
./$testname > /dev/null
fi
RETVAL=$?
if test $RETVAL -eq 77 ; then
echo "SKIP: $testname"
skiped=`expr $skiped + 1`
elif test $RETVAL -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
mv /etc/security/group.conf-pam-xtests /etc/security/group.conf
mv /etc/security/limits.conf-pam-xtests /etc/security/limits.conf
if test "$failed" -ne 0; then
echo "==================="
echo "$failed of $all tests failed"
echo "$skiped tests not run"
echo "==================="
exit 1
else
echo "=================="
echo "$all tests passed"
echo "$skiped tests not run"
echo "=================="
fi
exit 0