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