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>2020-04-02 10:28:41 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2020-04-02 10:28:41 +0300
commitb5a2d11738cf72691f3b09c48a4c647a4c499277 (patch)
tree60187b15b404e77c82f6adc2750c95f3fb36c598
parent156f740ff2fae6a39bc763e66df2ea17cd87d5b7 (diff)
Added fallback for awk/tr, small code enhancement, added note
-rw-r--r--include/functions9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/functions b/include/functions
index b99fdc53..492ade27 100644
--- a/include/functions
+++ b/include/functions
@@ -1516,6 +1516,7 @@
# Returns : 0 (process is running), 1 (process not running)
# RUNNING (1 = running, 0 = not running) - will be deprecated
# Notes : PSOPTIONS are declared globally, to prevent testing each call
+ # Fallback is used on binaries as IsRunning is used for 'show' command
################################################################################
IsRunning() {
@@ -1548,10 +1549,10 @@
# AIX does not fully support pgrep options, so using ps instead
if [ "${OS}" != "AIX" ]; then
# When --user is used, perform a search using the -u option
- # Initialize users for strict mode
+ # Initialize users for strict mode
if [ -n "${users:-}" ]; then
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
if [ -n "${user_uid}" ]; then
if [ -z "${FIND}" ]; then
@@ -1562,7 +1563,7 @@
done
else
LogText "Performing pgrep scan without uid"
- FIND=$(${PGREPBINARY:-pgrep} ${pgrep_options} "${search}" | ${TRBINARY} '\n' ' ')
+ FIND=$(${PGREPBINARY:-pgrep} ${pgrep_options} "${search}" | ${TRBINARY:-tr} '\n' ' ')
fi
else
if [ "${SHELL_IS_BUSYBOX}" -eq 1 ]; then
@@ -1862,7 +1863,7 @@
fi
# Check if we caught some string along all tests
- if [ ! "${SHORT}" = "" ]; then
+ if [ -n "${SHORT}" ]; then
# Lowercase and see if we found a match
SHORT=$(echo ${SHORT} | awk '{ print $1 }' | tr '[:upper:]' '[:lower:]')