Fix: ConfigItem types and names are not case-insensitive

Fixes #4044
This commit is contained in:
Gunnar Beutner 2013-05-08 10:46:50 +02:00
parent aaac957ad5
commit b4fa556ac6
3 changed files with 18 additions and 3 deletions

View File

@ -24,6 +24,7 @@
#include <boost/range/iterator.hpp>
#include <ostream>
#include <istream>
#include <utility>
namespace icinga {
@ -155,6 +156,20 @@ struct string_iless : std::binary_function<String, String, bool>
}
};
struct pair_string_iless : std::binary_function<std::pair<String, String>, std::pair<String, String>, bool>
{
bool operator()(const std::pair<String, String>& p1, const std::pair<String, String>& p2) const
{
if (string_iless()(p1.first, p2.first))
return true;
if (string_iless()(p2.first, p1.first))
return false;
return string_iless()(p1.second, p2.second);
}
};
}
namespace boost

View File

@ -82,9 +82,9 @@ private:
int m_Flags;
std::vector<ConfigItem::Ptr> m_Items;
std::map<std::pair<String, String>, ConfigItem::Ptr> m_ItemsMap;
std::map<std::pair<String, String>, ConfigItem::Ptr, pair_string_iless> m_ItemsMap;
std::map<String, shared_ptr<ConfigType> > m_Types;
std::map<String, shared_ptr<ConfigType>, string_iless> m_Types;
std::vector<ConfigCompilerError> m_Errors;

View File

@ -99,7 +99,7 @@ private:
static boost::mutex m_Mutex;
typedef std::map<std::pair<String, String>, ConfigItem::Ptr> ItemMap;
typedef std::map<std::pair<String, String>, ConfigItem::Ptr, pair_string_iless> ItemMap;
static ItemMap m_Items; /**< All registered configuration items. */
static ConfigItem::Ptr GetObjectUnlocked(const String& type,