2002-06-12 Yoshinori K. Okuji <okuji@enbug.org>

* util/grub-md5-crypt.in: Prompt to retype a password, and check
	if the passwords matches. Suggested by Matt Perry
	<matt@primefactor.com>.
	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.
This commit is contained in:
okuji 2002-06-12 08:39:50 +00:00
parent eaf934e523
commit 24bd9d82c1
3 changed files with 22 additions and 11 deletions

View file

@ -1,3 +1,12 @@
2002-06-12 Yoshinori K. Okuji <okuji@enbug.org>
* util/grub-md5-crypt.in: Prompt to retype a password, and check
if the passwords matches. Suggested by Matt Perry
<matt@primefactor.com>.
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 <okuji@enbug.org>
The terminal handling code is rewritten radically.

1
THANKS
View file

@ -63,6 +63,7 @@ Kunihiro Ishiguro <kunihiro@zebra.org>
Leendert Meyer <leen.meyer@home.nl>
M. Meiarashi <mes@st.rim.or.jp>
Mark Lundeberg <aa026@pgfn.bc.ca>
Matt Perry <matt@primefactor.com>
Matt Yourst <yourst@mit.edu>
Matthias Granberry <matthias@slurpee.org>
Matthias Kretschmer <m.kretschmer@bsdger.org>

View file

@ -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 <<EOF \
| grep "^Encrypted: " | sed 's/^Encrypted: //'