Module: check_mk
Branch: master
Commit: 7572e5a666e3026311c499e68581025d65668cbf
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7572e5a666e302…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Apr 9 14:17:06 2013 +0200
FIX: correctly quote ! and \ in active checks for Nagios
Conflicts:
ChangeLog
---
ChangeLog | 4 ++++
modules/check_mk_base.py | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a7deb2c..6e7c1c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -91,6 +91,10 @@
* Configuration of an alternativ host check command
* Inventory: Display link symbol for ps ruleset
+1.2.2p1:
+ Core:
+ * FIX: correctly quote ! and \ in active checks for Nagios
+
1.2.2:
Core:
* Added $HOSTURL$ and $SERVICEURL$ to notification macros which contain an
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 46a7b57..46b61f7 100755
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -1449,9 +1449,10 @@ def get_age_human_readable(secs):
return "%d days" % days
# Quote string for use as arguments on the shell (for usage
-# in command definitions as $ARG1$)
+# in command definitions as $ARG1$). Please note that also
+# quoting for ! and \ vor Nagios itself takes place here.
def quote_shell_string(s):
- return "'" + s.replace("'", "'\"'\"'") + "'"
+ return "'" + s.replace('\\', '\\\\').replace("'", "'\"'\"'").replace('!', '\\!') + "'"
# Check if a timeperiod is currently active. We have no other way than