Check if the gss context tester test_context works ok.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18425 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-10-12 11:42:15 +00:00
parent 27c513edcf
commit 5dcd51ca0f
2 changed files with 109 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ include $(top_srcdir)/Makefile.am.common
noinst_DATA = krb5.conf
SCRIPT_TESTS = check-gss check-gssmask
SCRIPT_TESTS = check-gss check-gssmask check-context
TESTS = $(SCRIPT_TESTS)
@@ -23,6 +23,11 @@ check-gssmask: check-gssmask.in Makefile
chmod +x check-gssmask.tmp
mv check-gssmask.tmp check-gssmask
check-context: check-context.in Makefile
$(do_subst) < $(srcdir)/check-context.in > check-context.tmp
chmod +x check-context.tmp
mv check-context.tmp check-context
krb5.conf: krb5.conf.in Makefile
$(do_subst) < $(srcdir)/krb5.conf.in > krb5.conf.tmp
mv krb5.conf.tmp krb5.conf
@@ -34,4 +39,5 @@ CLEANFILES= \
current-db* \
*.log \
check-gss.tmp \
check-gssmask.tmp
check-gssmask.tmp \
check-context.tmp

101
tests/gss/check-context.in Normal file
View File

@@ -0,0 +1,101 @@
#!/bin/sh
#
# Copyright (c) 2006 Kungliga Tekniska H<>gskolan
# (Royal Institute of Technology, Stockholm, Sweden).
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Institute nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Id$
#
srcdir="@srcdir@"
objdir="@objdir@"
R=EXAMPLE.ORG
port=8888
keytabfile=${objdir}/server.keytab
keytab="FILE:${keytabfile}"
cache="FILE:krb5ccfile"
kinit="${TESTS_ENVIRONMENT} ../../kuser/kinit -c $cache --no-afslog"
kadmin="${TESTS_ENVIRONMENT} ../../kadmin/kadmin -l -r $R"
kdc="${TESTS_ENVIRONMENT} ../../kdc/kdc --addresses=localhost -P $port"
context="env KRB5CCNAME=${cache} ${TESTS_ENVIRONMENT} ../../lib/gssapi/test_context"
KRB5_CONFIG="${objdir}/krb5.conf"
export KRB5_CONFIG
rm -f ${keytabfile}
rm -f current-db*
rm -f out-*
rm -f mkey.file*
echo Creating database
${kadmin} \
init \
--realm-max-ticket-life=1day \
--realm-max-renewable-life=1month \
${R} || exit 1
${kadmin} add -p p1 --use-defaults host/lucid.example.org@${R} || exit 1
${kadmin} ext -k ${keytab} host/lucid.example.org@${R} || exit 1
${kadmin} add -p u1 --use-defaults user1@${R} || exit 1
echo "Doing database check"
${kadmin} check ${R} || exit 1
echo u1 > ${objdir}/foopassword
echo Starting kdc
${kdc} &
kdcpid=$!
sh ${srcdir}/../kdc/wait-kdc.sh
if [ "$?" != 0 ] ; then
kill ${kdcpid}
exit 1
fi
exitcode=0
echo "Getting client initial tickets"
${kinit} --password-file=${objdir}/foopassword user1@${R} || exitcode=1
${context} host/lucid.example.org@${R} || exitcode=1
echo "killing kdc (${kdcpid})"
kill ${kdcpid} 2> /dev/null
exit $exitcode