xref: /minix3/crypto/external/bsd/heimdal/dist/tests/gss/check-gssmask.in (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc#!/bin/sh
2*ebfedea0SLionel Sambuc#
3*ebfedea0SLionel Sambuc# Copyright (c) 2006 Kungliga Tekniska Högskolan
4*ebfedea0SLionel Sambuc# (Royal Institute of Technology, Stockholm, Sweden).
5*ebfedea0SLionel Sambuc# All rights reserved.
6*ebfedea0SLionel Sambuc#
7*ebfedea0SLionel Sambuc# Redistribution and use in source and binary forms, with or without
8*ebfedea0SLionel Sambuc# modification, are permitted provided that the following conditions
9*ebfedea0SLionel Sambuc# are met:
10*ebfedea0SLionel Sambuc#
11*ebfedea0SLionel Sambuc# 1. Redistributions of source code must retain the above copyright
12*ebfedea0SLionel Sambuc#    notice, this list of conditions and the following disclaimer.
13*ebfedea0SLionel Sambuc#
14*ebfedea0SLionel Sambuc# 2. Redistributions in binary form must reproduce the above copyright
15*ebfedea0SLionel Sambuc#    notice, this list of conditions and the following disclaimer in the
16*ebfedea0SLionel Sambuc#    documentation and/or other materials provided with the distribution.
17*ebfedea0SLionel Sambuc#
18*ebfedea0SLionel Sambuc# 3. Neither the name of the Institute nor the names of its contributors
19*ebfedea0SLionel Sambuc#    may be used to endorse or promote products derived from this software
20*ebfedea0SLionel Sambuc#    without specific prior written permission.
21*ebfedea0SLionel Sambuc#
22*ebfedea0SLionel Sambuc# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23*ebfedea0SLionel Sambuc# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*ebfedea0SLionel Sambuc# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*ebfedea0SLionel Sambuc# ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26*ebfedea0SLionel Sambuc# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*ebfedea0SLionel Sambuc# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*ebfedea0SLionel Sambuc# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*ebfedea0SLionel Sambuc# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*ebfedea0SLionel Sambuc# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*ebfedea0SLionel Sambuc# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*ebfedea0SLionel Sambuc# SUCH DAMAGE.
33*ebfedea0SLionel Sambuc#
34*ebfedea0SLionel Sambuc# Id
35*ebfedea0SLionel Sambuc#
36*ebfedea0SLionel Sambuc
37*ebfedea0SLionel Sambucsrcdir="@srcdir@"
38*ebfedea0SLionel Sambucobjdir="@objdir@"
39*ebfedea0SLionel Sambuc
40*ebfedea0SLionel Sambuc# If there is no useful db support compile in, disable test
41*ebfedea0SLionel Sambuc../db/have-db || exit 77
42*ebfedea0SLionel Sambuc
43*ebfedea0SLionel SambucR=TEST.H5L.SE
44*ebfedea0SLionel Sambuc
45*ebfedea0SLionel Sambucport=@port@
46*ebfedea0SLionel Sambuc
47*ebfedea0SLionel Sambuckadmin="${TESTS_ENVIRONMENT} ../../kadmin/kadmin -l -r $R"
48*ebfedea0SLionel Sambuckdc="${TESTS_ENVIRONMENT} ../../kdc/kdc --addresses=localhost -P $port"
49*ebfedea0SLionel Sambuckeytabfile=${objdir}/server.keytab
50*ebfedea0SLionel Sambuckeytab="FILE:${keytabfile}"
51*ebfedea0SLionel Sambuc
52*ebfedea0SLionel Sambucgssmask="${TESTS_ENVIRONMENT} ../../appl/gssmask/gssmask"
53*ebfedea0SLionel Sambucgssmaskn1="${gssmask} -p 8889 --spn=host/n1.test.h5l.se@${R} --logfile=n1.log"
54*ebfedea0SLionel Sambucgssmaskn2="${gssmask} -p 8890 --spn=host/n2.test.h5l.se@${R} --logfile=n2.log"
55*ebfedea0SLionel Sambucgssmaskn3="${gssmask} -p 8891 --spn=host/n3.test.h5l.se@${R} --logfile=n3.log"
56*ebfedea0SLionel Sambucgssmaestro="../../appl/gssmask/gssmaestro"
57*ebfedea0SLionel Sambuc
58*ebfedea0SLionel SambucKRB5_CONFIG="${objdir}/krb5.conf"
59*ebfedea0SLionel Sambucexport KRB5_CONFIG
60*ebfedea0SLionel Sambuc
61*ebfedea0SLionel Sambucrm -f ${keytabfile}
62*ebfedea0SLionel Sambucrm -f current-db*
63*ebfedea0SLionel Sambucrm -f out-*
64*ebfedea0SLionel Sambucrm -f mkey.file*
65*ebfedea0SLionel Sambuc
66*ebfedea0SLionel Sambuc> messages.log
67*ebfedea0SLionel Sambuc
68*ebfedea0SLionel Sambucecho Creating database
69*ebfedea0SLionel Sambuc${kadmin} \
70*ebfedea0SLionel Sambuc    init \
71*ebfedea0SLionel Sambuc    --realm-max-ticket-life=1day \
72*ebfedea0SLionel Sambuc    --realm-max-renewable-life=1month \
73*ebfedea0SLionel Sambuc    ${R} || exit 1
74*ebfedea0SLionel Sambuc
75*ebfedea0SLionel Sambuc${kadmin} add -p p1 --use-defaults host/n1.test.h5l.se@${R} || exit 1
76*ebfedea0SLionel Sambuc${kadmin} add -p p2 --use-defaults host/n2.test.h5l.se@${R} || exit 1
77*ebfedea0SLionel Sambuc${kadmin} add -p p3 --use-defaults host/n3.test.h5l.se@${R} || exit 1
78*ebfedea0SLionel Sambuc${kadmin} ext -k ${keytab} host/n1.test.h5l.se@${R} || exit 1
79*ebfedea0SLionel Sambuc${kadmin} ext -k ${keytab} host/n2.test.h5l.se@${R} || exit 1
80*ebfedea0SLionel Sambuc${kadmin} ext -k ${keytab} host/n3.test.h5l.se@${R} || exit 1
81*ebfedea0SLionel Sambuc
82*ebfedea0SLionel Sambuc${kadmin} add -p u1 --use-defaults user1@${R} || exit 1
83*ebfedea0SLionel Sambuc
84*ebfedea0SLionel Sambucecho "Doing database check"
85*ebfedea0SLionel Sambuc${kadmin} check ${R} || exit 1
86*ebfedea0SLionel Sambuc
87*ebfedea0SLionel Sambucecho Starting kdc
88*ebfedea0SLionel Sambuc${kdc} &
89*ebfedea0SLionel Sambuckdcpid=$!
90*ebfedea0SLionel Sambuc
91*ebfedea0SLionel Sambucsh ${srcdir}/../kdc/wait-kdc.sh
92*ebfedea0SLionel Sambucif [ "$?" != 0 ] ; then
93*ebfedea0SLionel Sambuc    kill ${kdcpid}
94*ebfedea0SLionel Sambuc    exit 1
95*ebfedea0SLionel Sambucfi
96*ebfedea0SLionel Sambuc
97*ebfedea0SLionel Sambuctrap "kill ${kdcpid}; echo signal killing kdc; exit 1;" EXIT
98*ebfedea0SLionel Sambuc
99*ebfedea0SLionel Sambucexitcode=0
100*ebfedea0SLionel Sambuc
101*ebfedea0SLionel Sambucecho "Starting client 1"
102*ebfedea0SLionel Sambuc${gssmaskn1} --moniker=n1 &
103*ebfedea0SLionel Sambucn1pid=$!
104*ebfedea0SLionel Sambuc#echo $n1pid
105*ebfedea0SLionel Sambuc#xterm -display :0 -e g ${gssmaskn1} &
106*ebfedea0SLionel Sambuc#read x
107*ebfedea0SLionel Sambuc
108*ebfedea0SLionel Sambucecho "Starting client 2"
109*ebfedea0SLionel Sambuc${gssmaskn2} --moniker=n2 &
110*ebfedea0SLionel Sambucn2pid=$!
111*ebfedea0SLionel Sambuc
112*ebfedea0SLionel Sambucecho "Starting client 3"
113*ebfedea0SLionel Sambuc${gssmaskn3} --moniker=n3 &
114*ebfedea0SLionel Sambucn3pid=$!
115*ebfedea0SLionel Sambuc
116*ebfedea0SLionel Sambuctrap "kill ${kdcpid} ${n1pid} ${n2pid} ${n3pid} 2> /dev/null; echo signal killing kdc and maskar; exit 1;" EXIT
117*ebfedea0SLionel Sambuc
118*ebfedea0SLionel Sambucsleep 10
119*ebfedea0SLionel Sambuc
120*ebfedea0SLionel Sambuc#    --wrap-ext
121*ebfedea0SLionel Sambuc
122*ebfedea0SLionel Sambuc${gssmaestro} \
123*ebfedea0SLionel Sambuc    --slaves=localhost:8889 \
124*ebfedea0SLionel Sambuc    --slaves=localhost:8890 \
125*ebfedea0SLionel Sambuc    --slaves=localhost:8891 \
126*ebfedea0SLionel Sambuc    --principals=user1@${R}:u1 || exitcode=1
127*ebfedea0SLionel Sambuc
128*ebfedea0SLionel Sambuctrap "" EXIT
129*ebfedea0SLionel Sambuc
130*ebfedea0SLionel Sambucecho "killing kdc and clients (${kdcpid}, ${n1pid}, ${n2pid}, ${n3pid})"
131*ebfedea0SLionel Sambuckill ${kdcpid} ${n1pid} ${n2pid} ${n3pid} 2> /dev/null
132*ebfedea0SLionel Sambuc
133*ebfedea0SLionel Sambucexit $exitcode
134*ebfedea0SLionel Sambuc
135*ebfedea0SLionel Sambuc
136