Fix adding auth string screwing up url to remote api in zmaControl and zmcControl

This commit is contained in:
Isaac Connor 2020-02-25 17:00:16 -05:00
parent 9febf60228
commit 7787ba1040
1 changed files with 8 additions and 8 deletions

View File

@ -284,12 +284,12 @@ class Monitor extends ZM_Object {
$url = $Server->UrlToApi().'/monitors/daemonControl/'.$this->{'Id'}.'/'.$mode.'/zmc.json'; $url = $Server->UrlToApi().'/monitors/daemonControl/'.$this->{'Id'}.'/'.$mode.'/zmc.json';
if ( ZM_OPT_USE_AUTH ) { if ( ZM_OPT_USE_AUTH ) {
if ( ZM_AUTH_RELAY == 'hashed' ) { if ( ZM_AUTH_RELAY == 'hashed' ) {
$url .= '?auth='.generateAuthHash( ZM_AUTH_HASH_IPS ); $url .= '?auth='.generateAuthHash(ZM_AUTH_HASH_IPS);
} elseif ( ZM_AUTH_RELAY == 'plain' ) { } elseif ( ZM_AUTH_RELAY == 'plain' ) {
$url = '?user='.$_SESSION['username']; $url .= '?user='.$_SESSION['username'];
$url = '?pass='.$_SESSION['password']; $url .= '?pass='.$_SESSION['password'];
} elseif ( ZM_AUTH_RELAY == 'none' ) { } elseif ( ZM_AUTH_RELAY == 'none' ) {
$url = '?user='.$_SESSION['username']; $url .= '?user='.$_SESSION['username'];
} }
} }
Logger::Debug("sending command to $url"); Logger::Debug("sending command to $url");
@ -342,12 +342,12 @@ class Monitor extends ZM_Object {
$url = ZM_BASE_PROTOCOL . '://'.$Server->Hostname().'/zm/api/monitors/daemonControl/'.$this->{'Id'}.'/'.$mode.'/zma.json'; $url = ZM_BASE_PROTOCOL . '://'.$Server->Hostname().'/zm/api/monitors/daemonControl/'.$this->{'Id'}.'/'.$mode.'/zma.json';
if ( ZM_OPT_USE_AUTH ) { if ( ZM_OPT_USE_AUTH ) {
if ( ZM_AUTH_RELAY == 'hashed' ) { if ( ZM_AUTH_RELAY == 'hashed' ) {
$url .= '?auth='.generateAuthHash( ZM_AUTH_HASH_IPS ); $url .= '?auth='.generateAuthHash(ZM_AUTH_HASH_IPS);
} elseif ( ZM_AUTH_RELAY == 'plain' ) { } elseif ( ZM_AUTH_RELAY == 'plain' ) {
$url = '?user='.$_SESSION['username']; $url .= '?user='.$_SESSION['username'];
$url = '?pass='.$_SESSION['password']; $url .= '?pass='.$_SESSION['password'];
} elseif ( ZM_AUTH_RELAY == 'none' ) { } elseif ( ZM_AUTH_RELAY == 'none' ) {
$url = '?user='.$_SESSION['username']; $url .= '?user='.$_SESSION['username'];
} }
} }
Logger::Debug("sending command to $url"); Logger::Debug("sending command to $url");