mirror of https://github.com/Icinga/icinga2.git
Merge pull request #8450 from Icinga/bugfix/do-not-accept-api-updates-for-unknown-zone
API: Don't accept object updates for unknown global zone
This commit is contained in:
commit
e84a4a290d
|
@ -72,6 +72,16 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
|
|||
return Empty;
|
||||
}
|
||||
|
||||
String objZone = params->Get("zone");
|
||||
|
||||
if (!Zone::GetByName(objZone)) {
|
||||
Log(LogNotice, "ApiListener")
|
||||
<< "Discarding 'config update object' message"
|
||||
<< " from '" << identity << "' (endpoint: '" << endpoint->GetName() << "', zone: '" << endpointZone->GetName() << "')"
|
||||
<< " for object '" << objName << "' of type '" << objType << "'. Objects zone '" << objZone << "' isn't known locally.";
|
||||
return Empty;
|
||||
}
|
||||
|
||||
/* ignore messages if the endpoint does not accept config */
|
||||
if (!listener->GetAcceptConfig()) {
|
||||
Log(LogWarning, "ApiListener")
|
||||
|
@ -315,6 +325,7 @@ void ApiListener::UpdateConfigObject(const ConfigObject::Ptr& object, const Mess
|
|||
params->Set("name", object->GetName());
|
||||
params->Set("type", object->GetReflectionType()->GetName());
|
||||
params->Set("version", object->GetVersion());
|
||||
params->Set("zone", object->GetZoneName());
|
||||
|
||||
if (object->GetPackage() == "_api") {
|
||||
String file;
|
||||
|
|
Loading…
Reference in New Issue