2
|
1 |
#! /bin/sh
|
|
2 |
|
|
3 |
#
|
715
|
4 |
# Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.
|
2
|
5 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
6 |
#
|
|
7 |
# This code is free software; you can redistribute it and/or modify it
|
|
8 |
# under the terms of the GNU General Public License version 2 only, as
|
|
9 |
# published by the Free Software Foundation.
|
|
10 |
#
|
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
# accompanied this code).
|
|
16 |
#
|
|
17 |
# You should have received a copy of the GNU General Public License version
|
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
#
|
|
21 |
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
# CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
# have any questions.
|
|
24 |
#
|
|
25 |
|
|
26 |
# @test
|
|
27 |
# @bug 6418647
|
|
28 |
# @summary Doc bug 5035358 shows sun.security.util.Password.readPassword() is buggy.
|
|
29 |
# @author Weijun Wang
|
|
30 |
#
|
|
31 |
# @run shell/manual console.sh
|
|
32 |
|
706
|
33 |
if [ "$ALT_PASS" = "" ]; then
|
2
|
34 |
export PASS=äöäöäöäö
|
|
35 |
else
|
|
36 |
export PASS=$ALT_PASS
|
|
37 |
fi
|
|
38 |
|
|
39 |
echo "ATTENTION"
|
|
40 |
echo "==============================================================="
|
|
41 |
echo
|
|
42 |
echo "This test is about console password input compatibility between"
|
|
43 |
echo "Tiger and Mustang. Before running the test, make sure that --"
|
|
44 |
echo "\$J5 points to a JDK 5.0 installation"
|
|
45 |
echo "\$JM points to a JDK 6 installation".
|
|
46 |
echo
|
|
47 |
echo "The password string used in this test is $PASS. If you find difficulty"
|
|
48 |
echo "entering it in in your system, feel free to change it to something else"
|
|
49 |
echo "by providing \$ALT_PASS (should be not less than 6 characters)"
|
|
50 |
echo
|
|
51 |
echo "For all prompt of \"Enter keystore password\", type $PASS and press ENTER"
|
|
52 |
echo "For all prompt of \"Enter key password for <mykey> (RETURN if same as keystore password)\", press ENTER"
|
|
53 |
echo "If you see both the prompts appear, say --"
|
|
54 |
echo " Enter key password for <mykey>"
|
|
55 |
echo " (RETURN if same as keystore password): Enter keystore password:"
|
|
56 |
echo "only response to the last prompt by typing $PASS and press ENTER"
|
706
|
57 |
echo
|
2
|
58 |
echo "Only if all the command run correctly without showing any error "
|
|
59 |
echo "or warning, this test passes."
|
|
60 |
echo
|
|
61 |
echo "Press ENTER to start the test, or Ctrl-C to stop it"
|
|
62 |
read
|
|
63 |
echo
|
|
64 |
echo "Test #1: 5->6, non-prompt"
|
|
65 |
rm kkk
|
|
66 |
$J5/bin/keytool -keystore kkk -genkey -dname CN=olala -storepass $PASS
|
|
67 |
$JM/bin/keytool -keystore kkk -list -storepass $PASS
|
|
68 |
echo "Test #2: 6->5, non-prompt"
|
|
69 |
rm kkk
|
|
70 |
$JM/bin/keytool -keystore kkk -genkey -dname CN=olala -storepass $PASS
|
|
71 |
$J5/bin/keytool -keystore kkk -list -storepass $PASS
|
|
72 |
echo "Test #3: 5->6, prompt"
|
|
73 |
rm kkk
|
|
74 |
$J5/bin/keytool -keystore kkk -genkey -dname CN=olala
|
|
75 |
$JM/bin/keytool -keystore kkk -list
|
|
76 |
echo $PASS| $J5/bin/keytool -keystore kkk -list
|
|
77 |
echo $PASS| $JM/bin/keytool -keystore kkk -list
|
|
78 |
echo "Test #4: 6->5, prompt"
|
|
79 |
rm kkk
|
|
80 |
$JM/bin/keytool -keystore kkk -genkey -dname CN=olala
|
|
81 |
$J5/bin/keytool -keystore kkk -list
|
|
82 |
echo $PASS| $JM/bin/keytool -keystore kkk -list
|
|
83 |
echo $PASS| $J5/bin/keytool -keystore kkk -list
|
|
84 |
echo "Test #5: 5->6, pipe"
|
|
85 |
rm kkk
|
|
86 |
echo $PASS| $J5/bin/keytool -keystore kkk -genkey -dname CN=olala
|
|
87 |
$JM/bin/keytool -keystore kkk -list
|
|
88 |
echo $PASS| $J5/bin/keytool -keystore kkk -list
|
|
89 |
echo $PASS| $JM/bin/keytool -keystore kkk -list
|
706
|
90 |
rm kkk
|
|
91 |
|
|
92 |
exit 0
|