Livestatus: Fix case-insensitive comparison operator

fixes #8289

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>
This commit is contained in:
Michael Friedrich 2015-02-04 21:52:02 +01:00 committed by Michael Friedrich
parent f8bcc9c83f
commit d868930525
1 changed files with 12 additions and 1 deletions

View 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 {