summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2019-12-05 14:54:30 -0600
committerJohn Klug <john.klug@multitech.com>2019-12-05 14:54:30 -0600
commitb3c010190ffcc295dcc45781abfb1e66e1eb4c46 (patch)
tree75a30f82e43955308fda49ab50852aca711fac75
parent030da4943b21c64c621b120307d9aee20900b310 (diff)
downloadmts-id-eeprom-b3c010190ffcc295dcc45781abfb1e66e1eb4c46.tar.gz
mts-id-eeprom-b3c010190ffcc295dcc45781abfb1e66e1eb4c46.tar.bz2
mts-id-eeprom-b3c010190ffcc295dcc45781abfb1e66e1eb4c46.zip
password could have embedded spaces
-rwxr-xr-xsrc/ubpasswd.sh8
1 files changed, 2 insertions, 6 deletions
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\""