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>2022-02-08 13:27:29 +0300
committerGitHub <noreply@github.com>2022-02-08 13:27:29 +0300
commit4ecd03598fd9c3f6bf43ff258d3c3a4634befb30 (patch)
tree7fb76e7699d99fce517a5a0a3299f4ded0605b7d
parent546693636d315d47dd8f488e7c11ac1f9e94df29 (diff)
parentf2e49ba74c04eec4c0dfcddba93e9c360441d1d0 (diff)
Merge pull request #1225 from konstruktoid/ISSUE1214
add symlink support to HasCorrectFilePermissions and IsWorldWritable
-rw-r--r--include/functions11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/functions b/include/functions
index 6c4d76c7..271faf19 100644
--- a/include/functions
+++ b/include/functions
@@ -1306,6 +1306,11 @@
if [ $# -ne 2 ]; then Fatal "Incorrect usage of HasCorrectFilePermissions"; fi
CHECKFILE="$1"
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
return 2
else
@@ -2002,7 +2007,11 @@
if [ $# -eq 0 ]; then ExitFatal "Missing parameter when calling IsWorldWritable function"; fi
sFILE=$1
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
if [ -f ${sFILE} -o -d ${sFILE} ]; then
FINDVAL=$(ls -ld ${sFILE} | cut -c 9)