]> granicus.if.org Git - icinga2/commitdiff
Fix regression with MatchAny false conditions on match/regex/cidr_match 6498/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Fri, 27 Jul 2018 14:55:37 +0000 (16:55 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Fri, 27 Jul 2018 14:55:37 +0000 (16:55 +0200)
fixes #6496

lib/base/scriptutils.cpp

index cbedd9f975eac53f0a45419a6ba6518632fb1f96..f8ab8ce00005c3e631857f92c996997ec74eca3c 100644 (file)
@@ -147,7 +147,8 @@ bool ScriptUtils::Regex(const std::vector<Value>& args)
                                return false;
                }
 
-               return true;
+               /* MatchAny: Nothing matched. MatchAll: Everything matched. */
+               return mode == MatchAll;
        } else {
                String text = argTexts;
                boost::smatch what;
@@ -189,7 +190,8 @@ bool ScriptUtils::Match(const std::vector<Value>& args)
                                return false;
                }
 
-               return true;
+               /* MatchAny: Nothing matched. MatchAll: Everything matched. */
+               return mode == MatchAll;
        } else {
                String text = argTexts;
                return Utility::Match(pattern, argTexts);
@@ -230,7 +232,8 @@ bool ScriptUtils::CidrMatch(const std::vector<Value>& args)
                                return false;
                }
 
-               return true;
+               /* MatchAny: Nothing matched. MatchAll: Everything matched. */
+               return mode == MatchAll;
        } else {
                String ip = argIps;
                return Utility::CidrMatch(pattern, ip);