1941N/A#
2362N/A# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1941N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1941N/A#
1941N/A# This code is free software; you can redistribute it and/or modify it
1941N/A# under the terms of the GNU General Public License version 2 only, as
1941N/A# published by the Free Software Foundation.
1941N/A#
1941N/A# This code is distributed in the hope that it will be useful, but WITHOUT
1941N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1941N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1941N/A# version 2 for more details (a copy is included in the LICENSE file that
1941N/A# accompanied this code).
1941N/A#
1941N/A# You should have received a copy of the GNU General Public License version
1941N/A# 2 along with this work; if not, write to the Free Software Foundation,
1941N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1941N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
1941N/A#
1941N/A
1941N/A# @test
1941N/A# @bug 6853328
1941N/A# @summary Support OK-AS-DELEGATE flag
1941N/A# @run shell/timeout=600 ok-as-delegate-xrealm.sh
1941N/A#
1941N/A
1941N/Aif [ "${TESTSRC}" = "" ] ; then
1941N/A TESTSRC=`dirname $0`
1941N/Afi
1941N/A
1941N/Aif [ "${TESTJAVA}" = "" ] ; then
1941N/A JAVAC_CMD=`which javac`
1941N/A TESTJAVA=`dirname $JAVAC_CMD`/..
1941N/Afi
1941N/A
1941N/A# set platform-dependent variables
1941N/AOS=`uname -s`
1941N/Acase "$OS" in
1941N/A Windows_* )
1941N/A FS="\\"
1941N/A SEP=";"
1941N/A ;;
1941N/A CYGWIN* )
1941N/A FS="/"
1941N/A SEP=";"
1941N/A ;;
1941N/A * )
1941N/A FS="/"
1941N/A SEP=":"
1941N/A ;;
1941N/Aesac
1941N/A
1941N/A${TESTJAVA}${FS}bin${FS}javac -XDignore.symbol.file -d . \
1941N/A ${TESTSRC}${FS}OkAsDelegateXRealm.java \
1941N/A ${TESTSRC}${FS}KDC.java \
1941N/A ${TESTSRC}${FS}OneKDC.java \
1941N/A ${TESTSRC}${FS}Action.java \
1941N/A ${TESTSRC}${FS}Context.java \
1941N/A || exit 10
1941N/A
1941N/A# Add $TESTSRC to classpath so that customized nameservice can be used
1941N/AJ="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}."
1941N/A
1941N/A# KDC no OK-AS-DELEGATE, fail
1941N/A$J OkAsDelegateXRealm false || exit 1
1941N/A
1941N/A# KDC set OK-AS-DELEGATE for all, succeed
1941N/A$J -Dtest.kdc.policy.ok-as-delegate OkAsDelegateXRealm true || exit 2
1941N/A
1941N/A# KDC set OK-AS-DELEGATE for host/host.r3.local only, fail
1941N/A$J -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local OkAsDelegateXRealm false || exit 3
1941N/A
1941N/A# KDC set OK-AS-DELEGATE for all, succeed
1941N/A$J "-Dtest.kdc.policy.ok-as-delegate=host/host.r3.local krbtgt/R2 krbtgt/R3" OkAsDelegateXRealm true || exit 4
1941N/A
1941N/Aexit 0