From b3c010190ffcc295dcc45781abfb1e66e1eb4c46 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 5 Dec 2019 14:54:30 -0600 Subject: password could have embedded spaces --- src/ubpasswd.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ubpasswd.sh b/src/ubpasswd.sh index 1c0e1dd..98347fb 100755 --- a/src/ubpasswd.sh +++ b/src/ubpasswd.sh @@ -24,7 +24,7 @@ if ! [[ -x /sbin/mts-hashpwd ]] ; then exit 1 fi usage() { - echo "ubpasswd [-c] [-d] [-n] [-i] [-m] [-u] [-r] [-f] [-s salt] [password]" + echo "mts-ubpasswd [-c] [-d] [-n] [-i] [-m] [-u] [-r] [-f] [-s salt] [password]" echo " -c clear the U-Boot password" echo " -d debug" echo " -n dryrun for setting password" @@ -206,14 +206,10 @@ if ((upwd == 0)) ; then else result=$(/sbin/mts-hashpwd -p "${pass}" ${salt}) fi -if ! [[ $result =~ ^pass=([^[:space:]]+)[[:space:]]+password_hash=([^[:space:]]+) ]] ; then +if ! [[ $result =~ ^pass=([^$'\n']+)$'\n'password_hash=([^$'\n']+) ]] ; then echo "/sbin/mts-hashpwd failed: ${result}" exit 1 fi -if ((debug)) ; then - echo result is: - echo "$result" -fi pass="${BASH_REMATCH[1]}" password_hash="${BASH_REMATCH[2]}" echo "uboot password hash: \"$password_hash\"" -- cgit v1.2.3