Use calculateAuthHash instead of generateAuthHash because we are sessionless and improve output on success and failure. Fixes #2329

This commit is contained in:
Isaac Connor 2021-05-18 10:52:07 -04:00
parent fffe72a3fa
commit 8c7e004187
1 changed files with 14 additions and 7 deletions

View File

@ -266,7 +266,7 @@ class MonitorsController extends AppController {
if ( $mToken ) { if ( $mToken ) {
$auth = ' -T '.$mToken; $auth = ' -T '.$mToken;
} else if ( ZM_AUTH_RELAY == 'hashed' ) { } else if ( ZM_AUTH_RELAY == 'hashed' ) {
$auth = ' -A '.generateAuthHash(ZM_AUTH_HASH_IPS); $auth = ' -A '.calculateAuthHash(ZM_AUTH_HASH_IPS?$_SERVER['REMOTE_ADDR']:'');
} else if ( ZM_AUTH_RELAY == 'plain' ) { } else if ( ZM_AUTH_RELAY == 'plain' ) {
# Plain requires the plain text password which must either be in request or stored in session # Plain requires the plain text password which must either be in request or stored in session
$password = $this->request->query('pass') ? $this->request->query('pass') : $this->request->data('pass');; $password = $this->request->query('pass') ? $this->request->query('pass') : $this->request->data('pass');;
@ -290,12 +290,19 @@ class MonitorsController extends AppController {
} }
$shellcmd = escapeshellcmd(ZM_PATH_BIN."/zmu $verbose -m$id $q $auth"); $shellcmd = escapeshellcmd(ZM_PATH_BIN."/zmu $verbose -m$id $q $auth");
$status = exec ($shellcmd); $status = exec($shellcmd, $output, $rc);
if ($status) {
$this->set(array( $this->set(array(
'status' => $status, 'status'=>$rc,
'_serialize' => array('status'), 'error'=>$output,
)); '_serialize' => array('status','error'),
));
} else {
$this->set(array(
'status' => 'Ok',
'_serialize' => array('status'),
));
}
} }
// Check if a daemon is running for the monitor id // Check if a daemon is running for the monitor id