diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-10-01 16:12:29 +0200 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-10-01 16:12:29 +0200 |
commit | 81cfe85c1b8ecdd25eb2735779a9a99b6c682da4 (patch) | |
tree | fbfe571d942cb2631734b383deeeb27b54064c72 /scripts/install-system | |
parent | 90b81cf158a7ca263bf43d1bfc2fc971fcea2290 (diff) | |
download | vyatta-cfg-system-81cfe85c1b8ecdd25eb2735779a9a99b6c682da4.tar.gz vyatta-cfg-system-81cfe85c1b8ecdd25eb2735779a9a99b6c682da4.zip |
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.
Diffstat (limited to 'scripts/install-system')
-rwxr-xr-x | scripts/install-system | 16 |
1 files changed, 7 insertions, 9 deletions
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\"/" \ |