mirror of https://github.com/CISOfy/lynis.git
Initialize some vars to allow strict mode to work
IsRunning(): To check if $users is empty in strict mode we need the var to be initializez ReportException: Some test call this function without the second parameter, this is not allowed in strict mode if we don't initialize the variable
This commit is contained in:
parent
250fb965d3
commit
06413994cf
|
@ -1400,7 +1400,8 @@
|
|||
# AIX does not fully support pgrep options, so using ps instead
|
||||
if [ -n "${PGREPBINARY}" -a ! "${OS}" = "AIX" ]; then
|
||||
# When --user is used, perform a search using the -u option
|
||||
if [ -n "${users}" ]; then
|
||||
# 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}')
|
||||
# Only perform search if user exists and we had no match yet
|
||||
|
@ -2641,8 +2642,9 @@
|
|||
|
||||
# Log exceptions
|
||||
ReportException() {
|
||||
Report "exception_event[]=$1|$2|"
|
||||
LogText "Exception: test has an exceptional event ($1) with text $2"
|
||||
# Allow this function with only 1 parameter in strict mode with ${2-Text}
|
||||
Report "exception_event[]=$1|${2-NoInfo}|"
|
||||
LogText "Exception: test has an exceptional event ($1) with text ${2-NoText}"
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue