From 81cfe85c1b8ecdd25eb2735779a9a99b6c682da4 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 1 Oct 2008 16:12:29 +0200 Subject: Workaround problems with mkpasswd Bugfix 3665 Fix problems with entering password caused by regressions in mkpasswd (-S arguement). Read password plaintext with shell then process. --- scripts/install-system | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'scripts/install-system') diff --git a/scripts/install-system b/scripts/install-system index 77384d56..8f4592f9 100755 --- a/scripts/install-system +++ b/scripts/install-system @@ -815,22 +815,20 @@ change_password() { local pwd1="1" local pwd2="2" - until [ $pwd1 == $pwd2 ] + until [ "$pwd1" == "$pwd2" ] do - echo -n "Enter $user " - pwd1=$(mkpasswd -H md5) - local salt=$(echo $pwd1 | awk -F$ '{print $3}') + read -p "Enter $user password:" -r -s pwd1 <>/dev/tty 1>&0 + echo + read -p "Retype $user password:" -r -s pwd2 <>/dev/tty 1>&0 + echo - echo -n "Retype $user " - pwd2=$(mkpasswd -H md5 -S $salt) - - if [ $pwd1 != $pwd2 ] + if [ "$pwd1" != "$pwd2" ] then echo "Passwords do not match" fi done # escape any slashes in resulting password - local epwd=$(echo $pwd | sed 's:/:\\/:g') + local epwd=$(mkpasswd -H md5 "$pwd1" | sed 's:/:\\/:g') sed -i \ -e "/ user $user {/,/}/s/encrypted-password:.*\$/encrypted-password: \"$epwd\"/" \ -- cgit v1.2.3