3 # Copyright (c) 2006 - 2007 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 top_builddir
="@top_builddir@"
35 env_setup
="@env_setup@"
41 # If there is no useful db support compile in, disable test
50 cache
="FILE:${objdir}/cache.krb5"
52 kadmin
="${kadmin} -r $R"
53 kdc
="${kdc} --addresses=localhost -P $port"
54 kadmind
="${kadmind} -p $admport"
56 server
=host
/datan.
test.h5l.se
58 kinit
="${kinit} -c $cache ${afs_no_afslog}"
59 kgetcred
="${kgetcred} -c $cache"
60 kdestroy
="${kdestroy} -c $cache ${afs_no_unlog}"
62 KRB5_CONFIG
="${objdir}/krb5.conf"
73 echo Creating database
76 --realm-max-ticket-life=1day \
77 --realm-max-renewable-life=1month \
80 ${kadmin} -l add
-p foo
--use-defaults foo
/admin@
${R} ||
exit 1
81 ${kadmin} -l add
-p foo
--use-defaults bar@
${R} ||
exit 1
82 ${kadmin} -l add
-p foo
--use-defaults baz@
${R} ||
exit 1
83 ${kadmin} -l add
-p foo
--use-defaults bez@
${R} ||
exit 1
84 ${kadmin} -l add
-p foo
--use-defaults fez@
${R} ||
exit 1
85 ${kadmin} -l add
-p foo
--use-defaults pkinit@
${R} ||
exit 1
86 ${kadmin} -l modify
--pkinit-acl="CN=baz,DC=test,DC=h5l,DC=se" pkinit@
${R} ||
exit 1
88 echo foo
> ${objdir}/foopassword
95 if [ "$?" != 0 ] ; then
101 trap "kill -9 ${kdcpid} ${kadmpid}" EXIT
103 #----------------------------------
108 echo "kinit (no admin)"
109 ${kinit} --password-file=${objdir}/foopassword \
110 -S kadmin
/admin@
${R} bar@
${R} ||
exit 1
112 env KRB5CCNAME
=${cache} \
113 ${kadmin} -p bar@${R} add -p foo --use-defaults kaka2@${R} ||
114 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
116 ${kadmin} -l get kaka2@
${R} > /dev
/null ||
117 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
119 #----------------------------------
124 echo "kinit (no admin)"
125 ${kinit} --password-file=${objdir}/foopassword \
126 -S kadmin
/admin@
${R} baz@
${R} ||
exit 1
127 echo "kadmin globacl"
128 env KRB5CCNAME
=${cache} \
129 ${kadmin} -p baz@${R} get bar@${R} > /dev
/null ||
130 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
132 #----------------------------------
137 echo "kinit (no admin)"
138 ${kinit} --password-file=${objdir}/foopassword \
139 -S kadmin
/admin@
${R} baz@
${R} ||
exit 1
140 echo "kadmin globacl, negative"
141 env KRB5CCNAME
=${cache} \
142 ${kadmin} -p baz@${R} passwd -p foo bar@${R} > /dev
/null
2>/dev
/null
&&
143 { echo "kadmin succesded $?"; cat messages.log
; exit 1; }
145 #----------------------------------
150 echo "kinit (no admin)"
151 ${kinit} --password-file=${objdir}/foopassword \
152 -S kadmin
/admin@
${R} baz@
${R} ||
exit 1
153 echo "kadmin globacl"
154 env KRB5CCNAME
=${cache} \
155 ${kadmin} -p baz@${R} get bar@${R} > /dev
/null ||
156 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
158 #----------------------------------
163 echo "kinit (no admin)"
164 ${kinit} --password-file=${objdir}/foopassword \
165 -S kadmin
/admin@
${R} bez@
${R} ||
exit 1
166 echo "kadmin globacl, negative"
167 env KRB5CCNAME
=${cache} \
168 ${kadmin} -p bez@${R} passwd -p foo bar@${R} > /dev
/null
2>/dev
/null
&&
169 { echo "kadmin succesded $?"; cat messages.log
; exit 1; }
171 #----------------------------------
176 echo "kinit (no admin)"
177 ${kinit} --password-file=${objdir}/foopassword \
178 -S kadmin
/admin@
${R} fez@
${R} ||
exit 1
179 echo "kadmin globacl"
180 env KRB5CCNAME
=${cache} \
181 ${kadmin} -p fez@${R} get bar@${R} > /dev
/null ||
182 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
184 #----------------------------------
189 echo "kinit (no admin)"
190 ${kinit} --password-file=${objdir}/foopassword \
191 -S kadmin
/admin@
${R} fez@
${R} ||
exit 1
192 echo "kadmin globacl, negative"
193 env KRB5CCNAME
=${cache} \
194 ${kadmin} -p fez@${R} passwd -p foo bar@${R} > /dev
/null
2>/dev
/null
&&
195 { echo "kadmin succesded $?"; cat messages.log
; exit 1; }
197 #----------------------------------
203 ${kinit} --password-file=${objdir}/foopassword \
204 -S kadmin
/admin@
${R} foo
/admin@
${R} ||
exit 1
207 env KRB5CCNAME
=${cache} \
208 ${kadmin} -p foo/admin@${R} add -p foo --use-defaults kaka@${R} ||
209 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
211 #----------------------------------
216 echo "kadmin get doesnotexists"
217 env KRB5CCNAME
=${cache} \
218 ${kadmin} -p foo/admin@${R} get -s doesnotexists@${R} \
219 > /dev
/null
2>kadmin.tmp
&& \
220 { echo "kadmin passed"; cat messages.log
; exit 1; }
222 # evil hack to support libtool
223 sed 's/lt-kadmin:/kadmin:/' < kadmin.tmp
> kadmin2.tmp
224 mv kadmin2.tmp kadmin.tmp
226 # If client tried IPv6, but service only listened on IPv4
227 grep -v ': connect' kadmin.tmp
> kadmin2.tmp
228 mv kadmin2.tmp kadmin.tmp
230 cmp kadmin.tmp
${srcdir}/donotexists.txt || \
231 { echo "wrong response"; exit 1;}
233 #----------------------------------
238 echo "kadmin get pkinit-acl"
239 env KRB5CCNAME
=${cache} \
240 ${kadmin} -p foo/admin@${R} get -o pkinit-acl pkinit@${R} \
242 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
244 #----------------------------------
249 echo "kadmin get -o principal"
250 env KRB5CCNAME
=${cache} \
251 ${kadmin} -p foo/admin@${R} get -o principal bar@${R} \
252 > kadmin.tmp
2>&1 || \
253 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
254 if test "`cat kadmin.tmp`" != "Principal: bar@TEST.H5L.SE" ; then
255 cat kadmin.tmp
; cat messages.log
; exit 1 ;
259 #----------------------------------
264 echo "kadmin get -o kvno"
265 env KRB5CCNAME
=${cache} \
266 ${kadmin} -p foo/admin@${R} get -o kvno bar@${R} \
267 > kadmin.tmp
2>&1 || \
268 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
269 if test "`cat kadmin.tmp`" != "Kvno: 1" ; then
270 cat kadmin.tmp
; cat messages.log
; exit 1 ;
274 #----------------------------------
279 echo "kadmin get -o princ_expire_time"
280 env KRB5CCNAME
=${cache} \
281 ${kadmin} -p foo/admin@${R} get -o princ_expire_time bar@${R} \
282 > kadmin.tmp
2>&1 || \
283 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
284 if test "`cat kadmin.tmp`" != "Principal expires: never" ; then
285 cat kadmin.tmp
; cat messages.log
; exit 1 ;
288 #----------------------------------
293 echo "kadmin get -s -o attributes"
294 env KRB5CCNAME
=${cache} \
295 ${kadmin} -p foo/admin@${R} get -s -o attributes bar@${R} \
296 > kadmin.tmp
2>&1 || \
297 { echo "kadmin failed $?"; cat messages.log
; exit 1; }
298 if test "`cat kadmin.tmp`" != "Attributes" ; then
299 cat kadmin.tmp
; cat messages.log
; exit 1 ;
302 #----------------------------------
305 echo "killing kdc (${kdcpid} ${kadmpid})"
306 sh
${leaks_kill} kdc
$kdcpid ||
exit 1