3 # Copyright (c) 2006 - 2008 Kungliga Tekniska Högskolan
4 # (Royal Institute of Technology, Stockholm, Sweden).
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
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
34 # $Id: check-context.in 22425 2008-01-13 09:46:01Z lha $
40 # If there is no useful db support compile in, disable test
41 ../db/have-db || exit 77
47 keytabfile=${objdir}/server.keytab
48 keytab="FILE:${keytabfile}"
49 cache="FILE:krb5ccfile"
51 kinit="${TESTS_ENVIRONMENT} ../../kuser/kinit -c $cache --no-afslog"
52 kadmin="${TESTS_ENVIRONMENT} ../../kadmin/kadmin -l -r $R"
53 kdc="${TESTS_ENVIRONMENT} ../../kdc/kdc --addresses=localhost -P $port"
55 context="${TESTS_ENVIRONMENT} ../../lib/gssapi/test_context"
57 KRB5_CONFIG="${objdir}/krb5.conf"
70 echo Creating database
73 --realm-max-ticket-life=1day \
74 --realm-max-renewable-life=1month \
77 # add both lucid and lucid.test.h5l.se to simulate aliases
78 ${kadmin} add -p p1 --use-defaults host/lucid.test.h5l.se@${R} || exit 1
79 ${kadmin} ext -k ${keytab} host/lucid.test.h5l.se@${R} || exit 1
80 ${kadmin} add -p p1 --use-defaults host/lucid@${R} || exit 1
81 ${kadmin} ext -k ${keytab} host/lucid@${R} || exit 1
82 ${kadmin} add -p kaka --use-defaults digest/${R}@${R} || exit 1
84 ${kadmin} add -p u1 --use-defaults user1@${R} || exit 1
86 echo "Doing database check"
87 ${kadmin} check ${R} || exit 1
89 echo u1 > ${objdir}/foopassword
95 sh ${srcdir}/../kdc/wait-kdc.sh
96 if [ "$?" != 0 ] ; then
101 trap "kill ${kdcpid}; echo signal killing kdc; exit 1;" EXIT
105 echo "Getting client initial tickets"
106 ${kinit} --password-file=${objdir}/foopassword user1@${R} || exitcode=1
108 echo "======test naming combinations"
110 ${context} --name-type=hostbased-service host@lucid.test.h5l.se || \
111 { exitcode=1 ; echo test failed; }
113 ${context} --name-type=krb5-principal-name host/lucid.test.h5l.se@${R} || \
114 { exitcode=1 ; echo test failed; }
115 echo "plain (krb5 realmless)"
116 ${context} --name-type=krb5-principal-name host/lucid.test.h5l.se || \
117 { exitcode=1 ; echo test failed; }
118 echo "dns canon on (long name) OFF, need dns_wrapper"
119 #${context} --dns-canon host@lucid.test.h5l.se || \
120 # { exitcode=1 ; echo test failed; }
121 echo "dns canon off (long name)"
122 ${context} --no-dns-canon host@lucid.test.h5l.se || \
123 { exitcode=1 ; echo test failed; }
124 echo "dns canon off (short name)"
125 ${context} --no-dns-canon host@lucid || \
126 { exitcode=1 ; echo test failed; }
127 echo "dns canon off (short name, krb5)"
128 ${context} --no-dns-canon --name-type=krb5-principal-name host/lucid@${R} || \
129 { exitcode=1 ; echo test failed; }
130 echo "dns canon off (short name, krb5)"
131 ${context} --no-dns-canon --name-type=krb5-principal-name host/lucid || \
132 { exitcode=1 ; echo test failed; }
134 echo "======test context building"
135 for mech in krb5 spnego ; do
136 echo "${mech} no-mutual"
137 ${context} --mech-type=${mech} \
138 --name-type=hostbased-service host@lucid.test.h5l.se || \
139 { exitcode=1 ; echo test failed; }
141 echo "${mech} mutual"
142 ${context} --mech-type=${mech} \
144 --name-type=hostbased-service host@lucid.test.h5l.se || \
145 { exitcode=1 ; echo test failed; }
147 echo "${mech} delegate"
148 ${context} --mech-type=${mech} \
150 --name-type=hostbased-service host@lucid.test.h5l.se || \
151 { exitcode=1 ; echo test failed; }
153 echo "${mech} mutual delegate"
154 ${context} --mech-type=${mech} \
155 --mutual --delegate \
156 --name-type=hostbased-service host@lucid.test.h5l.se || \
157 { exitcode=1 ; echo test failed; }
161 echo "======dce-style"
162 for mech in krb5 ; do
164 echo "${mech}: dce-style"
166 --mech-type=${mech} \
169 --name-type=hostbased-service host@lucid.test.h5l.se || \
170 { exitcode=1 ; echo test failed; }
174 #echo "sasl-digest-md5"
175 #${context} --mech-type=sasl-digest-md5 \
176 # --name-type=hostbased-service \
177 # host@lucid.test.h5l.se || \
178 # { exitcode=1 ; echo test failed; }
183 echo "killing kdc (${kdcpid})"
184 kill ${kdcpid} 2> /dev/null