jdk/test/sun/security/krb5/auto/ok-as-delegate.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.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}OkAsDelegate.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
# Testing Kerberos 5
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    65
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    66
# Add $TESTSRC to classpath so that customized nameservice can be used
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    67
J="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. OkAsDelegate"
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    68
JOK="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.kdc.policy.ok-as-delegate OkAsDelegate"
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    69
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    70
# FORWARDABLE ticket not allowed, always fail
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    71
$J false true true false false false || exit 1
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    72
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    73
# Service ticket no OK-AS-DELEGATE
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    74
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    75
# Request nothing, gain nothing
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    76
$J true false false false false false || exit 2
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    77
# Request deleg policy, gain nothing
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    78
$J true false true false false false || exit 3
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    79
# Request deleg, granted
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    80
$J true true false true false true || exit 4
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    81
# Request deleg and deleg policy, granted, with info not by policy
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    82
$J true true true true false true || exit 5
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    83
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    84
# Service ticket has OK-AS-DELEGATE
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    85
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    86
# Request deleg policy, granted
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    87
$JOK true false true true true true || exit 6
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    88
# Request deleg and deleg policy, granted, with info by policy
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    89
$JOK true true true true true true || exit 7
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    90
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    91
# Testing SPNEGO
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    92
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    93
# Add $TESTSRC to classpath so that customized nameservice can be used
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    94
J="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.spnego OkAsDelegate"
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    95
JOK="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate"
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    96
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    97
# FORWARDABLE ticket not allowed, always fail
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    98
$J false true true false false false || exit 11
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
    99
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   100
# Service ticket no OK-AS-DELEGATE
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   101
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   102
# Request nothing, gain nothing
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   103
$J true false false false false false || exit 12
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   104
# Request deleg policy, gain nothing
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   105
$J true false true false false false || exit 13
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   106
# Request deleg, granted
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   107
$J true true false true false true || exit 14
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   108
# Request deleg and deleg policy, granted, with info not by policy
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   109
$J true true true true false true || exit 15
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   110
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   111
# Service ticket has OK-AS-DELEGATE
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   112
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   113
# Request deleg policy, granted
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   114
$JOK true false true true true true || exit 16
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   115
# Request deleg and deleg policy, granted, with info by policy
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   116
$JOK true true true true true true || exit 17
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   117
4c792c19266e 6853328: Support OK-AS-DELEGATE flag
weijun
parents:
diff changeset
   118
exit 0