From d868930525e01e23fa12db622c9019a9a8b6fa4f Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 4 Feb 2015 21:52:02 +0100 Subject: [PATCH] Livestatus: Fix case-insensitive comparison operator fixes #8289 Signed-off-by: Michael Friedrich --- 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 60b72c8a3..6ce42a0f9 100644 --- a/lib/livestatus/attributefilter.cpp +++ b/lib/livestatus/attributefilter.cpp @@ -24,6 +24,7 @@ #include "base/logger.hpp" #include #include +#include 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 {