Check if file is symlink or not (#184)

This commit is contained in:
StrangeBubble 2016-05-02 13:23:43 +02:00 committed by Michael Boelen
parent 4913caadbc
commit 81a4821636
1 changed files with 12 additions and 5 deletions

View File

@ -647,13 +647,20 @@
CHECKFILES="/etc/rc /etc/rc.local /etc/rc.d/rc.sysinit"
for I in ${CHECKFILES}; do
if [ -f ${I} ]; then
LogText "Test: Checking ${I} file for writable bit"
if IsWorldWritable ${I}; then
ReportWarning ${TEST_NO} "H" "Found writable startup script ${I}"
ShowSymlinkPath "${I}"
if [ ${FOUNDPATH} -eq 1 ]; then
CHECKFILE="$SYMLINK"
LogText "Result: found the path behind this symlink (${CHECKFILE} --> ${I})"
else
CHECKFILE="$I"
fi
LogText "Test: Checking ${CHECKFILE} file for writable bit"
if IsWorldWritable ${CHECKFILE}; then
ReportWarning ${TEST_NO} "H" "Found writable startup script ${CHECKFILE}"
FOUND=1
LogText "Result: warning, file ${I} is world writable"
LogText "Result: warning, file ${CHECKFILE} is world writable"
else
LogText "Result: good, file ${I} not world writable"
LogText "Result: good, file ${CHECKFILE} not world writable"
fi
fi
done