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
37 env_setup
="@env_setup@"
43 # If there is no useful db support compiled in, disable test
44 ..
/db
/have-db ||
exit 77
50 keytabfile
=${objdir}/server.keytab
51 keytab
="FILE:${keytabfile}"
52 cache
="FILE:krb5ccfile"
53 cacheds
="FILE:krb5ccfile-ds"
55 kinit
="${TESTS_ENVIRONMENT} ../../kuser/kinit -c $cache ${afs_no_afslog}"
56 kinitds
="${TESTS_ENVIRONMENT} ../../kuser/kinit -c $cacheds ${afs_no_afslog}"
57 kadmin
="${TESTS_ENVIRONMENT} ../../kadmin/kadmin -l -r $R"
58 kdc
="${TESTS_ENVIRONMENT} ../../kdc/kdc --addresses=localhost -P $port"
59 kdigest
="${TESTS_ENVIRONMENT} ../../kuser/kdigest"
61 context
="${TESTS_ENVIRONMENT} ../../lib/gssapi/test_context"
63 KRB5_CONFIG
="${objdir}/krb5.conf"
67 KRB5_KTNAME
="${keytab}"
71 NTLM_ACCEPTOR_CCACHE
="${cacheds}"
72 export NTLM_ACCEPTOR_CCACHE
73 NTLM_USER_FILE
="${srcdir}/ntlm-user-file.txt"
76 GSSAPI_SPNEGO_NAME
=host@
host.
test.h5l.se
77 export GSSAPI_SPNEGO_NAME
86 echo Creating database
89 --realm-max-ticket-life=1day \
90 --realm-max-renewable-life=1month \
93 ${kadmin} add
-p p1
--use-defaults host
/host.
test.h5l.se@
${R} ||
exit 1
94 ${kadmin} ext -k ${keytab} host/host.test.h5l.se@${R} ||
exit 1
96 ${kadmin} add -p kaka --use-defaults digest/${R}@${R} ||
exit 1
98 ${kadmin} add
-p ds
--use-defaults digestserver@
${R} ||
exit 1
99 ${kadmin} modify
--attributes=+allow-digest digestserver@
${R} ||
exit 1
101 ${kadmin} add
-p u1
--use-defaults user1@
${R} ||
exit 1
103 echo "Doing database check"
104 ${kadmin} check
${R} ||
exit 1
106 echo u1
> ${objdir}/foopassword
107 echo ds
> ${objdir}/barpassword
110 ${kdc} --detach --testing ||
{ echo "kdc failed to start"; exit 1; }
113 trap "kill ${kdcpid}; echo signal killing kdc; exit 1;" EXIT
117 echo "Getting client initial tickets"
118 ${kinit} --password-file=${objdir}/foopassword user1@${R} || exitcode
=1
119 echo "Getting digestserver initial tickets"
120 ${kinitds} --password-file=${objdir}/barpassword digestserver@${R} || exitcode
=1
123 KRB5CCNAME
="$cacheds"
125 ${kdigest} digest-probe
--realm=${R} > /dev
/null || \
126 { exitcode
=1; echo "test failed"; }
128 echo "======context building ntlm"
130 NTLM_USER_FILE
="${srcdir}/ntlm-user-file.txt-no"
133 echo "no NTLM initiator creds"
134 ${context} --mech-type=ntlm \
136 --name-type=hostbased-service \
137 --ret-mech-type=ntlm \
138 host@
host.
test.h5l.se
2> /dev
/null
&& \
139 { exitcode
=1 ; echo "test failed"; }
141 echo "Getting client initial tickets (with ntlm creds)"
142 ${kinit} --password-file=${objdir}/foopassword --ntlm-domain=TEST user1@${R} || exitcode
=1
144 echo "NTLM initiator krb5 creds"
145 ${context} --mech-type=ntlm \
147 --name-type=hostbased-service \
148 --ret-mech-type=ntlm \
149 host@
host.
test.h5l.se || \
150 { exitcode
=1 ; echo "test failed"; }
152 echo "NTLM initiator krb5 creds (getverifymic, wrapunwrap)"
153 ${context} --mech-type=ntlm \
155 --name-type=hostbased-service \
156 --ret-mech-type=ntlm \
157 --getverifymic --wrapunwrap \
158 host@
host.
test.h5l.se || \
159 { exitcode
=1 ; echo "test failed"; }
163 echo "killing kdc (${kdcpid})"
164 kill ${kdcpid} 2> /dev
/null