2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Changed to a more secure way of handling tempfiles

This commit is contained in:
Finn Andersen 2014-10-30 09:56:25 +01:00
parent 31f5cc79db
commit 771fb2dd72

View File

@ -32,6 +32,7 @@ GPLv2
#
# HISTORY
# v1.0 : Initial release
# 1.0.1 : More secure handling of tempfiles
#
###############################################
#
@ -115,7 +116,7 @@ esac
# Location and name of tempfile to parse
FILENAME=/tmp/cisco_epc3010.dump
FILENAME=$(mktemp /tmp/cisco_epc3010-XXXX.dump) || exit 1
# Get statuspage from the modem
@ -130,7 +131,7 @@ UP_PWR_ARRAY=( 0 $(cat $FILENAME | grep " up_pwr" | awk -F "nowrap>| <script" '
#
# Downstream info - Modem outputs both PowerLevels and Signal to Noise Ratio
# Downstream info - Modem outputs both Power Levels and Signal to Noise Ratio
#
if [ "$DIRECTION" == "downstream" ]; then
@ -152,7 +153,7 @@ fi
#
# Upstream info - Modem outputs PowerLevels
# Upstream info - Modem outputs Power Levels
#
if [ "$DIRECTION" == "upstream" ]; then
@ -168,4 +169,6 @@ fi
#
# Remove tempory file, used for parsing data
#
rm -f $FILENAME
trap "rm -rf $FILENAME" EXIT