Module: check_mk
Branch: master
Commit: 86ea4afaa39dcacbf65d85948f70a13104b773dc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=86ea4afaa39dca…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Aug 12 11:54:32 2011 +0200
Windows agent: handle quotes in directory name
In 64 Bit systems there is reported to be quotes in the registry
entry of the services directory. These quotes are now removed.
Unfortunately I could not test this myself. The normal case is
still working.
---
ChangeLog | 1 +
agents/windows/check_mk_agent.cc | 8 +++++++-
agents/windows/check_mk_agent.exe | Bin 96768 -> 96768 bytes
3 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 73886d4..c858576 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@
* FIX: lnx_if/if/if64: ignore percentual traffic levels on NICs without
speed information.
* FIX: cisco_temp_perf: add critical level to performance data
+ * FIX: windows agent: hopefully fix case with quotes in directory name
* brocade_port: check for Brocade FC ports has been rewritten with
lots of new features.
* AIX agent now simulates <<<netctr>>> output (by Jörg Linge)
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index 67689cc..ecef22c 100755
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -1139,8 +1139,14 @@ void get_agent_dir(char *buffer, int size)
while (end > buffer && *end != '\\')
end--;
*end = 0; // replace \ with string end => get directory of executable
+
+ // Handle case where name is quoted with double quotes.
+ // This is reported to happen on some 64 Bit systems when spaces
+ // are in the directory name.
+ if (*buffer == '"') {
+ memmove(buffer, buffer + 1, strlen(buffer));
+ }
}
- size = dsize;
RegCloseKey(key);
}
else {
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index bce338b..fff041c 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ