Expand PMF_FN_* macros.
[netbsd-mini2440.git] / crypto / dist / heimdal / tests / gss / check-context.in
blob0b727f028da85d2d8e5b7c1bc90d30daf2bc3531
1 #!/bin/sh
3 # Copyright (c) 2006 - 2008 Kungliga Tekniska Högskolan
4 # (Royal Institute of Technology, Stockholm, Sweden).
5 # All rights reserved.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
18 # 3. Neither the name of the Institute nor the names of its contributors
19 # may be used to endorse or promote products derived from this software
20 # without specific prior written permission.
22 # THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 # ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 # SUCH DAMAGE.
34 # $Heimdal: check-context.in 22425 2008-01-13 09:46:01Z lha $
35 # $NetBSD$
38 srcdir="@srcdir@"
39 objdir="@objdir@"
41 # If there is no useful db support compile in, disable test
42 ../db/have-db || exit 77
44 R=TEST.H5L.SE
46 port=@port@
48 keytabfile=${objdir}/server.keytab
49 keytab="FILE:${keytabfile}"
50 cache="FILE:krb5ccfile"
52 kinit="${TESTS_ENVIRONMENT} ../../kuser/kinit -c $cache --no-afslog"
53 kadmin="${TESTS_ENVIRONMENT} ../../kadmin/kadmin -l -r $R"
54 kdc="${TESTS_ENVIRONMENT} ../../kdc/kdc --addresses=localhost -P $port"
56 context="${TESTS_ENVIRONMENT} ../../lib/gssapi/test_context"
58 KRB5_CONFIG="${objdir}/krb5.conf"
59 export KRB5_CONFIG
61 KRB5CCNAME=${cache}
62 export KRB5CCNAME
64 rm -f ${keytabfile}
65 rm -f current-db*
66 rm -f out-*
67 rm -f mkey.file*
69 > messages.log
71 echo Creating database
72 ${kadmin} \
73 init \
74 --realm-max-ticket-life=1day \
75 --realm-max-renewable-life=1month \
76 ${R} || exit 1
78 # add both lucid and lucid.test.h5l.se to simulate aliases
79 ${kadmin} add -p p1 --use-defaults host/lucid.test.h5l.se@${R} || exit 1
80 ${kadmin} ext -k ${keytab} host/lucid.test.h5l.se@${R} || exit 1
81 ${kadmin} add -p p1 --use-defaults host/lucid@${R} || exit 1
82 ${kadmin} ext -k ${keytab} host/lucid@${R} || exit 1
83 ${kadmin} add -p kaka --use-defaults digest/${R}@${R} || exit 1
85 ${kadmin} add -p u1 --use-defaults user1@${R} || exit 1
87 echo "Doing database check"
88 ${kadmin} check ${R} || exit 1
90 echo u1 > ${objdir}/foopassword
92 echo Starting kdc
93 ${kdc} &
94 kdcpid=$!
96 sh ${srcdir}/../kdc/wait-kdc.sh
97 if [ "$?" != 0 ] ; then
98 kill ${kdcpid}
99 exit 1
102 trap "kill ${kdcpid}; echo signal killing kdc; exit 1;" EXIT
104 exitcode=0
106 echo "Getting client initial tickets"
107 ${kinit} --password-file=${objdir}/foopassword user1@${R} || exitcode=1
109 echo "======test naming combinations"
110 echo "plain"
111 ${context} --name-type=hostbased-service host@lucid.test.h5l.se || \
112 { exitcode=1 ; echo test failed; }
113 echo "plain (krb5)"
114 ${context} --name-type=krb5-principal-name host/lucid.test.h5l.se@${R} || \
115 { exitcode=1 ; echo test failed; }
116 echo "plain (krb5 realmless)"
117 ${context} --name-type=krb5-principal-name host/lucid.test.h5l.se || \
118 { exitcode=1 ; echo test failed; }
119 echo "dns canon on (long name) OFF, need dns_wrapper"
120 #${context} --dns-canon host@lucid.test.h5l.se || \
121 # { exitcode=1 ; echo test failed; }
122 echo "dns canon off (long name)"
123 ${context} --no-dns-canon host@lucid.test.h5l.se || \
124 { exitcode=1 ; echo test failed; }
125 echo "dns canon off (short name)"
126 ${context} --no-dns-canon host@lucid || \
127 { exitcode=1 ; echo test failed; }
128 echo "dns canon off (short name, krb5)"
129 ${context} --no-dns-canon --name-type=krb5-principal-name host/lucid@${R} || \
130 { exitcode=1 ; echo test failed; }
131 echo "dns canon off (short name, krb5)"
132 ${context} --no-dns-canon --name-type=krb5-principal-name host/lucid || \
133 { exitcode=1 ; echo test failed; }
135 echo "======test context building"
136 for mech in krb5 spnego ; do
137 echo "${mech} no-mutual"
138 ${context} --mech-type=${mech} \
139 --name-type=hostbased-service host@lucid.test.h5l.se || \
140 { exitcode=1 ; echo test failed; }
142 echo "${mech} mutual"
143 ${context} --mech-type=${mech} \
144 --mutual \
145 --name-type=hostbased-service host@lucid.test.h5l.se || \
146 { exitcode=1 ; echo test failed; }
148 echo "${mech} delegate"
149 ${context} --mech-type=${mech} \
150 --delegate \
151 --name-type=hostbased-service host@lucid.test.h5l.se || \
152 { exitcode=1 ; echo test failed; }
154 echo "${mech} mutual delegate"
155 ${context} --mech-type=${mech} \
156 --mutual --delegate \
157 --name-type=hostbased-service host@lucid.test.h5l.se || \
158 { exitcode=1 ; echo test failed; }
159 done
161 #add spnego !
162 echo "======dce-style"
163 for mech in krb5 ; do
165 echo "${mech}: dce-style"
166 ${context} \
167 --mech-type=${mech} \
168 --mutual \
169 --dce-style \
170 --name-type=hostbased-service host@lucid.test.h5l.se || \
171 { exitcode=1 ; echo test failed; }
173 done
175 #echo "sasl-digest-md5"
176 #${context} --mech-type=sasl-digest-md5 \
177 # --name-type=hostbased-service \
178 # host@lucid.test.h5l.se || \
179 # { exitcode=1 ; echo test failed; }
182 trap "" EXIT
184 echo "killing kdc (${kdcpid})"
185 kill ${kdcpid} 2> /dev/null
187 exit $exitcode