Module: check_mk
Branch: master
Commit: c67aedcf1e9d6a6e63e6d536e32a41babbd9c406
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c67aedcf1e9d6a…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Nov 28 09:06:33 2011 +0100
livecheck: fixed running inventory check
---
.bugs/474 | 11 ++++++++---
livestatus/src/check_icmp.c | 3 +--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/.bugs/474 b/.bugs/474
index 6d82dbc..b823663 100644
--- a/.bugs/474
+++ b/.bugs/474
@@ -1,11 +1,16 @@
Title: Check plugins are executed as root
Component: livecheck
-Benefit: 2
-State: open
Cost: 1
Date: 2011-11-28 08:20:20
-Targetversion: 1.1.13i1
+State: done
Class: bug
+Benefit: 2
+Fun: 0
+Targetversion: 1.1.13i1
Currently livecheck seems to execute all plugins as root.
This needs to be changed to the normal user.
+
+2011-11-28 09:06:18: changed state open -> done
+The problem in fact was that the inline check_icmp deleted the
+environment and bin/check_mk was missing OMD_ROOT.
diff --git a/livestatus/src/check_icmp.c b/livestatus/src/check_icmp.c
index 5c6ce0f..9f36b0b 100644
--- a/livestatus/src/check_icmp.c
+++ b/livestatus/src/check_icmp.c
@@ -182,7 +182,6 @@ static void crash(const char *, ...);
/** external **/
extern int optind, opterr, optopt;
extern char *optarg;
-extern char **environ;
/** global variables **/
static struct rta_host **table, *cursor, *list;
@@ -413,7 +412,7 @@ int check_icmp(int argc, char **argv, char *output, int size)
icmp_sockerrno = 0;
/* POSIXLY_CORRECT might break things, so unset it (the portable way) */
- environ = NULL;
+ unsetenv("POSIXLY_CORRECT");
/* use the pid to mark packets as ours */
/* Some systems have 32-bit pid_t so mask off only 16 bits */