add user2user test
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19811 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -7,7 +7,7 @@ noinst_DATA = krb5.conf krb5-pkinit.conf
|
|||||||
check_PROGRAMS = ap-req
|
check_PROGRAMS = ap-req
|
||||||
check_SCRIPTS = $(SCRIPT_TESTS)
|
check_SCRIPTS = $(SCRIPT_TESTS)
|
||||||
|
|
||||||
SCRIPT_TESTS = check-kdc check-digest check-pkinit
|
SCRIPT_TESTS = check-kdc check-digest check-pkinit check-uu
|
||||||
TESTS = $(SCRIPT_TESTS)
|
TESTS = $(SCRIPT_TESTS)
|
||||||
|
|
||||||
do_subst = sed -e 's,[@]srcdir[@],$(srcdir),g' \
|
do_subst = sed -e 's,[@]srcdir[@],$(srcdir),g' \
|
||||||
@@ -21,6 +21,11 @@ check-kdc: check-kdc.in Makefile
|
|||||||
chmod +x check-kdc.tmp
|
chmod +x check-kdc.tmp
|
||||||
mv check-kdc.tmp check-kdc
|
mv check-kdc.tmp check-kdc
|
||||||
|
|
||||||
|
check-uu: check-uu.in Makefile
|
||||||
|
$(do_subst) < $(srcdir)/check-uu.in > check-uu.tmp
|
||||||
|
chmod +x check-uu.tmp
|
||||||
|
mv check-uu.tmp check-uu
|
||||||
|
|
||||||
check-pkinit: check-pkinit.in Makefile krb5-pkinit.conf
|
check-pkinit: check-pkinit.in Makefile krb5-pkinit.conf
|
||||||
$(do_subst) < $(srcdir)/check-pkinit.in > check-pkinit.tmp
|
$(do_subst) < $(srcdir)/check-pkinit.in > check-pkinit.tmp
|
||||||
chmod +x check-pkinit.tmp
|
chmod +x check-pkinit.tmp
|
||||||
@@ -48,6 +53,7 @@ CLEANFILES= \
|
|||||||
cdigest-reply \
|
cdigest-reply \
|
||||||
check-digest.tmp \
|
check-digest.tmp \
|
||||||
check-kdc.tmp \
|
check-kdc.tmp \
|
||||||
|
check-uu.tmp \
|
||||||
check-pkinit.tmp \
|
check-pkinit.tmp \
|
||||||
client-cache \
|
client-cache \
|
||||||
current-db* \
|
current-db* \
|
||||||
@@ -67,14 +73,17 @@ CLEANFILES= \
|
|||||||
pkinit.crt \
|
pkinit.crt \
|
||||||
kdc.crt \
|
kdc.crt \
|
||||||
ca.crt \
|
ca.crt \
|
||||||
|
uuserver.log \
|
||||||
tempfile
|
tempfile
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
check-kdc.in \
|
check-kdc.in \
|
||||||
|
check-uu.in \
|
||||||
check-pkinit.in \
|
check-pkinit.in \
|
||||||
check-digest.in \
|
check-digest.in \
|
||||||
krb5.conf.in \
|
krb5.conf.in \
|
||||||
krb5-pkinit.conf.in \
|
krb5-pkinit.conf.in \
|
||||||
wait-kdc.sh \
|
wait-kdc.sh \
|
||||||
pki-mapping
|
pki-mapping \
|
||||||
|
uuserver.txt
|
||||||
|
135
tests/kdc/check-uu.in
Normal file
135
tests/kdc/check-uu.in
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006 - 2007 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@"
|
||||||
|
EGREP="@EGREP@"
|
||||||
|
|
||||||
|
testfailed="echo test failed; cat messages.log; exit 1"
|
||||||
|
|
||||||
|
# If there is no useful db support compile in, disable test
|
||||||
|
../db/have-db || exit 77
|
||||||
|
|
||||||
|
R=TEST.H5L.SE
|
||||||
|
|
||||||
|
uuspid=
|
||||||
|
|
||||||
|
port=8888
|
||||||
|
|
||||||
|
kadmin="${TESTS_ENVIRONMENT} ../../kadmin/kadmin -l -r $R"
|
||||||
|
kdc="${TESTS_ENVIRONMENT} ../../kdc/kdc --addresses=localhost -P $port"
|
||||||
|
|
||||||
|
cache1="FILE:${objdir}/cache1.krb5"
|
||||||
|
cache2="FILE:${objdir}/cache2.krb5"
|
||||||
|
|
||||||
|
kinit1="${TESTS_ENVIRONMENT} ../../kuser/kinit -c $cache1 --no-afslog"
|
||||||
|
kinit2="${TESTS_ENVIRONMENT} ../../kuser/kinit -c $cache2 --no-afslog"
|
||||||
|
kdestroy1="${TESTS_ENVIRONMENT} ../../kuser/kdestroy -c $cache1 --no-unlog"
|
||||||
|
kdestroy2="${TESTS_ENVIRONMENT} ../../kuser/kdestroy -c $cache2 --no-unlog"
|
||||||
|
uu_server="${TESTS_ENVIRONMENT} ../../appl/test/uu_server"
|
||||||
|
uu_client="${TESTS_ENVIRONMENT} ../../appl/test/uu_client"
|
||||||
|
|
||||||
|
|
||||||
|
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 foo --use-defaults user1@${R} || exit 1
|
||||||
|
${kadmin} add -p foo --use-defaults user2@${R} || exit 1
|
||||||
|
|
||||||
|
echo "Doing database check"
|
||||||
|
${kadmin} check ${R} || exit 1
|
||||||
|
|
||||||
|
echo foo > ${objdir}/foopassword
|
||||||
|
|
||||||
|
echo Starting kdc
|
||||||
|
${kdc} &
|
||||||
|
kdcpid=$!
|
||||||
|
|
||||||
|
sh ${srcdir}/wait-kdc.sh
|
||||||
|
if [ "$?" != 0 ] ; then
|
||||||
|
kill ${kdcpid}
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
trap "kill ${kdcpid} ${uuspid}; echo signal killing kdc; exit 1;" EXIT
|
||||||
|
|
||||||
|
ec=0
|
||||||
|
|
||||||
|
echo "Getting client initial tickets user1"; > messages.log
|
||||||
|
${kinit1} --password-file=${objdir}/foopassword user1@$R || \
|
||||||
|
{ ec=1 ; eval "${testfailed}"; }
|
||||||
|
|
||||||
|
echo "Getting client initial tickets user2"; > messages.log
|
||||||
|
${kinit2} --password-file=${objdir}/foopassword user2@$R || \
|
||||||
|
{ ec=1 ; eval "${testfailed}"; }
|
||||||
|
|
||||||
|
|
||||||
|
echo "starting uu server (using user1)"
|
||||||
|
KRB5CCNAME=$cache1 ${uu_server} 2> uuserver.log &
|
||||||
|
uuspid=$!
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo "trying to contact server with client (using user2)"
|
||||||
|
KRB5CCNAME=$cache2 ${uu_client} localhost > /dev/null 2>/dev/null || \
|
||||||
|
{ ec=1; eval "${testfailed}"; }
|
||||||
|
|
||||||
|
echo "checking if server got the right message"
|
||||||
|
cmp uuserver.log ${srcdir}/uuserver.txt || \
|
||||||
|
{ ec=1; eval "${testfailed}"; }
|
||||||
|
|
||||||
|
uuspid=""
|
||||||
|
|
||||||
|
${kdestroy1}
|
||||||
|
${kdestroy2}
|
||||||
|
|
||||||
|
echo "killing kdc uu_server (${kdcpid} ${uuspid})"
|
||||||
|
kill $kdcpid $uuspid || exit 1
|
||||||
|
|
||||||
|
trap "" EXIT
|
||||||
|
|
||||||
|
exit $ec
|
4
tests/kdc/uuserver.txt
Normal file
4
tests/kdc/uuserver.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
User is `user2@TEST.H5L.SE'
|
||||||
|
Server is `user1@TEST.H5L.SE'
|
||||||
|
safe packet: hej
|
||||||
|
priv packet: hemligt
|
Reference in New Issue
Block a user