|
1 # |
|
2 # Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. |
|
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 # |
|
5 # This code is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License version 2 only, as |
|
7 # published by the Free Software Foundation. |
|
8 # |
|
9 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 # version 2 for more details (a copy is included in the LICENSE file that |
|
13 # accompanied this code). |
|
14 # |
|
15 # You should have received a copy of the GNU General Public License version |
|
16 # 2 along with this work; if not, write to the Free Software Foundation, |
|
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 # |
|
19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 # CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 # have any questions. |
|
22 # |
|
23 |
|
24 # @test |
|
25 # @bug 6853328 |
|
26 # @summary Support OK-AS-DELEGATE flag |
|
27 # @run shell/timeout=600 ok-as-delegate-xrealm.sh |
|
28 # |
|
29 |
|
30 if [ "${TESTSRC}" = "" ] ; then |
|
31 TESTSRC=`dirname $0` |
|
32 fi |
|
33 |
|
34 if [ "${TESTJAVA}" = "" ] ; then |
|
35 JAVAC_CMD=`which javac` |
|
36 TESTJAVA=`dirname $JAVAC_CMD`/.. |
|
37 fi |
|
38 |
|
39 # set platform-dependent variables |
|
40 OS=`uname -s` |
|
41 case "$OS" in |
|
42 Windows_* ) |
|
43 FS="\\" |
|
44 SEP=";" |
|
45 ;; |
|
46 CYGWIN* ) |
|
47 FS="/" |
|
48 SEP=";" |
|
49 ;; |
|
50 * ) |
|
51 FS="/" |
|
52 SEP=":" |
|
53 ;; |
|
54 esac |
|
55 |
|
56 ${TESTJAVA}${FS}bin${FS}javac -XDignore.symbol.file -d . \ |
|
57 ${TESTSRC}${FS}OkAsDelegateXRealm.java \ |
|
58 ${TESTSRC}${FS}KDC.java \ |
|
59 ${TESTSRC}${FS}OneKDC.java \ |
|
60 ${TESTSRC}${FS}Action.java \ |
|
61 ${TESTSRC}${FS}Context.java \ |
|
62 || exit 10 |
|
63 |
|
64 # Add $TESTSRC to classpath so that customized nameservice can be used |
|
65 J="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}." |
|
66 |
|
67 # KDC no OK-AS-DELEGATE, fail |
|
68 $J OkAsDelegateXRealm false || exit 1 |
|
69 |
|
70 # KDC set OK-AS-DELEGATE for all, succeed |
|
71 $J -Dtest.kdc.policy.ok-as-delegate OkAsDelegateXRealm true || exit 2 |
|
72 |
|
73 # KDC set OK-AS-DELEGATE for host/host.r3.local only, fail |
|
74 $J -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local OkAsDelegateXRealm false || exit 3 |
|
75 |
|
76 # KDC set OK-AS-DELEGATE for all, succeed |
|
77 $J "-Dtest.kdc.policy.ok-as-delegate=host/host.r3.local krbtgt/R2 krbtgt/R3" OkAsDelegateXRealm true || exit 4 |
|
78 |
|
79 exit 0 |