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>2019-09-22 16:07:53 +0300
committerGitHub <noreply@github.com>2019-09-22 16:07:53 +0300
commite64e49a551434ba68570a04f0af374c559449697 (patch)
treeca1e90dbcae172d0f245fe7c7cca419fd947ac4f /include/functions
parentfe5f42fc73eaa73bcfdd77e7ed94aaf070f54ab1 (diff)
parentddd87371b5b31821d0705003bfd13c1b89157af7 (diff)
Merge pull request #763 from Marzal/Marzal-F_isRunning
Second version of #740 without shellcheck directives
Diffstat (limited to 'include/functions')
-rw-r--r--include/functions14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/functions b/include/functions
index d0992299..89626958 100644
--- a/include/functions
+++ b/include/functions
@@ -1527,17 +1527,17 @@
if [ -z "${search}" ]; then ExitFatal "Missing process to search for when using IsRunning function"; fi
RUNNING=0
# AIX does not fully support pgrep options, so using ps instead
- if [ -n "${PGREPBINARY}" -a ! "${OS}" = "AIX" ]; then
+ if [ -n "${PGREPBINARY}" ] && [ "${OS}" != "AIX" ]; then
# When --user is used, perform a search using the -u option
# 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} -F: '{print $3}')
# Only perform search if user exists and we had no match yet
if [ -n "${user_uid}" ]; then
if [ -z "${FIND}" ]; then
LogText "Performing pgrep scan using uid ${user_uid}"
- FIND=$(${PGREPBINARY} ${pgrep_options} -u ${user_uid} "${search}" | ${TRBINARY} '\n' ' ')
+ FIND=$(${PGREPBINARY} ${pgrep_options} -u "${user_uid}" "${search}" | ${TRBINARY} '\n' ' ')
fi
fi
done
@@ -1546,7 +1546,7 @@
FIND=$(${PGREPBINARY} ${pgrep_options} "${search}" | ${TRBINARY} '\n' ' ')
fi
else
- if [ ${SHELL_IS_BUSYBOX} -eq 1 ]; then
+ if [ "${SHELL_IS_BUSYBOX}" -eq 1 ]; then
# This search is not foolproof
LogText "Performing simple ps scan (busybox)"
PSOPTIONS=" -o args="
@@ -1554,16 +1554,16 @@
else
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} -F: '{print $3}')
# Only perform search if user exists and we had no match yet
if [ -n "${user_uid}" ]; then
if [ -z "${FIND}" ]; then
if [ ${PARTIAL_SEARCH} -eq 1 ]; then
LogText "Performing ps scan using partial match and for uid ${user_uid}"
- FIND=$(${PSBINARY} -u ${user_uid} -o comm= "${search}" | ${AWKBINARY} -v pattern="${search}" '$0 ~ pattern {print}')
+ FIND=$(${PSBINARY} -u "${user_uid}" -o comm= "${search}" | ${AWKBINARY} -v pattern="${search}" '$0 ~ pattern {print}')
else
LogText "Performing ps scan using exact match and for uid ${user_uid}"
- FIND=$(${PSBINARY} -u ${user_uid} -o comm= "${search}" | ${AWKBINARY} -v pattern="^${search}$" '$0 ~ pattern {print}')
+ FIND=$(${PSBINARY} -u "${user_uid}" -o comm= "${search}" | ${AWKBINARY} -v pattern="^${search}$" '$0 ~ pattern {print}')
fi
fi
fi