1 # 2 # Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 # or visit www.oracle.com if you need additional information or have any 21 # questions. 22 # 23 24 # @test 25 # @bug 6950546 26 # @summary "ktab -d name etype" to "ktab -d name [-e etype] [kvno | all | old]" 27 # @modules java.security.jgss/sun.security.krb5.internal.ktab 28 # java.security.jgss/sun.security.krb5 29 # @compile KtabCheck.java 30 # @run shell ktcheck.sh 31 # 32 33 if [ "${TESTJAVA}" = "" ] ; then 34 JAVAC_CMD=`which javac` 35 TESTJAVA=`dirname $JAVAC_CMD`/.. 36 fi 37 38 if [ "${TESTSRC}" = "" ] ; then 39 TESTSRC="." 40 fi 41 42 OS=`uname -s` 43 case "$OS" in 44 CYGWIN* ) 45 FS="/" 46 ;; 47 Windows_* ) 48 FS="\\" 49 ;; 50 * ) 51 FS="/" 52 echo "Unsupported system!" 53 exit 0; 54 ;; 55 esac 56 57 KEYTAB=ktab.tmp 58 59 rm $KEYTAB 60 61 EXTRA_OPTIONS="-Djava.security.krb5.conf=${TESTSRC}${FS}onlythree.conf" 62 KTAB="${TESTJAVA}${FS}bin${FS}ktab -J${EXTRA_OPTIONS} -k $KEYTAB -f" 63 CHECK="${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} ${TESTVMOPTS} ${EXTRA_OPTIONS} \ 64 -XaddExports:java.security.jgss/sun.security.krb5.internal.ktab=ALL-UNNAMED \ 65 -XaddExports:java.security.jgss/sun.security.krb5=ALL-UNNAMED \ 66 KtabCheck $KEYTAB" 67 68 echo ${EXTRA_OPTIONS} 69 70 $KTAB -a me mine 71 $CHECK 1 16 1 23 1 17 || exit 1 72 $KTAB -a me mine -n 0 73 $CHECK 0 16 0 23 0 17 || exit 1 74 $KTAB -a me mine -n 1 -append 75 $CHECK 0 16 0 23 0 17 1 16 1 23 1 17 || exit 1 76 $KTAB -a me mine -append 77 $CHECK 0 16 0 23 0 17 1 16 1 23 1 17 2 16 2 23 2 17 || exit 1 78 $KTAB -a me mine 79 $CHECK 3 16 3 23 3 17 || exit 1 80 $KTAB -a me mine -n 4 -append 81 $CHECK 3 16 3 23 3 17 4 16 4 23 4 17 || exit 1 82 $KTAB -a me mine -n 5 -append 83 $CHECK 3 16 3 23 3 17 4 16 4 23 4 17 5 16 5 23 5 17 || exit 1 84 $KTAB -a me mine -n 6 -append 85 $CHECK 3 16 3 23 3 17 4 16 4 23 4 17 5 16 5 23 5 17 6 16 6 23 6 17 || exit 1 86 $KTAB -d me 3 87 $CHECK 4 16 4 23 4 17 5 16 5 23 5 17 6 16 6 23 6 17 || exit 1 88 $KTAB -d me -e 16 6 89 $CHECK 4 16 4 23 4 17 5 16 5 23 5 17 6 23 6 17 || exit 1 90 $KTAB -d me -e 17 6 91 $CHECK 4 16 4 23 4 17 5 16 5 23 5 17 6 23 || exit 1 92 $KTAB -d me -e 16 5 93 $CHECK 4 16 4 23 4 17 5 23 5 17 6 23 || exit 1 94 $KTAB -d me old 95 $CHECK 4 16 5 17 6 23 || exit 1 96 $KTAB -d me old 97 $CHECK 4 16 5 17 6 23 || exit 1 98 $KTAB -d me 99 $CHECK || exit 1