Use CreateTempFile for creation of temporary files

This commit is contained in:
mboelen 2016-01-11 01:04:38 +01:00
parent 1cb90916ee
commit e0e56f2cdc
3 changed files with 10 additions and 8 deletions

View File

@ -84,11 +84,12 @@ if [ "$1" = "release" ]; then
# Normal update
FULLPATH="${UPDATE_SERVER_PROTOCOL}://${UPDATE_SERVER_ADDRESS}${UPDATE_LATEST_VERSION_INFO}"
TMP_FILE=`mktemp /tmp/audit.XXXXXXXXXX`
if [ "${TMP_FILE}" = "" ]; then
Display --indent 2 --text "Could not create a temporary file in /tmp with mktemp. Aborting.."
ExitFatal
fi
# Create temporary file
CreateTempFile
TMP_FILE="${TEMP_FILE}"
if [ "${TMP_FILE}" = "" ]; then Display --indent 2 --text "Could not create a temporary file. Exiting..."; ExitFatal; fi
Display --indent 2 --text "${CYAN}[Phase 1] Downloading details${NORMAL}"
if [ ! "${WGET_EXISTS}" = "" ]; then
logtext "Using wget to download release information"

View File

@ -285,7 +285,8 @@
if [ ! "${FIND}" = "" ]; then
if [ -x "${FIND}" -a ! -L "${FIND}" ]; then
LogText "Result: found ${FIND} as a valid shell"
SHELLSHOCK_TMP=`mktemp /tmp/lynis-shellshock-test.XXXXXXXXXX` || exit 1
CreateTempFile || ExitFatal
SHELLSHOCK_TMP="${TEMP_FILE}"
# CVE-2014-6271
LogText "Test: Check for first exploit (CVE-2014-6271)"

View File

@ -36,9 +36,9 @@
/usr/local/etc/apache /usr/local/etc/apache2 /usr/local/etc/apache22 \
/usr/pkg/etc/httpd /etc/sysconfig/apache2"
CreateTempFile
CreateTempFile || ExitFatal
TMPFILE="${TEMP_FILE}"
CreateTempFile
CreateTempFile || ExitFatal
TMPFILE2="${TEMP_FILE}"
#
#################################################################################