mirror of https://github.com/Icinga/icinga2.git
Fix missing config validator for command arguments 'set_if'
fixes #8724
This commit is contained in:
parent
86a1bbf468
commit
7c0749679c
|
@ -72,9 +72,26 @@ void Command::ValidateArguments(const String& location, const Command::Ptr& obje
|
||||||
if (arginfo.IsObjectType<Dictionary>()) {
|
if (arginfo.IsObjectType<Dictionary>()) {
|
||||||
Dictionary::Ptr argdict = arginfo;
|
Dictionary::Ptr argdict = arginfo;
|
||||||
|
|
||||||
if (argdict->Contains("value"))
|
if (argdict->Contains("value")) {
|
||||||
argval = argdict->Get("value");
|
String argvalue = argdict->Get("value");
|
||||||
} else
|
|
||||||
|
if (!MacroProcessor::ValidateMacroString(argvalue)) {
|
||||||
|
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||||
|
location + ": Closing $ not found in macro format string '" + argvalue + "'.", object->GetDebugInfo()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argdict->Contains("set_if")) {
|
||||||
|
String argsetif = argdict->Get("set_if");
|
||||||
|
|
||||||
|
if (!MacroProcessor::ValidateMacroString(argsetif)) {
|
||||||
|
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||||
|
location + ": Closing $ not found in macro format string '" + argsetif + "'.", object->GetDebugInfo()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (arginfo.IsObjectType<Function>()) {
|
||||||
|
continue; /* we cannot evaluate macros in functions */
|
||||||
|
} else {
|
||||||
argval = arginfo;
|
argval = arginfo;
|
||||||
|
|
||||||
if (argval.IsEmpty())
|
if (argval.IsEmpty())
|
||||||
|
@ -88,6 +105,7 @@ void Command::ValidateArguments(const String& location, const Command::Ptr& obje
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Command::ValidateEnvironmentVariables(const String& location, const Command::Ptr& object)
|
void Command::ValidateEnvironmentVariables(const String& location, const Command::Ptr& object)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue