mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
Merge pull request #8459 from Icinga/bugfix/do-not-accept-api-updates-for-unknown-zone-2.11.7
API: Don't accept object updates for unknown global zone
This commit is contained in:
commit
820e7eed3c
@ -72,6 +72,16 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
|
|||||||
return Empty;
|
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 */
|
/* ignore messages if the endpoint does not accept config */
|
||||||
if (!listener->GetAcceptConfig()) {
|
if (!listener->GetAcceptConfig()) {
|
||||||
Log(LogWarning, "ApiListener")
|
Log(LogWarning, "ApiListener")
|
||||||
@ -315,6 +325,7 @@ void ApiListener::UpdateConfigObject(const ConfigObject::Ptr& object, const Mess
|
|||||||
params->Set("name", object->GetName());
|
params->Set("name", object->GetName());
|
||||||
params->Set("type", object->GetReflectionType()->GetName());
|
params->Set("type", object->GetReflectionType()->GetName());
|
||||||
params->Set("version", object->GetVersion());
|
params->Set("version", object->GetVersion());
|
||||||
|
params->Set("zone", object->GetZoneName());
|
||||||
|
|
||||||
if (object->GetPackage() == "_api") {
|
if (object->GetPackage() == "_api") {
|
||||||
String file;
|
String file;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user