From 7cb9e364c77cd67caa27081164e4d9588b3b74c4 Mon Sep 17 00:00:00 2001 From: mboelen Date: Mon, 31 Aug 2015 13:23:17 +0200 Subject: [PATCH] Proper filtering for IPv6 addresses --- include/tests_nameservices | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/tests_nameservices b/include/tests_nameservices index 6aedd833..0a7b8d56 100644 --- a/include/tests_nameservices +++ b/include/tests_nameservices @@ -566,7 +566,7 @@ if [ ${SKIPTEST} -eq 0 ]; then logtext "Test: Check /etc/hosts contains an entry for this server name" if [ -f /etc/hosts ]; then - sFIND=`cat /etc/hosts | egrep -v '^(#|$|::1|localhost)' | grep ${HOSTNAME}` + sFIND=`cat /etc/hosts | egrep -v '^(#|$|^::1\s|localhost)' | grep ${HOSTNAME}` if [ "${sFIND}" != "" ]; then logtext "Result: Found entry for ${HOSTNAME} in /etc/hosts" Display --indent 4 --text "- Checking /etc/hosts (hostname)" --result OK --color GREEN @@ -587,7 +587,7 @@ Register --test-no NAME-4406 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check server hostname mapping" if [ ${SKIPTEST} -eq 0 ]; then logtext "Test: Check server hostname not locally mapped in /etc/hosts" - sFIND=`cat /etc/hosts | egrep -v '^(#|$)' | egrep '(localhost|::1)' | grep ${HOSTNAME}` + sFIND=`cat /etc/hosts | egrep -v '^(#|$)' | egrep '(localhost|^::1\s)' | grep ${HOSTNAME}` if [ ! "${sFIND}" = "" ]; then logtext "Result: Found this server hostname mapped to a local address" Display --indent 4 --text "- Checking /etc/hosts (localhost)" --result SUGGESTION --color YELLOW