Fix permissions for agent CheckResult messages

fixes #8821
This commit is contained in:
Gunnar Beutner 2015-03-30 13:39:24 +02:00
parent 8e73d72447
commit 10441e9cd7
2 changed files with 4 additions and 20 deletions

View File

@ -193,7 +193,10 @@ Value ApiEvents::CheckResultAPIHandler(const MessageOrigin& origin, const Dictio
if (origin.FromZone && !origin.FromZone->CanAccessObject(checkable) && endpoint != checkable->GetCommandEndpoint()) if (origin.FromZone && !origin.FromZone->CanAccessObject(checkable) && endpoint != checkable->GetCommandEndpoint())
return Empty; return Empty;
checkable->ProcessCheckResult(cr, origin); if (endpoint == checkable->GetCommandEndpoint())
checkable->ProcessCheckResult(cr);
else
checkable->ProcessCheckResult(cr, origin);
return Empty; return Empty;
} }

View File

@ -268,25 +268,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
/* send message back to its origin */ /* send message back to its origin */
Dictionary::Ptr message = ApiEvents::MakeCheckResultMessage(this, cr); Dictionary::Ptr message = ApiEvents::MakeCheckResultMessage(this, cr);
listener->SyncSendMessage(command_endpoint, message); listener->SyncSendMessage(command_endpoint, message);
/* HA cluster zone nodes must also process the check result locally
* by fetching the real host/service object if existing
*/
Host::Ptr tempHost;
Service::Ptr tempService;
tie(tempHost, tempService) = GetHostService(this);
Host::Ptr realHost = Host::GetByName(tempHost->GetName());
if (realHost) {
Value agent_service_name = GetExtension("agent_service_name");
if (!agent_service_name.IsEmpty()) {
Checkable::Ptr realCheckable;
realCheckable = realHost->GetServiceByShortName(agent_service_name);
if (realCheckable) {
realCheckable->ProcessCheckResult(cr, origin);
}
}
}
} }
return; return;