Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Boelen <michael.boelen@cisofy.com>2018-03-05 13:43:33 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2018-03-05 13:43:33 +0300
commita7845b674814880c8f928d88d7888c8945197be0 (patch)
tree1e6701634ab9f936ba666e29c32ed1be31692ad9 /include/tests_nameservices
parentdabf7d3e8097608cec091e65d91315537a55e666 (diff)
[NAME-4402] Enhanced test to filter out empty lines
Diffstat (limited to 'include/tests_nameservices')
-rw-r--r--include/tests_nameservices10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/tests_nameservices b/include/tests_nameservices
index 132f4e14..2a36062d 100644
--- a/include/tests_nameservices
+++ b/include/tests_nameservices
@@ -573,19 +573,19 @@
if [ ${SKIPTEST} -eq 0 ]; then
LogText "Test: check duplicate line in ${ROOTDIR}etc/hosts"
if [ -f ${ROOTDIR}etc/hosts ]; then
- sFIND=$(${EGREPBINARY} -v '^(#|$)' ${ROOTDIR}etc/hosts | ${AWKBINARY} '{ print $1, $2 }' | ${SORTBINARY} | ${UNIQBINARY} -d)
- if [ "${sFIND}" = "" ]; then
+ OUTPUT=$(${AWKBINARY} '{ print $1, $2 }' ${ROOTDIR}etc/hosts | ${EGREPBINARY} -v '^(#|$)' | ${EGREPBINARY} "[a-f0-9]" | ${SORTBINARY} | ${UNIQBINARY} -d)
+ if [ -z "${OUTPUT}" ]; then
LogText "Result: OK, no duplicate lines found"
Display --indent 4 --text "- Checking ${ROOTDIR}etc/hosts (duplicates)" --result "${STATUS_OK}" --color GREEN
else
- LogText "Found duplicate line: ${sFIND}"
+ LogText "Found duplicate line: ${OUTPUT}"
LogText "Result: found duplicate line"
Display --indent 4 --text "- Checking ${ROOTDIR}etc/hosts (duplicates)" --result "${STATUS_SUGGESTION}" --color YELLOW
ReportSuggestion "${TEST_NO}" "Remove duplicate lines in ${ROOTDIR}etc/hosts"
fi
else
- LogText "Result: ${ROOTDIR}etc/hosts not found, test skipped"
- Display --indent 4 --text "Searching duplicate line" --result "${STATUS_SKIPPED}" --color YELLOW
+ LogText "Result: ${ROOTDIR}etc/hosts not found, test skipped"
+ Display --indent 4 --text "Searching duplicate line" --result "${STATUS_SKIPPED}" --color YELLOW
fi
fi
#