mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-29 16:54:26 +02:00
Merge pull request #739 from Marzal/Marzal-clean_legacy
Clean up of not used legacy functions and not used broken functions
This commit is contained in:
commit
03f63ad34a
@ -102,17 +102,6 @@
|
|||||||
# ViewGroups Display test groups
|
# ViewGroups Display test groups
|
||||||
# WaitForKeyPress Wait for user to press a key to continue
|
# WaitForKeyPress Wait for user to press a key to continue
|
||||||
#
|
#
|
||||||
#################################################################################
|
|
||||||
#
|
|
||||||
# Under Development:
|
|
||||||
# ----------------------
|
|
||||||
# TestCase_Equal Test case for checking if value is equal to something
|
|
||||||
# TestCase_NotEqual Test case for checking if value is not equal to something
|
|
||||||
# TestCase_GreaterThan Test case for checking if value is greater than something
|
|
||||||
# TestCase_GreaterOrEqual Test case for checking if value is greater or equal to something
|
|
||||||
# TestCase_LessThan Test case for checking if value is less than something
|
|
||||||
# TestCase_LessOrEqual Test case for checking if value is less or equal to something
|
|
||||||
#
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
|
|
||||||
@ -3372,155 +3361,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Name : TestCase_Equal()
|
|
||||||
# Description : Test case for checking if value whether value is equal to value
|
|
||||||
# Returns : (0 - SUCCESS; 1 - MEDIUM-VALUED; 2 - FAIL)
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
TestCase_Equal() {
|
|
||||||
RETVAL=2
|
|
||||||
|
|
||||||
if [ "$#" -lt "2" ]; then
|
|
||||||
ReportException "${TEST_NO}" "Error in function call to ${FUNCNAME}"
|
|
||||||
else
|
|
||||||
LogText "${FUNCNAME}: checking value for application ${APP}"
|
|
||||||
LogText "${FUNCNAME}: ${OPTION} is set to ${1}"
|
|
||||||
LogText "${FUNCNAME}: check if ${1} is equal to ${2}"
|
|
||||||
|
|
||||||
if [ "$1" = "$2" ]; then
|
|
||||||
LogText "${FUNCNAME}: ${1} is equal to ${2}"
|
|
||||||
RETVAL=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [ -z ${3+x} ]; then
|
|
||||||
LogText "${FUNCNAME}: ${1} is equal to ${3}"
|
|
||||||
if [ "$2" = "$3" ]; then
|
|
||||||
LogText "${FUNCNAME}: ${OPTION} is equal to ${3}"
|
|
||||||
RETVAL=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
return ${RETVAL}
|
|
||||||
}
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Name : TestCase_ValueNotEqual()
|
|
||||||
# Description : Test case for checking if value is not equal to something
|
|
||||||
# Returns : (0 - SUCCESS; 1 - FAIL)
|
|
||||||
################################################################################
|
|
||||||
TestCase_NotEqual() {
|
|
||||||
RETVAL=1
|
|
||||||
if [ "$#" -ne "2" ]; then
|
|
||||||
ReportException "${TEST_NO}" "Error in function call to ${FUNCNAME}"
|
|
||||||
else
|
|
||||||
LogText "${FUNCNAME}: checking value for application ${APP}"
|
|
||||||
LogText "${FUNCNAME}: ${OPTION} is set to ${1}"
|
|
||||||
|
|
||||||
if [ "$1" != "$2" ]; then
|
|
||||||
LogText "${FUNCNAME}: ${1} is not equal to ${2}"
|
|
||||||
RETVAL=0
|
|
||||||
else
|
|
||||||
LogText "${FUNCNAME}: ${1} is equal to ${2}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
return ${RETVAL}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Name : TestCase_GreaterThan()
|
|
||||||
# Description : Test case for checking if value is greater than something
|
|
||||||
# Returns : (0 - SUCCESS; 1 - FAIL)
|
|
||||||
################################################################################
|
|
||||||
TestCase_GreaterThan() {
|
|
||||||
RETVAL=1
|
|
||||||
if [ "$#" -ne "2" ]; then
|
|
||||||
ReportException "${TEST_NO}" "Error in function call to ${FUNCNAME}"
|
|
||||||
else
|
|
||||||
LogText "${FUNCNAME}: checking value for application ${APP}"
|
|
||||||
LogText "${FUNCNAME}: ${OPTION} is set to ${1}"
|
|
||||||
LogText "${FUNCNAME}: checking if ${1} is greater than ${2}"
|
|
||||||
if [ "$1" > "$2" ]; then
|
|
||||||
LogText "${FUNCNAME}: ${1} is greater than ${2}"
|
|
||||||
RETVAL=0
|
|
||||||
else
|
|
||||||
LogText "${FUNCNAME}: ${1} is not greater than ${2}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
return ${RETVAL}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Name : TestCase_GreaterOrEqual()
|
|
||||||
# Description : Test case for checking if value is greater than something
|
|
||||||
# Returns : (0 - SUCCESS; 1 - FAIL)
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
TestCase_GreaterOrEqual() {
|
|
||||||
RETVAL=1
|
|
||||||
if [ "$#" -ne "2" ]; then
|
|
||||||
ReportException "${TEST_NO}" "Error in function call to ${FUNCNAME}"
|
|
||||||
else
|
|
||||||
LogText "${FUNCNAME}: checking value for application ${APP}"
|
|
||||||
LogText "${FUNCNAME}: ${OPTION} is set to ${1}"
|
|
||||||
LogText "${FUNCNAME}: checking if ${1} is greater or equal ${2}"
|
|
||||||
if [ TestCase_Equal "${1}" "${2}" ] || [ TestCase_GreaterThan "${1}" "${2}" ]; then
|
|
||||||
RETVAL=0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
return ${RETVAL}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Name : TestCase_LessThan()
|
|
||||||
# Description : Test case for checking if value is greater than something
|
|
||||||
# Returns : (0 - SUCCESS; 1 - FAIL)
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
TestCase_LessThan() {
|
|
||||||
RETVAL=1
|
|
||||||
if [ "$#" -ne "2" ]; then
|
|
||||||
ReportException "${TEST_NO}" "Error in function call to TestCase_GreaterOrEqual"
|
|
||||||
else
|
|
||||||
LogText "${FUNCNAME}: checking value for application ${APP}"
|
|
||||||
LogText "${FUNCNAME}: ${OPTION} is set to ${1}"
|
|
||||||
|
|
||||||
LogText "${FUNCNAME}: checking if ${1} is less than ${2}"
|
|
||||||
if ! [ TestCase_GreaterOrEqual "${1}" "${2}" ]; then
|
|
||||||
LogText "${FUNCNAME}: ${1} is less than ${2}"
|
|
||||||
RETVAL=0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
return ${RETVAL}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Name : TestCase_LessOrEqual()
|
|
||||||
# Description : Test case for checking if value is less or equal something
|
|
||||||
# Returns : (0 - SUCCESS; 1 - FAIL)
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
TestCase_LessOrEqual() {
|
|
||||||
RETVAL=1
|
|
||||||
if [ "$#" -ne "2" ]; then
|
|
||||||
ReportException "${TEST_NO}" "Error in function call to ${FUNCNAME}"
|
|
||||||
else
|
|
||||||
LogText "${FUNCNAME}: checking value for application ${APP}"
|
|
||||||
LogText "${FUNCNAME}: ${OPTION} is set to ${1}"
|
|
||||||
LogText "${FUNCNAME}: checking if ${1} is less or equal ${2}"
|
|
||||||
if [ TestCase_Equal "${1}" "${2}" ] || [ TestCase_LessThan "${1}" "${2}" ]; then
|
|
||||||
LogText "${FUNCNAME}: ${1} is less than ${2}"
|
|
||||||
RETVAL=0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
return ${RETVAL}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Legacy functions - Do not use!
|
# Legacy functions - Do not use!
|
||||||
@ -3530,42 +3370,6 @@
|
|||||||
# steps. If they still get used, they will trigger errors on screen.
|
# steps. If they still get used, they will trigger errors on screen.
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
counttests() {
|
|
||||||
DisplayWarning "Deprecated function used (counttests)"
|
|
||||||
if IsDeveloperMode; then Debug "Warning: old counttests function is used. Please replace any reference with CountTests."; fi
|
|
||||||
CountTests
|
|
||||||
}
|
|
||||||
|
|
||||||
logtext() {
|
|
||||||
DisplayWarning "Deprecated function used (logtext)"
|
|
||||||
if IsDeveloperMode; then Debug "Warning: old logtext function is used. Please replace any reference with LogText."; fi
|
|
||||||
LogText "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
logtextbreak() {
|
|
||||||
DisplayWarning "Deprecated function used (logtextbreak)"
|
|
||||||
if IsDeveloperMode; then Debug "Warning: old logtextbreak function is used. Please replace any reference with LogTextBreak."; fi
|
|
||||||
LogTextBreak "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
report() {
|
|
||||||
DisplayWarning "Deprecated function used (report)"
|
|
||||||
if IsDeveloperMode; then Debug "Warning: old report function is used. Please replace any reference with Report."; fi
|
|
||||||
Report "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
wait_for_keypress() {
|
|
||||||
DisplayWarning "Deprecated function used (wait_for_keypress)"
|
|
||||||
if IsDeveloperMode; then Debug "Warning: old wait_for_keypress function is used. Please replace any reference with WaitForKeyPress."; fi
|
|
||||||
WaitForKeyPress
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowResult() {
|
|
||||||
DisplayWarning "Deprecated function used (ShowResult)"
|
|
||||||
if IsDeveloperMode; then Debug "Warning: old ShowResult() function is used. Please replace any reference with WaitForKeyPress."; fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#================================================================================
|
#================================================================================
|
||||||
# Lynis is part of Lynis Enterprise and released under GPLv3 license
|
# Lynis is part of Lynis Enterprise and released under GPLv3 license
|
||||||
|
Loading…
x
Reference in New Issue
Block a user