Module: check_mk
Branch: master
Commit: e1b633ad0fe84f3a1c2ce7923349bc0661d0034f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e1b633ad0fe84f…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Jul 24 09:54:09 2018 +0200
6318 FIX check_mk_agent.{linux,solaris,openwrt}: Quote command line in asynchronous MRPE
call to prevent globbing and word splitting
Change-Id: Ie64b0bc8f3f11dc6c5885949897b2528a7cfc502
---
.werks/6318 | 10 ++++++++++
agents/check_mk_agent.linux | 4 ++--
agents/check_mk_agent.openwrt | 4 ++--
agents/check_mk_agent.solaris | 4 ++--
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/.werks/6318 b/.werks/6318
new file mode 100644
index 0000000..8f11e7b
--- /dev/null
+++ b/.werks/6318
@@ -0,0 +1,10 @@
+Title: check_mk_agent.{linux,solaris,openwrt}: Quote command line in asynchronous MRPE
call to prevent globbing and word splitting
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1532418648
+Class: fix
+
+
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 8b7d8c4..93ca7e4 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -264,9 +264,9 @@ function run_cached () {
if [ -z "$USE_CACHEFILE" ] && [ ! -e "$CACHEFILE.new" ] ;
then
# When the command fails, the output is throws away ignored
if [ $mrpe -eq 1 ] ; then
- echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; run_mrpe $NAME $CMDLINE && mv \"$CACHEFILE.new\"
\"$CACHEFILE\" || rm -f \"$CACHEFILE\"
\"$CACHEFILE.new\"" | nohup /bin/bash >/dev/null 2>&1 &
+ echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; run_mrpe $NAME \"$CMDLINE\" && mv \"$CACHEFILE.new\"
\"$CACHEFILE\" || rm -f \"$CACHEFILE\"
\"$CACHEFILE.new\"" | nohup /bin/bash >/dev/null 2>&1 &
else
- echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f
\"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup /bin/bash
>/dev/null 2>&1 &
+ echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; \"$CMDLINE\" && mv \"$CACHEFILE.new\"
\"$CACHEFILE\" || rm -f \"$CACHEFILE\"
\"$CACHEFILE.new\"" | nohup /bin/bash >/dev/null 2>&1 &
fi
fi
}
diff --git a/agents/check_mk_agent.openwrt b/agents/check_mk_agent.openwrt
index 463e56a..fdea879 100755
--- a/agents/check_mk_agent.openwrt
+++ b/agents/check_mk_agent.openwrt
@@ -167,9 +167,9 @@ run_cached () {
# When the command fails, the output is throws away ignored
if [ $mrpe -eq 1 ] ; then
# TODO: This won't work: run_mrpe is not exported. And do we have bash at
all?
- echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; run_mrpe $NAME $CMDLINE && mv \"$CACHEFILE.new\"
\"$CACHEFILE\" || rm -f \"$CACHEFILE\"
\"$CACHEFILE.new\"" | nohup bash >/dev/null 2>&1 &
+ echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; run_mrpe $NAME \"$CMDLINE\" && mv \"$CACHEFILE.new\"
\"$CACHEFILE\" || rm -f \"$CACHEFILE\"
\"$CACHEFILE.new\"" | nohup bash >/dev/null 2>&1 &
else
- echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f
\"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup bash >/dev/null
2>&1 &
+ echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; \"$CMDLINE\" && mv \"$CACHEFILE.new\"
\"$CACHEFILE\" || rm -f \"$CACHEFILE\"
\"$CACHEFILE.new\"" | nohup bash >/dev/null 2>&1 &
fi
fi
}
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 7afe5b5..0aefef3 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -123,9 +123,9 @@ function run_cached () {
# Cache file outdated and new job not yet running? Start it
if [ -z "$USE_CACHEFILE" ] && [ ! -e "$CACHEFILE.new" ] ;
then
if [ $mrpe -eq 1 ] ; then
- echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; run_mrpe $NAME $CMDLINE && mv \"$CACHEFILE.new\"
\"$CACHEFILE\" || rm -f \"$CACHEFILE\"
\"$CACHEFILE.new\"" | nohup /usr/bin/bash >/dev/null 2>&1 &
+ echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; run_mrpe $NAME \"$CMDLINE\" && mv \"$CACHEFILE.new\"
\"$CACHEFILE\" || rm -f \"$CACHEFILE\"
\"$CACHEFILE.new\"" | nohup /usr/bin/bash >/dev/null 2>&1 &
else
- echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f
\"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup /usr/bin/bash
>/dev/null 2>&1 &
+ echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit
1 ; \"$CMDLINE\" && mv \"$CACHEFILE.new\"
\"$CACHEFILE\" || rm -f \"$CACHEFILE\"
\"$CACHEFILE.new\"" | nohup /usr/bin/bash >/dev/null 2>&1 &
fi
fi
}