Module: check_mk
Branch: master
Commit: 922e1aa5a8c9011a3ce05daba2dba32b3f4c6754
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=922e1aa5a8c901…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Aug 31 18:07:50 2015 +0200
Revert "fixes and improvements to the windows agent"
This reverts commit bb9a6d46ba183d848917531b77a143d99c406304.
---
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 307712 -> 302080 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 307712 -> 302080 bytes
agents/windows/check_mk_agent.cc | 33 ++++++----------------
agents/windows/check_mk_agent.exe | Bin 190464 -> 183808 bytes
agents/windows/check_mk_agent.msi | Bin 747008 -> 734720 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 190464 -> 183808 bytes
agents/windows/install_agent-64.exe | Bin 181025 -> 179108 bytes
agents/windows/install_agent.exe | Bin 163071 -> 160059 bytes
9 files changed, 10 insertions(+), 25 deletions(-)
diff --git a/agents/windows/build_version b/agents/windows/build_version
index 9d683f8..7d645f5 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-214
+208
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index c9c1214..a89e9f1 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 0c809f5..854cef4 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 8e07b0f..364a54e 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -561,17 +561,7 @@ void debug_script_container( script_container* container )
crash_log("buffer_work: \n<<<<\n%s\n>>>>",
container->buffer_work);
}
-bool ci_compare_pred(unsigned char lhs, unsigned char rhs)
-{
- return std::tolower(lhs) == std::tolower(rhs);
-}
-// case insensitive compare
-bool ci_equal(const std::string &lhs, const std::string &rhs)
-{
- return std::lexicographical_compare(lhs.begin(), lhs.end(),
- rhs.begin(), rhs.end(), ci_compare_pred);
-}
template <typename FuncT> FuncT dynamic_func(LPCWSTR dllName, LPCSTR funcName) {
HMODULE mod = LoadLibraryW(dllName);
@@ -1817,9 +1807,13 @@ void save_logwatch_offsets()
{
FILE *file = fopen(g_logwatch_statefile, "w");
if (!file) {
- crash_log("Cannot open %s for writing.\n", g_logwatch_statefile);
- // not stopping the agent from crashing. This way the user at least
- // notices something went wrong
+ fprintf(stderr, "Cannot open %s for writing.\n",
g_logwatch_statefile);
+ // what to do, what to do?
+ // If we continue, the whole log will be delivered all the time and
+ // this error message may go unnoticed which will feel like a bug.
+ // Allow the agent to crash? Even more of a bug.
+ // Try to fix the problem automatically? Won't work reliably anyway.
+ exit(1);
}
for (logwatch_textfiles_t::iterator it_tf = g_logwatch_textfiles.begin();
it_tf != g_logwatch_textfiles.end(); it_tf++) {
@@ -1891,7 +1885,7 @@ void save_eventlog_offsets()
for (eventlog_config_t::iterator conf_iter = g_eventlog_config.begin();
conf_iter != g_eventlog_config.end();
++conf_iter) {
- if ((conf_iter->name == "*") || ci_equal(conf_iter->name,
state_iter->name)) {
+ if ((conf_iter->name == "*") || (conf_iter->name ==
state_iter->name)) {
level = conf_iter->level;
break;
}
@@ -2543,7 +2537,7 @@ void section_eventlog(SOCKET &out)
int hide_context = 0;
for (eventlog_config_t::iterator conf_iter = g_eventlog_config.begin();
conf_iter != g_eventlog_config.end();
++conf_iter) {
- if ((conf_iter->name == "*") ||
ci_equal(conf_iter->name, it_st->name)) {
+ if ((conf_iter->name == "*") || (conf_iter->name ==
it_st->name)) {
level = conf_iter->level;
hide_context = conf_iter->hide_context;
break;
@@ -4993,15 +4987,6 @@ void determine_directories(bool use_cwd)
snprintf(g_temp_dir, sizeof(g_temp_dir), "%s\\temp",
g_agent_directory);
snprintf(g_log_dir, sizeof(g_log_dir), "%s\\log",
g_agent_directory);
- char *dirs[] = { g_plugins_dir, g_config_dir, g_local_dir, g_spool_dir, g_state_dir,
g_temp_dir, g_log_dir };
- for (size_t i = 0; i < sizeof(dirs) / sizeof(char*); ++i) {
- if (!CreateDirectoryA(dirs[i], NULL)) {
- if (GetLastError() != ERROR_ALREADY_EXISTS) {
- crash_log("Failed to create directory %s: %s", GetLastError(),
get_last_error_as_string().c_str());
- }
- }
- }
-
snprintf(g_logwatch_statefile, sizeof(g_logwatch_statefile),
"%s\\logstate.txt", g_state_dir);
snprintf(g_eventlog_statefile, sizeof(g_eventlog_statefile),
"%s\\eventstate.txt", g_state_dir);
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index e256d3a..ae2db3a 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 c0a28da..042c8a3 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 aefd2bc..865f9df 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 a3b6674..4f0dd81 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 07c47cb..79080cb 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ