Module: check_mk
Branch: master
Commit: d8099b8fe58551471e62547bcd8d3047a0842c76
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d8099b8fe58551…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Feb 29 11:27:35 2016 +0100
#3084 FIX windows agent: fixed crash when specifying an invalid performance counter
---
.werks/3084 | 10 ++++
ChangeLog | 1 +
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 909824 -> 910336 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 909824 -> 910336 bytes
agents/windows/check_mk_agent.cc | 56 ++++++++++++----------
agents/windows/check_mk_agent.exe | Bin 835584 -> 836096 bytes
agents/windows/check_mk_agent.msi | Bin 2006016 -> 2007040 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 835584 -> 836096 bytes
agents/windows/install_agent-64.exe | Bin 418319 -> 418357 bytes
agents/windows/install_agent.exe | Bin 408689 -> 408775 bytes
11 files changed, 42 insertions(+), 27 deletions(-)
diff --git a/.werks/3084 b/.werks/3084
new file mode 100644
index 0000000..fbeae04
--- /dev/null
+++ b/.werks/3084
@@ -0,0 +1,10 @@
+Title: windows agent: fixed crash when specifying an invalid performance counter
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1456741537
+
+
diff --git a/ChangeLog b/ChangeLog
index 0bb1187..3d7dc78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,7 @@
* 3243 FIX: Fix missing custom graphs in sidebar snapin Views if explicit topic is
set
* 3245 FIX: Fix interpretation of check levels 0.0 as "no levels"...
* 3250 FIX: cisco_mem: remove bogus memory check for "Driver text"...
+ * 3084 FIX: windows agent: fixed crash when specifying an invalid performance
counter
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/windows/build_version b/agents/windows/build_version
index 7776e09..e847bdc 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-1358
+1364
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 100123c..202327b 100755
Binary files a/agents/windows/check_mk_agent-64.exe and
b/agents/windows/check_mk_agent-64.exe differ
diff --git a/agents/windows/check_mk_agent-64.unversioned.exe
b/agents/windows/check_mk_agent-64.unversioned.exe
index 1a8714e..dcd99f0 100755
Binary files a/agents/windows/check_mk_agent-64.unversioned.exe and
b/agents/windows/check_mk_agent-64.unversioned.exe differ
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index c654791..427b2b6 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -586,36 +586,40 @@ void dump_performance_counters(OutputProxy &out, unsigned
counter_base_number,
const char *countername) {
crash_log("<<<winperf_%s>>>", countername);
- PerfCounterObject counterObject(counter_base_number);
-
- if (!counterObject.isEmpty()) {
- LARGE_INTEGER Frequency;
- QueryPerformanceFrequency(&Frequency);
- out.output("<<<winperf_%s>>>\n", countername);
- out.output("%.2f %u %" PRId64 "\n", current_time(),
counter_base_number,
- Frequency.QuadPart);
-
- std::vector<PERF_INSTANCE_DEFINITION *> instances =
- counterObject.instances();
- // output instances - if any
- if (instances.size() > 0) {
- out.output("%d instances:",
static_cast<int>(instances.size()));
- for (std::wstring name : counterObject.instanceNames()) {
- std::replace(name.begin(), name.end(), L' ', L'_');
- out.output(" %s", to_utf8(name.c_str()).c_str());
+ try {
+ PerfCounterObject counterObject(counter_base_number);
+
+ if (!counterObject.isEmpty()) {
+ LARGE_INTEGER Frequency;
+ QueryPerformanceFrequency(&Frequency);
+ out.output("<<<winperf_%s>>>\n", countername);
+ out.output("%.2f %u %" PRId64 "\n", current_time(),
counter_base_number,
+ Frequency.QuadPart);
+
+ std::vector<PERF_INSTANCE_DEFINITION *> instances =
+ counterObject.instances();
+ // output instances - if any
+ if (instances.size() > 0) {
+ out.output("%d instances:",
static_cast<int>(instances.size()));
+ for (std::wstring name : counterObject.instanceNames()) {
+ std::replace(name.begin(), name.end(), L' ', L'_');
+ out.output(" %s", to_utf8(name.c_str()).c_str());
+ }
+ out.output("\n");
}
- out.output("\n");
- }
- // output counters
- for (const PerfCounter &counter : counterObject.counters()) {
- out.output("%d", static_cast<int>(counter.titleIndex()) -
- static_cast<int>(counter_base_number));
- for (ULONGLONG value : counter.values(instances)) {
- out.output(" %" PRIu64, value);
+ // output counters
+ for (const PerfCounter &counter : counterObject.counters()) {
+ out.output("%d", static_cast<int>(counter.titleIndex())
-
+ static_cast<int>(counter_base_number));
+ for (ULONGLONG value : counter.values(instances)) {
+ out.output(" %" PRIu64, value);
+ }
+ out.output(" %s\n", counter.typeName().c_str());
}
- out.output(" %s\n", counter.typeName().c_str());
}
+ } catch (const std::exception &e) {
+ crash_log("Exception: %s", e.what());
}
}
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 77800b6..920b73e 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/agents/windows/check_mk_agent.msi b/agents/windows/check_mk_agent.msi
index 994de6b..506e786 100755
Binary files a/agents/windows/check_mk_agent.msi and b/agents/windows/check_mk_agent.msi
differ
diff --git a/agents/windows/check_mk_agent.unversioned.exe
b/agents/windows/check_mk_agent.unversioned.exe
index e1f7237..82df89c 100755
Binary files a/agents/windows/check_mk_agent.unversioned.exe and
b/agents/windows/check_mk_agent.unversioned.exe differ
diff --git a/agents/windows/install_agent-64.exe b/agents/windows/install_agent-64.exe
index cc4cff8..92c6baf 100755
Binary files a/agents/windows/install_agent-64.exe and
b/agents/windows/install_agent-64.exe differ
diff --git a/agents/windows/install_agent.exe b/agents/windows/install_agent.exe
index af99acc..57f90ad 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ