mirror of https://github.com/CISOfy/lynis.git
Check zero size of files correctly (#487)
from man test: -s FILE FILE exists and has a size greater than zero -z STRING the length of STRING is zero
This commit is contained in:
parent
8048b3d682
commit
09de901d11
|
@ -726,7 +726,7 @@
|
|||
if [ $# -eq 0 ]; then ExitFatal "Missing parameter when calling FileIsEmpty function"; fi
|
||||
EMPTY=0
|
||||
LogText "Test: checking if file $1 is empty"
|
||||
if [ -z $1 ]; then
|
||||
if [ ! -s "$1" ]; then
|
||||
LogText "Result: file $1 is empty"
|
||||
EMPTY=1
|
||||
return 0
|
||||
|
@ -1489,7 +1489,7 @@
|
|||
# Amazon EC2
|
||||
if [ "${SHORT}" = "" ]; then
|
||||
LogText "Test: checking specific files for Amazon"
|
||||
if [ -f /etc/ec2_version -a ! -z /etc/ec2_version ]; then
|
||||
if [ -f /etc/ec2_version -a -s /etc/ec2_version ]; then
|
||||
SHORT="amazon-ec2"
|
||||
else
|
||||
LogText "Result: system not hosted on Amazon"
|
||||
|
|
|
@ -428,7 +428,7 @@
|
|||
FOUND=0
|
||||
FILE="/etc/ntp/step-tickers"
|
||||
if [ -f ${FILE} ]; then
|
||||
if [ -z ${FILE} ]; then
|
||||
if [ ! -s "${FILE}" ]; then
|
||||
LogText "Result: ${FILE} is empty. The step-tickers contain no configured NTP servers"
|
||||
Display --indent 2 --text "- Checking NTP step-tickers file" --result "EMPTY FILE" --color YELLOW
|
||||
ReportSuggestion ${TEST_NO} "Use step-tickers file for quicker time synchronization"
|
||||
|
|
Loading…
Reference in New Issue