console.sh 3.4 KB
Newer Older
D
duke 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#! /bin/sh

#
# Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#

# @test
# @bug 6418647
# @summary Doc bug 5035358 shows sun.security.util.Password.readPassword() is buggy.
# @author Weijun Wang
#
# @run shell/manual console.sh

33
if [ "$ALT_PASS" = "" ]; then
D
duke 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
  export PASS=äöäöäöäö
else
  export PASS=$ALT_PASS
fi

echo "ATTENTION"
echo "==============================================================="
echo
echo "This test is about console password input compatibility between"
echo "Tiger and Mustang. Before running the test, make sure that --"
echo "\$J5 points to a JDK 5.0 installation"
echo "\$JM points to a JDK 6 installation".
echo
echo "The password string used in this test is $PASS. If you find difficulty"
echo "entering it in in your system, feel free to change it to something else"
echo "by providing \$ALT_PASS (should be not less than 6 characters)"
echo
echo "For all prompt of \"Enter keystore password\", type $PASS and press ENTER"
echo "For all prompt of \"Enter key password for <mykey> (RETURN if same as keystore password)\", press ENTER"
echo "If you see both the prompts appear, say --"
echo "   Enter key password for <mykey>"
echo "         (RETURN if same as keystore password):  Enter keystore password:"
echo "only response to the last prompt by typing $PASS and press ENTER"
57
echo
D
duke 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
echo "Only if all the command run correctly without showing any error "
echo "or warning, this test passes."
echo
echo "Press ENTER to start the test, or Ctrl-C to stop it"
read
echo
echo "Test #1: 5->6, non-prompt"
rm kkk
$J5/bin/keytool -keystore kkk -genkey -dname CN=olala -storepass $PASS
$JM/bin/keytool -keystore kkk -list -storepass $PASS
echo "Test #2: 6->5, non-prompt"
rm kkk
$JM/bin/keytool -keystore kkk -genkey -dname CN=olala -storepass $PASS
$J5/bin/keytool -keystore kkk -list -storepass $PASS
echo "Test #3: 5->6, prompt"
rm kkk
$J5/bin/keytool -keystore kkk -genkey -dname CN=olala
$JM/bin/keytool -keystore kkk -list
echo $PASS| $J5/bin/keytool -keystore kkk -list
echo $PASS| $JM/bin/keytool -keystore kkk -list
echo "Test #4: 6->5, prompt"
rm kkk
$JM/bin/keytool -keystore kkk -genkey -dname CN=olala
$J5/bin/keytool -keystore kkk -list
echo $PASS| $JM/bin/keytool -keystore kkk -list
echo $PASS| $J5/bin/keytool -keystore kkk -list
echo "Test #5: 5->6, pipe"
rm kkk
echo $PASS| $J5/bin/keytool -keystore kkk -genkey -dname CN=olala
$JM/bin/keytool -keystore kkk -list
echo $PASS| $J5/bin/keytool -keystore kkk -list
echo $PASS| $JM/bin/keytool -keystore kkk -list
90 91 92
rm kkk

exit 0