summaryrefslogtreecommitdiff
path: root/src/ubpasswd.sh
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2017-04-04 09:54:52 -0500
committerJohn Klug <john.klug@multitech.com>2017-04-04 09:54:52 -0500
commit8801af07013ddfdf517d42bb50a21ebfad621460 (patch)
tree82ca3c5d3d78eef3f69a11831b26c54aa560018d /src/ubpasswd.sh
parentf757192c62657657eeb6b169604d9b6dbe28d9df (diff)
downloadmts-id-eeprom-8801af07013ddfdf517d42bb50a21ebfad621460.tar.gz
mts-id-eeprom-8801af07013ddfdf517d42bb50a21ebfad621460.tar.bz2
mts-id-eeprom-8801af07013ddfdf517d42bb50a21ebfad621460.zip
Password based on the device-id and Ethernet MAC not paths of the same.
Diffstat (limited to 'src/ubpasswd.sh')
-rwxr-xr-xsrc/ubpasswd.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ubpasswd.sh b/src/ubpasswd.sh
index c379563..1a32ef4 100755
--- a/src/ubpasswd.sh
+++ b/src/ubpasswd.sh
@@ -55,8 +55,8 @@ fi
len=8
saltlen=128
mts=/sys/devices/platform/mts-io
-did="${mts}/device-id"
-mac="${mts}/mac-eth"
+did=$(cat "${mts}/device-id")
+mac=$(cat "${mts}/mac-eth")
if ! /bin/fgrep "mts password protected" /dev/mtdblock2 >/dev/null 2>&1; then
echo "U-Boot does not support password protection."
@@ -68,8 +68,8 @@ fi
echo "salt: $salt"
-((v == 1)) && echo upwd is $upwd
-((v == 1)) && echo did length is ${#did}
+((debug)) && echo upwd is $upwd
+((debug)) && echo did length is ${#did}
if ((upwd == 0)) ; then
if ((${#did} == 0)) ; then
echo "${mts}/device-id must have a non-zero length value"
@@ -79,7 +79,7 @@ if ((upwd == 0)) ; then
echo "${mts}/mac-eth must have a non-zero length value"
usage
fi
- if ((v == 1)) ; then
+ if ((debug)) ; then
echo Try this:
echo "/sbin/mts-hashpwd -d ${did} -m ${mac} ${salt}"
fi
@@ -91,7 +91,7 @@ if ! [[ $result =~ ^pass=([^[:space:]]+)[[:space:]]+password_hash=([^[:space:]]+
echo "/sbin/mts-hashpwd failed: ${result}"
exit 1
fi
-if ((v == 1)) ; then
+if ((debug)) ; then
echo result is:
echo "$result"
fi