From c3494b32d180bd6406f3614d4bb1ac59009b2031 Mon Sep 17 00:00:00 2001 From: mboelen Date: Mon, 8 Sep 2014 19:59:01 +0200 Subject: [PATCH] Properly check if CheckUpdates output is usable for display --- include/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/functions b/include/functions index c0cb7ef5..86d2fefb 100644 --- a/include/functions +++ b/include/functions @@ -111,13 +111,13 @@ PROGRAM_LV="0000000000"; DB_MALWARE_LV="0000000000"; DB_FILEPERMS_LV="0000000000" FIND=`which dig 2> /dev/null` if [ ! "${FIND}" = "" ]; then - PROGRAM_LV=`dig +short -t txt lynis-lv.rootkit.nl 2> /dev/null | sed 's/[".]//g'` + PROGRAM_LV=`dig +short +time=3 -t txt lynis-lv.rootkit.nl 2> /dev/null | grep -v "connection timed out" | sed 's/[".]//g'` #DB_MALWARE_LV=`dig +short -t txt lynis-mw.rootkit.nl 2> /dev/null | sed 's/[".]//g'` #DB_FILEPERMS_LV=`dig +short -t txt lynis-fp.rootkit.nl 2> /dev/null | sed 's/[".]//g'` else FIND=`which host 2> /dev/null` if [ ! "${FIND}" = "" ]; then - PROGRAM_LV=`host -t txt lynis-lv.rootkit.nl 2> /dev/null | awk '{ if ($1=="lynis-lv.rootkit.nl" && $3=="text") { print $4 }}' | sed 's/"//g'` + PROGRAM_LV=`host -t txt -W 3 lynis-lv.rootkit.nl 2> /dev/null | grep -v "connection timed out" | awk '{ if ($1=="lynis-lv.rootkit.nl" && $3=="text") { print $4 }}' | sed 's/"//g'` if [ "${PROGRAM_LV}" = "" ]; then PROGRAM_LV=0; fi else logtext "Result: dig and host not installed, update check skipped"