]> granicus.if.org Git - icinga2/commitdiff
Livestatus: Fix case-insensitive comparison operator
authorMichael Friedrich <michael.friedrich@gmail.com>
Wed, 4 Feb 2015 20:52:02 +0000 (21:52 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 5 Feb 2015 17:06:10 +0000 (18:06 +0100)
fixes #8289

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>
lib/livestatus/attributefilter.cpp

index 60b72c8a30126637b7787f95b23f69e0c758c4df..6ce42a0f9c32c68d226585ce94c2b5b29e333724 100644 (file)
@@ -24,6 +24,7 @@
 #include "base/logger.hpp"
 #include <boost/foreach.hpp>
 #include <boost/regex.hpp>
+#include <boost/algorithm/string/predicate.hpp>
 
 using namespace icinga;
 
@@ -80,7 +81,17 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row)
 
                        return ret;
                } else if (m_Operator == "=~") {
-                       return string_iless()(value, m_Operand);
+                       bool ret;
+                       try {
+                               String operand = value;
+                               ret = boost::iequals(operand, m_Operand.GetData());
+                       } catch (boost::exception&) {
+                               Log(LogWarning, "AttributeFilter")
+                                   << "Case-insensitive equality '" << m_Operand << " " << m_Operator << " " << value << "' error.";
+                               ret = false;
+                       }
+
+                       return ret;
                } else if (m_Operator == "~~") {
                        bool ret;
                        try {