From 24bd9d82c11598b2ee3a0fd479d382917ca3c6e2 Mon Sep 17 00:00:00 2001 From: okuji Date: Wed, 12 Jun 2002 08:39:50 +0000 Subject: [PATCH] 2002-06-12 Yoshinori K. Okuji * util/grub-md5-crypt.in: Prompt to retype a password, and check if the passwords matches. Suggested by Matt Perry . Also, don't use Perl any longer, because *BSD's sh and GNU support ``read -r'', and GRUB doesn't support any other operating system anyway. --- ChangeLog | 9 +++++++++ THANKS | 1 + util/grub-md5-crypt.in | 23 ++++++++++++----------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index afbfdaa5a..f25f23b1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-06-12 Yoshinori K. Okuji + + * util/grub-md5-crypt.in: Prompt to retype a password, and check + if the passwords matches. Suggested by Matt Perry + . + Also, don't use Perl any longer, because *BSD's sh and GNU + support ``read -r'', and GRUB doesn't support any other + operating system anyway. + 2002-06-12 Yoshinori K. Okuji The terminal handling code is rewritten radically. diff --git a/THANKS b/THANKS index 99cfef0f3..5e166f43b 100644 --- a/THANKS +++ b/THANKS @@ -63,6 +63,7 @@ Kunihiro Ishiguro Leendert Meyer M. Meiarashi Mark Lundeberg +Matt Perry Matt Yourst Matthias Granberry Matthias Kretschmer diff --git a/util/grub-md5-crypt.in b/util/grub-md5-crypt.in index 54fb332c0..c030c8793 100644 --- a/util/grub-md5-crypt.in +++ b/util/grub-md5-crypt.in @@ -1,7 +1,7 @@ #! /bin/sh # Encrypt a password in MD5 format -# Copyright (C) 2000 Free Software Foundation, Inc. +# Copyright (C) 2000,2002 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -66,19 +66,15 @@ stty -echo # Prompt to enter a password. echo -n "Password: " +read -r password +echo -# read only one line... I don't know any really portable command for this. -# Does anyone know? -okuji -if test "x$BASH" = x; then - # FIXME: Use Perl instead at the moment. - password=`perl -e '$line = <>; print $line;'` -else - # In BASH, use the builtin command ``read''. - read -r password -fi +# One more time. +echo -n "Retype password: " +read -r password2 +echo # Resume echo backs. -echo stty echo if test "x$password" = x; then @@ -86,6 +82,11 @@ if test "x$password" = x; then exit 1 fi +if test "x$password" != "x$password2"; then + echo "Sorry, passwords do not match." + exit 1 +fi + # Run the grub shell. $grub_shell --batch --device-map=/dev/null <