[icinga-checkins] icinga.org: icinga2/support/2.2: Livestatus: Fix case-insensitive comparison operator

git at icinga.org git at icinga.org
Thu Feb 5 18:07:26 CET 2015


Module: icinga2
Branch: support/2.2
Commit: b18996540339ce8670e309e3f8e0c648d62a076c
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=b18996540339ce8670e309e3f8e0c648d62a076c

Author: Michael Friedrich <michael.friedrich at gmail.com>
Date:   Wed Feb  4 21:52:02 2015 +0100

Livestatus: Fix case-insensitive comparison operator

fixes #8289

Signed-off-by: Michael Friedrich <michael.friedrich at netways.de>

---

 lib/livestatus/attributefilter.cpp |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/livestatus/attributefilter.cpp b/lib/livestatus/attributefilter.cpp
index 3b23be8..18bcab4 100644
--- a/lib/livestatus/attributefilter.cpp
+++ b/lib/livestatus/attributefilter.cpp
@@ -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 {



More information about the icinga-checkins mailing list