mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-29 08:44:21 +02:00
Added fallback for awk/tr, small code enhancement, added note
This commit is contained in:
parent
156f740ff2
commit
b5a2d11738
@ -1516,6 +1516,7 @@
|
|||||||
# Returns : 0 (process is running), 1 (process not running)
|
# Returns : 0 (process is running), 1 (process not running)
|
||||||
# RUNNING (1 = running, 0 = not running) - will be deprecated
|
# RUNNING (1 = running, 0 = not running) - will be deprecated
|
||||||
# Notes : PSOPTIONS are declared globally, to prevent testing each call
|
# Notes : PSOPTIONS are declared globally, to prevent testing each call
|
||||||
|
# Fallback is used on binaries as IsRunning is used for 'show' command
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
IsRunning() {
|
IsRunning() {
|
||||||
@ -1551,7 +1552,7 @@
|
|||||||
# Initialize users for strict mode
|
# Initialize users for strict mode
|
||||||
if [ -n "${users:-}" ]; then
|
if [ -n "${users:-}" ]; then
|
||||||
for u in ${users}; do
|
for u in ${users}; do
|
||||||
user_uid=$(getent passwd "${u}" 2> /dev/null | ${AWKBINARY} -F: '{print $3}')
|
user_uid=$(getent passwd "${u}" 2> /dev/null | ${AWKBINARY:-awk} -F: '{print $3}')
|
||||||
# Only perform search if user exists and we had no match yet
|
# Only perform search if user exists and we had no match yet
|
||||||
if [ -n "${user_uid}" ]; then
|
if [ -n "${user_uid}" ]; then
|
||||||
if [ -z "${FIND}" ]; then
|
if [ -z "${FIND}" ]; then
|
||||||
@ -1562,7 +1563,7 @@
|
|||||||
done
|
done
|
||||||
else
|
else
|
||||||
LogText "Performing pgrep scan without uid"
|
LogText "Performing pgrep scan without uid"
|
||||||
FIND=$(${PGREPBINARY:-pgrep} ${pgrep_options} "${search}" | ${TRBINARY} '\n' ' ')
|
FIND=$(${PGREPBINARY:-pgrep} ${pgrep_options} "${search}" | ${TRBINARY:-tr} '\n' ' ')
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "${SHELL_IS_BUSYBOX}" -eq 1 ]; then
|
if [ "${SHELL_IS_BUSYBOX}" -eq 1 ]; then
|
||||||
@ -1862,7 +1863,7 @@
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if we caught some string along all tests
|
# Check if we caught some string along all tests
|
||||||
if [ ! "${SHORT}" = "" ]; then
|
if [ -n "${SHORT}" ]; then
|
||||||
# Lowercase and see if we found a match
|
# Lowercase and see if we found a match
|
||||||
SHORT=$(echo ${SHORT} | awk '{ print $1 }' | tr '[:upper:]' '[:lower:]')
|
SHORT=$(echo ${SHORT} | awk '{ print $1 }' | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user