Module: check_mk
Branch: master
Commit: 1c07b25b6a258d60452a2d94a4677b6a6ae5ca4d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1c07b25b6a258d…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Jun 1 11:40:57 2016 +0200
Fetched Livestatus from downstream plus associated fixes.
---
livestatus/src/Makefile.am | 1 +
livestatus/src/StringUtils.cc | 40 +++++++++++++++++++++++++++++
livestatus/src/StringUtils.h | 35 +++++++++++++++++++++++++
livestatus/src/TableEventConsole.cc | 2 +-
livestatus/src/TableEventConsoleEvents.cc | 5 ----
5 files changed, 77 insertions(+), 6 deletions(-)
diff --git a/livestatus/src/Makefile.am b/livestatus/src/Makefile.am
index ea5cd64..4177e9c 100644
--- a/livestatus/src/Makefile.am
+++ b/livestatus/src/Makefile.am
@@ -103,6 +103,7 @@ livestatus_so_SOURCES = \
Store.cc \
StringColumn.cc \
StringColumnFilter.cc \
+ StringUtils.cc \
Table.cc \
TableColumns.cc \
TableCommands.cc \
diff --git a/livestatus/src/StringUtils.cc b/livestatus/src/StringUtils.cc
new file mode 100644
index 0000000..92dfe58
--- /dev/null
+++ b/livestatus/src/StringUtils.cc
@@ -0,0 +1,40 @@
+// +------------------------------------------------------------------+
+// | ____ _ _ __ __ _ __ |
+// | / ___| |__ ___ ___| | __ | \/ | |/ / |
+// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+// | | |___| | | | __/ (__| < | | | | . \ |
+// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+// | |
+// | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+// +------------------------------------------------------------------+
+//
+// This file is part of Check_MK.
+// The official homepage is at
http://mathias-kettner.de/check_mk.
+//
+// check_mk is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation in version 2. check_mk is distributed
+// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+// PARTICULAR PURPOSE. See the GNU General Public License for more de-
+// ails. You should have received a copy of the GNU General Public
+// License along with GNU Make; see the file COPYING. If not, write
+// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+#include "StringUtils.h"
+#include <algorithm>
+#include <cctype>
+
+using std::string;
+using std::transform;
+
+namespace mk {
+
+string unsafe_tolower(const string &str) {
+ string result = str;
+ transform(str.begin(), str.end(), result.begin(), ::tolower);
+ return result;
+}
+
+} // namespace
diff --git a/livestatus/src/StringUtils.h b/livestatus/src/StringUtils.h
new file mode 100644
index 0000000..1a81018
--- /dev/null
+++ b/livestatus/src/StringUtils.h
@@ -0,0 +1,35 @@
+// +------------------------------------------------------------------+
+// | ____ _ _ __ __ _ __ |
+// | / ___| |__ ___ ___| | __ | \/ | |/ / |
+// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+// | | |___| | | | __/ (__| < | | | | . \ |
+// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+// | |
+// | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+// +------------------------------------------------------------------+
+//
+// This file is part of Check_MK.
+// The official homepage is at
http://mathias-kettner.de/check_mk.
+//
+// check_mk is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation in version 2. check_mk is distributed
+// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+// PARTICULAR PURPOSE. See the GNU General Public License for more de-
+// ails. You should have received a copy of the GNU General Public
+// License along with GNU Make; see the file COPYING. If not, write
+// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+#ifndef StringUtils_h
+#define StringUtils_h
+
+#include "config.h" // IWYU pragma: keep
+#include <string>
+
+namespace mk {
+std::string unsafe_tolower(const std::string &str);
+} // namespace
+
+#endif // StringUtils_h
diff --git a/livestatus/src/TableEventConsole.cc b/livestatus/src/TableEventConsole.cc
index de22b1c..e9dd5dc 100644
--- a/livestatus/src/TableEventConsole.cc
+++ b/livestatus/src/TableEventConsole.cc
@@ -266,7 +266,7 @@ bool TableEventConsole::receiveReply(int sock, Query *query) {
#ifdef CMC
row._host = (it == row._map.end() || _core == nullptr)
? nullptr
- : _core->_world->getHost(it->second);
+ : _core->_world->getHostByDesignation(it->second);
#else
// Older Nagios headers are not const-correct... :-P
row._host = it == row._map.end()
diff --git a/livestatus/src/TableEventConsoleEvents.cc
b/livestatus/src/TableEventConsoleEvents.cc
index f5b1294..9dad91b 100644
--- a/livestatus/src/TableEventConsoleEvents.cc
+++ b/livestatus/src/TableEventConsoleEvents.cc
@@ -26,11 +26,6 @@
#include <string>
#include "Table.h"
#include "TableHosts.h"
-#ifdef CMC
-#include "Core.h"
-#include "World.h"
-using std::recursive_mutex;
-#endif
using std::string;