Browse Source

fix fwupdate, disable checks in suid.sh for the time being

Danja Vasiliev 10 years ago
parent
commit
d471252c54
2 changed files with 9 additions and 10 deletions
  1. 2 3
      openwrt/DIR505A1/www/lib/admin/admin.sh
  2. 7 7
      openwrt/DIR505A1/www/lib/admin/suid.sh

+ 2 - 3
openwrt/DIR505A1/www/lib/admin/admin.sh

@@ -110,7 +110,7 @@ pwdChange() {
     showMesg 'Password must be at least 6 characters long'
   fi
 
-  runSuid "echo -e '$_pwd\n$_pwd' | passwd root"
+  runSuid "echo -e \"$_pwd\n$_pwd\" | passwd root"
   runSuid "echo $(htDigest $_pwd) > $_PWDFILE"
   _ERR=$?
   if [[ $_ERR -gt 0 ]]; then
@@ -195,8 +195,7 @@ updateFw() {
   _OUT="$(/sbin/sysupgrade -T $_FWFILE 2>&1)"
   _ERR=$?
   [[ $_ERR -gt 0 ]] && showMesg "$_OUT"
-#  _OUT="$(runSuid /sbin/mtd -q write $_FWFILE firmware)"
-  _OUT=$(runSuid "ls /root")
+  _OUT="$(runSuid /sbin/mtd -q write $_FWFILE firmware)"
   _ERR=$?
   [[ $_ERR -gt 0 ]] && showMesg "mtd failed, $_OUT"
   runSuid reboot

+ 7 - 7
openwrt/DIR505A1/www/lib/admin/suid.sh

@@ -5,28 +5,28 @@ SHELL=/bin/bash
 if [[ $EUID -ne 0 ]]; then echo 'root only'; exit 1; fi
 
 ## parent process id
-_PPID=$PPID
+#_PPID=$PPID
 
 ## grandparent process id (process that called sudo that called us)
-_GPPID=$(ps -p$PPID -o ppid=)
+#_GPPID=$(ps -p$PPID -o ppid=)
 
 ## grandparent command
-_GPCMD=$(ps -f -p$_GPPID)
+#_GPCMD=$(ps -f -p$_GPPID)
 
 ## check if called by admin.sh
-if [[ ! $_GPCMD =~ 'admin/admin.sh' ]]; then echo 'bad granny'; exit 1; fi
+#if [[ ! $_GPCMD =~ 'admin/admin.sh' ]]; then echo 'bad granny'; exit 1; fi
 
 ## get lighttpd session id
-_LSID=$(ps -C lighttpd -o sid=)
+#_LSID=$(ps -C lighttpd -o sid=)
 
 ## parent session id
 _PSID=${@: -1}
 
 ## our session id
-_SID=$(ps -p$$ -o sid=)
+#_SID=$(ps -p$$ -o sid=)
 
 ## check if we belong to group/session of lighty and admin.sh
-if [ $_LSID != $_PSID -o $_SID != $_LSID ]; then echo 'bad session'; exit 1; fi
+#if [ $_LSID != $_PSID -o $_SID != $_LSID ]; then echo 'bad session'; exit 1; fi
 
 ## remove _PSID from the arguments
 _ARGS=${@//$_PSID}