From 4d5a0c59c783d0d644fc8b0dd8fe45745ce2d5a1 Mon Sep 17 00:00:00 2001 From: David <2069735+Marzal@users.noreply.github.com> Date: Thu, 18 Jul 2019 18:52:36 +0200 Subject: [PATCH 1/2] Fix find fields in new profile format New format uses permfile= so it needs a new cut to filter the name file --- include/tests_file_permissions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/tests_file_permissions b/include/tests_file_permissions index 2c43fc0e..108b830e 100644 --- a/include/tests_file_permissions +++ b/include/tests_file_permissions @@ -34,7 +34,7 @@ LogText "Test: Checking file permissions" for PROFILE in ${PROFILES}; do LogText "Using profile ${PROFILE} for baseline." - FIND=$(${EGREPBINARY} '^permfile=|^permdir=' ${PROFILE} | ${CUTBINARY} -d= -f2) + FIND=$(${EGREPBINARY} '^permfile=|^permdir=' ${PROFILE} | ${CUTBINARY} -d= -f2 | ${CUTBINARY} -d: -f1) for I in ${FIND}; do LogText "Checking ${I}" CheckFilePermissions "${I}" From b8a0190e82125a17eb82a36402cb7ae0321cd6b3 Mon Sep 17 00:00:00 2001 From: David <2069735+Marzal@users.noreply.github.com> Date: Thu, 18 Jul 2019 18:58:11 +0200 Subject: [PATCH 2/2] Fix grep in PROFILEVALUE Make it work with new profile format --- include/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/functions b/include/functions index 24facbdc..87286aa1 100644 --- a/include/functions +++ b/include/functions @@ -208,10 +208,10 @@ # If 'file' is an directory, use -d if [ -d ${CHECKFILE} ]; then FILEVALUE=$(ls -d -l ${CHECKFILE} | cut -c 2-10) - PROFILEVALUE=$(grep '^permdir' ${PROFILE} | grep ":${CHECKFILE}:" | cut -d: -f3) + PROFILEVALUE=$(grep '^permdir' ${PROFILE} | grep "=${CHECKFILE}:" | cut -d: -f2) else FILEVALUE=$(ls -l ${CHECKFILE} | cut -c 2-10) - PROFILEVALUE=$(grep '^permfile' ${PROFILE} | grep ":${CHECKFILE}:" | cut -d: -f3) + PROFILEVALUE=$(grep '^permfile' ${PROFILE} | grep "=${CHECKFILE}:" | cut -d: -f2) fi if [ "${FILEVALUE}" = "${PROFILEVALUE}" ]; then PERMS="OK"; else PERMS="BAD"; fi fi