summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/commission/index.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/www/commission/index.php b/www/commission/index.php
index 23f86cf..00546ab 100644
--- a/www/commission/index.php
+++ b/www/commission/index.php
@@ -127,22 +127,36 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
goto err_exit;
} // Must have uid > 999
$tmpfile = tempnam("/var/volatile/tmp","commission");
+
$cmd = "/usr/bin/passwd " . $username . " 2>&1 >$tmpfile";
$handle = popen($cmd, 'w');
$pwdtxt = $password . "\n" . $password;
fwrite($handle, $pwdtxt);
$status = pclose($handle);
+ syslog(LOG_ALERT, "set passwd: status: $status result: $result");
+
$cmd = "/bin/cat $tmpfile";
$handle = popen($cmd, 'r');
$result2 = trim(fread($handle, 4192));
$status2 = pclose($handle);
- syslog(LOG_ALERT, "passwd: status: $status result: $result");
+ if (($result2 != 0) || (strlen($result2) > 0))
+ syslog(LOG_ALERT, "read passwd log: status: $status2 result: $result2");
+
+ $cmd = "/sbin/mts-ubpasswd -u " . $password;
+ $handle = popen($cmd, 'r');
+ $result3 = trim(fread($handle, 4192));
+ $status3 = pclose($handle);
+ if ($status != 0)
+ syslog(LOG_ALERT, "mts-ubpasswd: status: $status result: $result");
+ else
+ syslog(LOG_ALERT, "mts-ubpasswd: set u-boot password");
+
if ($status == 0) {
$finished = "Commissioning Complete";
$password_err = $result2;
$username_err = $result;
// Disable commissioning
- $cmd = "ln -sf /var/config/default/commissioning /etc/default/commissioning 2>&1;echo 'ENABLED=\"no\"' >/var/config/default/commissioning 2>&1";
+ $cmd = "echo 'ENABLED=\"no\"' >/var/config/default/commissioning 2>&1";
$handle = popen($cmd, 'r');
$result = trim(fread($handle, 4192));
$status = pclose($handle);
@@ -152,7 +166,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
} else {
// shut off web server
$cmd = "/usr/sbin/start-stop-daemon -S -p /var/run/commissionoff.pid -b -a /bin/bash -- -c " .
- "/usr/share/commissioning/off/off.sh";
+ "/usr/libexec/commissioning/off.sh";
syslog(LOG_ALERT, "turn off web server: command: $cmd");
$handle = popen($cmd, 'r');
$result = trim(fread($handle, 4192));