Improve ID detection for Solaris

This commit is contained in:
Michael Boelen 2016-07-05 12:11:38 +02:00
parent 72ca2b926d
commit b5b8861368
1 changed files with 5 additions and 3 deletions

8
lynis
View File

@ -107,9 +107,11 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta
MYID=""
# Check user to determine file permissions later on. If we encounter Solaris, use related id binary instead
if [ -x /usr/xpg4/bin/id ]; then
MYID=`/usr/xpg4/bin/id -u 2> /dev/null`
else
MYID=`id -u 2> /dev/null`
MYID=$(/usr/xpg4/bin/id -u 2> /dev/null)
elif [ `uname` = "SunOS" ]; then
MYID=$(id | tr '=' ' ' | tr '(' ' ' | awk '{ print $2 }' 2> /dev/null)
else
MYID=$(id -u 2> /dev/null)
fi
if [ "${MYID}" = "" ]; then Display "Could not find user ID with id command. Want to help improving Lynis? Raise a ticket at ${PROGRAM_SOURCE}"; ExitFatal; fi
#