mirror of https://github.com/CISOfy/lynis.git
Check for number or arguments on ReportSuggestion and ReportWarning
This commit is contained in:
parent
691d8a610d
commit
22f99ede81
|
@ -2073,12 +2073,14 @@
|
||||||
# * url:http://site/link
|
# * url:http://site/link
|
||||||
# * text:Additional explanation
|
# * text:Additional explanation
|
||||||
# * - for none
|
# * - for none
|
||||||
if [ "$1" = "" ]; then TEST="UNKNOWN"; else TEST="$1"; fi
|
if [ $# -eq 0 ]; then echo "Not enough arguments provided for function ReportSuggestion"; ExitFatal; fi
|
||||||
if [ "$2" = "" ]; then MESSAGE="UNKNOWN"; else MESSAGE="$2"; fi
|
if [ $# -ge 1 ]; then TEST="$1"; else TEST="UNKNOWN"; fi
|
||||||
if [ "$3" = "" ]; then DETAILS="-"; else DETAILS="$3"; fi
|
if [ $# -ge 2 ]; then MESSAGE="$2"; else MESSAGE="UNKNOWN"; fi
|
||||||
if [ "$4" = "" ]; then SOLUTION="-"; else SOLUTION="$4"; fi
|
if [ $# -ge 3 ]; then DETAILS="$3"; else DETAILS="-"; fi
|
||||||
|
if [ $# -ge 4 ]; then SOLUTION="$4"; else SOLUTION="-"; fi
|
||||||
|
if [ $# -ge 5 ]; then echo "Too many arguments for function ReportSuggestion"; ExitFatal; fi
|
||||||
Report "suggestion[]=${TEST}|${MESSAGE}|${DETAILS}|${SOLUTION}|"
|
Report "suggestion[]=${TEST}|${MESSAGE}|${DETAILS}|${SOLUTION}|"
|
||||||
LogText "Suggestion: ${MESSAGE} [test:$1] [details:${DETAILS}] [solution:${SOLUTION}]"
|
LogText "Suggestion: ${MESSAGE} [test:${TEST}] [details:${DETAILS}] [solution:${SOLUTION}]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2092,11 +2094,11 @@
|
||||||
# Old style
|
# Old style
|
||||||
# <ID> <priority/impact> <warning text>
|
# <ID> <priority/impact> <warning text>
|
||||||
if [ "$2" = "L" -o "$2" = "M" -o "$2" = "H" ]; then
|
if [ "$2" = "L" -o "$2" = "M" -o "$2" = "H" ]; then
|
||||||
DETAILS="$2"
|
if [ $# -ge 1 ]; then TEST="$1"; fi
|
||||||
MESSAGE="$3"
|
if [ $# -ge 2 ]; then DETAILS="$2"; fi
|
||||||
TEST="$1"
|
if [ $# -ge 3 ]; then DESSAGE="$3"; fi
|
||||||
SOLUTION="-"
|
SOLUTION="-"
|
||||||
else
|
else
|
||||||
# New style warning format:
|
# New style warning format:
|
||||||
# <ID> <Warning> <Details> <Solution>
|
# <ID> <Warning> <Details> <Solution>
|
||||||
#
|
#
|
||||||
|
@ -2107,10 +2109,12 @@
|
||||||
# * url:http://site/link
|
# * url:http://site/link
|
||||||
# * text:Additional explanation
|
# * text:Additional explanation
|
||||||
# * - for none
|
# * - for none
|
||||||
if [ "$1" = "" ]; then TEST="UNKNOWN"; else TEST="$1"; fi
|
if [ $# -eq 0 ]; then echo "Not enough arguments provided for function ReportWarning"; ExitFatal; fi
|
||||||
if [ "$2" = "" ]; then MESSAGE="UNKNOWN"; else MESSAGE="$2"; fi
|
if [ $# -ge 1 ]; then TEST="$1"; else TEST="UNKNOWN"; fi
|
||||||
if [ "$3" = "" ]; then DETAILS="-"; else DETAILS="$3"; fi
|
if [ $# -ge 2 ]; then MESSAGE="$2"; else MESSAGE="UNKNOWN"; fi
|
||||||
if [ "$4" = "" ]; then SOLUTION="-"; else SOLUTION="$4"; fi
|
if [ $# -ge 3 ]; then DETAILS="$3"; else DETAILS="-"; fi
|
||||||
|
if [ $# -ge 4 ]; then SOLUTION="$4"; else SOLUTION="-"; fi
|
||||||
|
if [ $# -ge 5 ]; then echo "Too many arguments for function ReportWarning"; ExitFatal; fi
|
||||||
fi
|
fi
|
||||||
Report "warning[]=${TEST}|${MESSAGE}|${DETAILS}|${SOLUTION}|"
|
Report "warning[]=${TEST}|${MESSAGE}|${DETAILS}|${SOLUTION}|"
|
||||||
LogText "Warning: ${MESSAGE} [test:${TEST}] [details:${DETAILS}] [solution:${SOLUTION}]"
|
LogText "Warning: ${MESSAGE} [test:${TEST}] [details:${DETAILS}] [solution:${SOLUTION}]"
|
||||||
|
|
Loading…
Reference in New Issue