mirror of https://github.com/CISOfy/lynis.git
add symlink support to HasCorrectFilePermissions and IsWorldWritable
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
This commit is contained in:
parent
c105f97efe
commit
f2e49ba74c
|
@ -1306,6 +1306,11 @@
|
||||||
if [ $# -ne 2 ]; then Fatal "Incorrect usage of HasCorrectFilePermissions"; fi
|
if [ $# -ne 2 ]; then Fatal "Incorrect usage of HasCorrectFilePermissions"; fi
|
||||||
CHECKFILE="$1"
|
CHECKFILE="$1"
|
||||||
CHECKPERMISSION_FULL="$2"
|
CHECKPERMISSION_FULL="$2"
|
||||||
|
# Check for symlink
|
||||||
|
if [ -L ${CHECKFILE} ]; then
|
||||||
|
ShowSymlinkPath ${CHECKFILE}
|
||||||
|
if [ ! "${SYMLINK}" = "" ]; then CHECKFILE="${SYMLINK}"; fi
|
||||||
|
fi
|
||||||
if [ ! -d ${CHECKFILE} -a ! -f ${CHECKFILE} ]; then
|
if [ ! -d ${CHECKFILE} -a ! -f ${CHECKFILE} ]; then
|
||||||
return 2
|
return 2
|
||||||
else
|
else
|
||||||
|
@ -2002,7 +2007,11 @@
|
||||||
if [ $# -eq 0 ]; then ExitFatal "Missing parameter when calling IsWorldWritable function"; fi
|
if [ $# -eq 0 ]; then ExitFatal "Missing parameter when calling IsWorldWritable function"; fi
|
||||||
sFILE=$1
|
sFILE=$1
|
||||||
FileIsWorldWritable=""
|
FileIsWorldWritable=""
|
||||||
|
# Check for symlink
|
||||||
|
if [ -L ${sFILE} ]; then
|
||||||
|
ShowSymlinkPath ${sFILE}
|
||||||
|
if [ ! "${SYMLINK}" = "" ]; then sFILE="${SYMLINK}"; fi
|
||||||
|
fi
|
||||||
# Only check if target is a file or directory
|
# Only check if target is a file or directory
|
||||||
if [ -f ${sFILE} -o -d ${sFILE} ]; then
|
if [ -f ${sFILE} -o -d ${sFILE} ]; then
|
||||||
FINDVAL=$(ls -ld ${sFILE} | cut -c 9)
|
FINDVAL=$(ls -ld ${sFILE} | cut -c 9)
|
||||||
|
|
Loading…
Reference in New Issue