Module: check_mk
Branch: master
Commit: 46470bdcd889bfc8ec0310547a835d0e6309eb59
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=46470bdcd889bf…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Mar 3 14:12:35 2015 +0100
#2051 FIX windows agent: no longer outputs stderr of local and plugin scripts
Unlike the linux agents, the windows agent did output data from stderr.
This caused invalid formatted sections in case of (tolerable) errors.
---
.werks/2051 | 10 ++++++++++
ChangeLog | 1 +
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 300032 -> 300032 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 300032 -> 300032 bytes
agents/windows/check_mk_agent.cc | 11 ++++++++++-
agents/windows/check_mk_agent.exe | Bin 181760 -> 181760 bytes
agents/windows/check_mk_agent.msi | Bin 716288 -> 716288 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 181760 -> 181760 bytes
agents/windows/install_agent-64.exe | Bin 177830 -> 177834 bytes
agents/windows/install_agent.exe | Bin 158790 -> 158868 bytes
11 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/.werks/2051 b/.werks/2051
new file mode 100644
index 0000000..9e2f7c6
--- /dev/null
+++ b/.werks/2051
@@ -0,0 +1,10 @@
+Title: windows agent: no longer outputs stderr of local and plugin scripts
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1425388179
+Class: fix
+
+Unlike the linux agents, the windows agent did output data from stderr.
+This caused invalid formatted sections in case of (tolerable) errors.
diff --git a/ChangeLog b/ChangeLog
index c23e445..993d7d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -219,6 +219,7 @@
* 2050 FIX: netapp_api_if: Fixed invalid speed warning for virtual interface
groups...
* 2086 FIX: apc_ats_status: Fixed exception when source different than selected
source
* 2087 FIX: netapp_api_temp: Fixed exception when dealing with old discovered
checks...
+ * 2051 FIX: windows agent: no longer outputs stderr of local and plugin scripts...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/agents/windows/build_version b/agents/windows/build_version
index c8b255f..065fd3e 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-135
+137
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 8b2ce71..0b601da 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 47692f8..8247c28 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 b49497d..1d4f63f 100755
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -2854,7 +2854,15 @@ int launch_program(script_container* cont)
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
si.hStdOutput = newstdout;
- si.hStdError = newstdout;
+
+
+ // Redirect sterr to NUL device
+ SECURITY_ATTRIBUTES secattr;
+ secattr.nLength = sizeof secattr;
+ secattr.lpSecurityDescriptor = NULL;
+ secattr.bInheritHandle = TRUE;
+ HANDLE hnul = CreateFile("NUL", GENERIC_WRITE, 0, &secattr,
OPEN_EXISTING, 0, NULL);
+ si.hStdError = hnul;
// spawn the child process
if (!CreateProcess(NULL,cont->path,NULL,NULL,TRUE,CREATE_NEW_CONSOLE,
@@ -2935,6 +2943,7 @@ int launch_program(script_container* cont)
CloseHandle(pi.hProcess);
CloseHandle(newstdout);
CloseHandle(read_stdout);
+ CloseHandle(hnul);
return exit_code;
}
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 36c527a..92111a6 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 c0f3b80..ea97741 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 8593dd1..b5b5eda 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 812e260..18edc83 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 34ec659..c1e1ab0 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ