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