mirror of https://github.com/CISOfy/lynis.git
Removed local variable assignment to prevent portability issues
This commit is contained in:
parent
a40331aedc
commit
dfce1a770a
|
@ -138,7 +138,7 @@
|
|||
################################################################################
|
||||
|
||||
CheckFilePermissions() {
|
||||
local CHECKFILE=$1
|
||||
CHECKFILE=$1
|
||||
if [ ! -d ${CHECKFILE} -a ! -f ${CHECKFILE} ]; then
|
||||
PERMS="FILE_NOT_FOUND"
|
||||
else
|
||||
|
@ -166,7 +166,7 @@
|
|||
|
||||
CheckItem() {
|
||||
ITEM_FOUND=0
|
||||
local RETVAL=255
|
||||
RETVAL=255
|
||||
if [ $# -eq 2 ]; then
|
||||
# Don't search in /dev/null, it's too empty there
|
||||
if [ ! "${REPORTFILE}" = "/dev/null" ]; then
|
||||
|
@ -233,9 +233,9 @@
|
|||
################################################################################
|
||||
|
||||
ContainsString() {
|
||||
local RETVAL=1
|
||||
RETVAL=1
|
||||
if [ $# -ne 2 ]; then ReportException "ContainsString" "Incorrect number of arguments for ContainsStrings function"; fi
|
||||
local FIND=`echo "$2" | egrep "$1"`
|
||||
FIND=`echo "$2" | egrep "$1"`
|
||||
if [ ! "${FIND}" = "" ]; then RETVAL=0; fi
|
||||
return ${RETVAL}
|
||||
}
|
||||
|
@ -397,7 +397,7 @@
|
|||
fi
|
||||
|
||||
if [ ! "${TEXT}" = "" ]; then
|
||||
local SHOW=0
|
||||
SHOW=0
|
||||
if [ ${SHOW_WARNINGS_ONLY} -eq 1 ]; then
|
||||
if [ "${RESULT}" = "WARNING" ]; then SHOW=1; fi
|
||||
elif [ ${QUIET} -eq 0 ]; then SHOW=1
|
||||
|
@ -938,7 +938,7 @@
|
|||
################################################################################
|
||||
|
||||
IsOwnedByRoot() {
|
||||
local PERMS=""
|
||||
PERMS=""
|
||||
if [ $# -eq 1 ]; then
|
||||
FILE="$1"
|
||||
case $OS in
|
||||
|
@ -1301,7 +1301,7 @@
|
|||
################################################################################
|
||||
|
||||
ParseTestValues() {
|
||||
local RETVAL=1
|
||||
RETVAL=1
|
||||
FOUND=0
|
||||
CHECK_VALUES_ARRAY=""
|
||||
if [ $# -gt 0 -a ! "${CHECK_OPTION_ARRAY}" = "" ]; then
|
||||
|
@ -1557,13 +1557,13 @@
|
|||
|
||||
RandomString() {
|
||||
# Check a (pseudo) random character device
|
||||
if [ -c /dev/urandom ]; then local FILE="/dev/urandom"
|
||||
elif [ -c /dev/random ]; then local FILE="/dev/random"
|
||||
if [ -c /dev/urandom ]; then FILE="/dev/urandom"
|
||||
elif [ -c /dev/random ]; then FILE="/dev/random"
|
||||
else
|
||||
Display "Can not use RandomString function, as there is no random device to be used"
|
||||
fi
|
||||
if [ $# -eq 0 ]; then local SIZE=16; else local SIZE=$1; fi
|
||||
local CSIZE=$((SIZE / 2))
|
||||
if [ $# -eq 0 ]; then SIZE=16; else SIZE=$1; fi
|
||||
CSIZE=$((SIZE / 2))
|
||||
RANDOMSTRING=`head -c ${CSIZE} /dev/urandom | od -An -x | tr -d ' ' | cut -c 1-${SIZE}`
|
||||
}
|
||||
|
||||
|
@ -1766,13 +1766,13 @@
|
|||
|
||||
ReportDetails() {
|
||||
while [ $# -ge 1 ]; do
|
||||
local TEST_DESCRIPTION=""
|
||||
local TEST_FIELD=""
|
||||
local TEST_ID=""
|
||||
local TEST_OTHER=""
|
||||
local TEST_PREFERRED_VALUE=""
|
||||
local TEST_SERVICE=""
|
||||
local TEST_VALUE=""
|
||||
TEST_DESCRIPTION=""
|
||||
TEST_FIELD=""
|
||||
TEST_ID=""
|
||||
TEST_OTHER=""
|
||||
TEST_PREFERRED_VALUE=""
|
||||
TEST_SERVICE=""
|
||||
TEST_VALUE=""
|
||||
|
||||
case $1 in
|
||||
--description)
|
||||
|
@ -2234,9 +2234,9 @@
|
|||
################################################################################
|
||||
|
||||
SkipAtomicTest() {
|
||||
local RETVAL=255
|
||||
RETVAL=255
|
||||
if [ $# -eq 1 ]; then
|
||||
local STRING=""
|
||||
STRING=""
|
||||
RETVAL=1
|
||||
# Check if this test is on the list to skip
|
||||
for I in ${SKIP_TESTS}; do
|
||||
|
@ -2260,17 +2260,17 @@
|
|||
################################################################################
|
||||
|
||||
TestValue() {
|
||||
local RETVAL=255
|
||||
local FIND=""
|
||||
local VALUE=""
|
||||
local RESULT=""
|
||||
local SEARCH=""
|
||||
local CMP1=""; local CMP2=""
|
||||
RETVAL=255
|
||||
FIND=""
|
||||
VALUE=""
|
||||
RESULT=""
|
||||
SEARCH=""
|
||||
CMP1=""; CMP2=""
|
||||
while [ $# -ge 1 ]; do
|
||||
case $1 in
|
||||
--function)
|
||||
shift
|
||||
local FUNCTION=$1
|
||||
FUNCTION=$1
|
||||
;;
|
||||
--value)
|
||||
shift
|
||||
|
@ -2362,7 +2362,7 @@
|
|||
################################################################################
|
||||
|
||||
TestCase_Equal() {
|
||||
local RETVAL=2
|
||||
RETVAL=2
|
||||
|
||||
if [ "$#" -lt "2" ]; then
|
||||
ReportException "${TEST_NO}" "Error in function call to ${FUNCNAME}"
|
||||
|
@ -2395,7 +2395,7 @@
|
|||
# Returns : (0 - SUCCESS; 1 - FAIL)
|
||||
################################################################################
|
||||
TestCase_NotEqual() {
|
||||
local RETVAL=1
|
||||
RETVAL=1
|
||||
if [ "$#" -ne "2" ]; then
|
||||
ReportException "${TEST_NO}" "Error in function call to ${FUNCNAME}"
|
||||
else
|
||||
|
@ -2419,7 +2419,7 @@
|
|||
# Returns : (0 - SUCCESS; 1 - FAIL)
|
||||
################################################################################
|
||||
TestCase_GreaterThan() {
|
||||
local RETVAL=1
|
||||
RETVAL=1
|
||||
if [ "$#" -ne "2" ]; then
|
||||
ReportException "${TEST_NO}" "Error in function call to ${FUNCNAME}"
|
||||
else
|
||||
|
@ -2444,7 +2444,7 @@
|
|||
################################################################################
|
||||
|
||||
TestCase_GreaterOrEqual() {
|
||||
local RETVAL=1
|
||||
RETVAL=1
|
||||
if [ "$#" -ne "2" ]; then
|
||||
ReportException "${TEST_NO}" "Error in function call to ${FUNCNAME}"
|
||||
else
|
||||
|
@ -2466,7 +2466,7 @@
|
|||
################################################################################
|
||||
|
||||
TestCase_LessThan() {
|
||||
local RETVAL=1
|
||||
RETVAL=1
|
||||
if [ "$#" -ne "2" ]; then
|
||||
ReportException "${TEST_NO}" "Error in function call to TestCase_GreaterOrEqual"
|
||||
else
|
||||
|
@ -2490,7 +2490,7 @@
|
|||
################################################################################
|
||||
|
||||
TestCase_LessOrEqual() {
|
||||
local RETVAL=1
|
||||
RETVAL=1
|
||||
if [ "$#" -ne "2" ]; then
|
||||
ReportException "${TEST_NO}" "Error in function call to ${FUNCNAME}"
|
||||
else
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
case ${PAM_CONTROL_FLAG} in
|
||||
"optional"|"required"|"requisite"|"sufficient")
|
||||
#Debug "Found a common control flag: ${PAM_CONTROL_FLAG} for ${PAM_MODULE}"
|
||||
local X=0 # do nothing
|
||||
X=0 # do nothing
|
||||
;;
|
||||
"other")
|
||||
LogText "Result: brackets used, ignoring control flags"
|
||||
|
|
Loading…
Reference in New Issue