Merge ../ZoneMinder.master into storageareas

This commit is contained in:
Isaac Connor 2018-05-07 11:08:10 -04:00
commit 4f1cc02f58
2 changed files with 32 additions and 15 deletions

View File

@ -330,7 +330,7 @@ bool MonitorStream::sendFrame(const char *filepath, struct timeval *timestamp) {
fprintf(stdout, "Content-Length: %d\r\n", img_buffer_size); fprintf(stdout, "Content-Length: %d\r\n", img_buffer_size);
if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) { if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) {
if ( ! zm_terminate ) if ( ! zm_terminate )
Error("Unable to send stream frame: %s", strerror(errno)); Warning("Unable to send stream frame: %s", strerror(errno));
return false; return false;
} }
fputs("\r\n\r\n", stdout); fputs("\r\n\r\n", stdout);
@ -407,7 +407,7 @@ bool MonitorStream::sendFrame(Image *image, struct timeval *timestamp) {
if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) { if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) {
if ( !zm_terminate ){ if ( !zm_terminate ){
// If the pipe was closed, we will get signalled SIGPIPE to exit, which will set zm_terminate // If the pipe was closed, we will get signalled SIGPIPE to exit, which will set zm_terminate
Error("Unable to send stream frame: %s", strerror(errno)); Warning("Unable to send stream frame: %s", strerror(errno));
} }
return false; return false;
} }

View File

@ -30,20 +30,37 @@ class HostController extends AppController {
)); ));
} }
function getAuthHash() { function getCredentials() {
if ( $zmOptAuth == '1' ) { // ignore debug warnings from other functions
require_once '../../../includes/auth.php'; $this->view='Json';
$this->set(array( $credentials = "";
'auth_hash' => generateAuthHash(ZM_AUTH_HASH_IPS), $appendPassword = 0;
'_serialize' => array('auth_hash')
) ); $this->loadModel('Config');
} else { $isZmAuth = $this->Config->find('first',array('conditions' => array('Config.' . $this->Config->primaryKey => 'ZM_OPT_USE_AUTH')))['Config']['Value'];
$this->set(array(
'auth_hash' => '', if ($isZmAuth) {
'_serialize' => array('auth_hash') $zmAuthRelay = $this->Config->find('first',array('conditions' => array('Config.' . $this->Config->primaryKey => 'ZM_AUTH_RELAY')))['Config']['Value'];
) ); if ($zmAuthRelay == 'hashed') {
$zmAuthHashIps= $this->Config->find('first',array('conditions' => array('Config.' . $this->Config->primaryKey => 'ZM_AUTH_HASH_IPS')))['Config']['Value'];
$credentials = 'auth='.generateAuthHash($zmAuthHashIps);
}
elseif ($zmAuthRelay == 'plain') {
// user will need to append the store password here
$credentials = "user=".$this->Session->read('user.Username')."&pass=";
$appendPassword = 1;
}
elseif ($zmAuthRelay == 'none') {
$credentials = "user=".$this->Session->read('user.Username');
}
} }
} $this->set(array(
'credentials'=> $credentials,
'append_password'=>$appendPassword,
'_serialize' => array('credentials', 'append_password')
) );
}
// If $mid is set, only return disk usage for that monitor // If $mid is set, only return disk usage for that monitor
// Else, return an array of total disk usage, and per-monitor // Else, return an array of total disk usage, and per-monitor