mirror of https://github.com/Icinga/icinga2.git
Fix match(), regex(), cidr_match() behaviour with MatchAll and empty arrays
fixes #5634
This commit is contained in:
parent
0ca9a1a5b3
commit
c0a3de64fb
|
@ -128,6 +128,9 @@ bool ScriptUtils::Regex(const std::vector<Value>& args)
|
|||
texts->Add(argTexts);
|
||||
}
|
||||
|
||||
if (texts->GetLength() == 0)
|
||||
return false;
|
||||
|
||||
ObjectLock olock(texts);
|
||||
for (const String& text : texts) {
|
||||
bool res = false;
|
||||
|
@ -171,6 +174,9 @@ bool ScriptUtils::Match(const std::vector<Value>& args)
|
|||
texts->Add(argTexts);
|
||||
}
|
||||
|
||||
if (texts->GetLength() == 0)
|
||||
return false;
|
||||
|
||||
ObjectLock olock(texts);
|
||||
for (const String& text : texts) {
|
||||
bool res = Utility::Match(pattern, text);
|
||||
|
@ -207,6 +213,9 @@ bool ScriptUtils::CidrMatch(const std::vector<Value>& args)
|
|||
ips->Add(argIps);
|
||||
}
|
||||
|
||||
if (ips->GetLength() == 0)
|
||||
return false;
|
||||
|
||||
ObjectLock olock(ips);
|
||||
for (const String& ip : ips) {
|
||||
bool res = Utility::CidrMatch(pattern, ip);
|
||||
|
|
Loading…
Reference in New Issue