diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2016-10-27 10:13:57 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2016-10-27 10:13:57 +0300 |
commit | 0d66aec62c76c3ce120cdd9de36bb7249e929b0b (patch) | |
tree | 85e7b2d1d3aca1d7ee56898609cf2c37d79a3320 | |
parent | ef7a1209977c501208dd4531ccc019ea18057e96 (diff) |
[AUTH-9234] style and enhanced support for macOS
-rw-r--r-- | include/tests_authentication | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/tests_authentication b/include/tests_authentication index 45e97b3c..4ba9c6d0 100644 --- a/include/tests_authentication +++ b/include/tests_authentication @@ -306,7 +306,15 @@ "MacOS") LogText "macOS real users output (ID = 0, or 500-599)" - FIND=$(dscacheutil -q user | grep -A 3 -B 2 -e uid:\ 5'[0-9][0-9]') + FIND_USERS=$(dscacheutil -q user | ${GREPBINARY} -A 3 -B 2 -e "^uid: 5[0-9][0-9]" | ${GREPBINARY} "^name: " | ${AWKBINARY} '{print $2}') + if [ ! -z "${FIND_USERS}" ]; then + for FUSERNAME in ${FIND_USERS}; do + FDETAILS=$(dscacheutil -q user -a name ${FUSERNAME} | ${GREPBINARY} "^uid: " | ${AWKBINARY} '{print $2}') + FIND="${FDETAILS},${FUSERNAME} ${FIND}" + done + else + FIND="" + fi ;; "OpenBSD") @@ -326,15 +334,17 @@ esac # Check if we got any output - if [ "${FIND}" = "" ]; then + if [ -z "${FIND}" ]; then Display --indent 4 --text "Result: No users found/unknown result" LogText "Result: Querying of system users skipped" Display --indent 2 --text "- Query system users (non daemons)" --result "${STATUS_UNKNOWN}" --color YELLOW else Display --indent 2 --text "- Query system users (non daemons)" --result "${STATUS_DONE}" --color GREEN for I in ${FIND}; do - LogText "Real user: ${I}" - Report "real_user[]=${I}" + if [ -z "${I}" ]; then + LogText "Real user: ${I}" + Report "real_user[]=${I}" + fi done fi fi |