Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormboelen <michael@cisofy.com>2014-08-28 15:58:41 +0400
committermboelen <michael@cisofy.com>2014-08-28 15:58:41 +0400
commit5d1ef9f3cd3aefa94efac29fc384820164436173 (patch)
treef45e7216b4c887e39683136d98b3b1750bea74da /include/tests_storage
parent0228bd5317e63d5d7ba92834a301afb59ba93c9b (diff)
Test if there are files in /etc/modprobe.d before grepping in it
Diffstat (limited to 'include/tests_storage')
-rw-r--r--include/tests_storage19
1 files changed, 12 insertions, 7 deletions
diff --git a/include/tests_storage b/include/tests_storage
index 16d0a874..cdad2bcb 100644
--- a/include/tests_storage
+++ b/include/tests_storage
@@ -31,7 +31,7 @@
FOUND=0
logtext "Test: Checking USB storage driver in directory /etc/modprobe.d and configuration file /etc/modprobe.conf"
if [ -d /etc/modprobe.d ]; then
- FIND=`ls /etc/modprobe.d/* 2>/dev/null`
+ FIND=`ls /etc/modprobe.d/* 2> /dev/null`
if [ ! "${FIND}" = "" ]; then
FIND=`grep -r "install usb-storage /bin/true" /etc/modprobe.d/* | grep "usb-storage" | grep -v "#"`
FIND2=`egrep -r "^blacklist (usb_storage|usb-storage)" /etc/modprobe.d/*`
@@ -71,15 +71,20 @@
FOUND=0
logtext "Test: Checking firewire storage driver in directory /etc/modprobe.d and configuration file /etc/modprobe.conf"
if [ -d /etc/modprobe.d ]; then
- FIND1=`egrep "blacklist (ohci1394|firewire-ohci)" /etc/modprobe.d/* | grep "ohci" | grep -v "#"`
- FIND2=`egrep "install (ohci1394|firewire-ohci) /bin/true" /etc/modprobe.d/* | grep "ohci" | grep -v "#"`
- if [ ! "${FIND1}" = "" -o ! "${FIND2}" = "" ]; then
- FOUND=1
- logtext "Result: found firewire ohci driver in disabled state"
+ FIND=`ls /etc/modprobe.d/* 2> /dev/null`
+ if [ ! "${FIND}" = "" ]; then
+ FIND1=`egrep "blacklist (ohci1394|firewire-ohci)" /etc/modprobe.d/* | grep "ohci" | grep -v "#"`
+ FIND2=`egrep "install (ohci1394|firewire-ohci) /bin/true" /etc/modprobe.d/* | grep "ohci" | grep -v "#"`
+ if [ ! "${FIND1}" = "" -o ! "${FIND2}" = "" ]; then
+ FOUND=1
+ logtext "Result: found firewire ohci driver in disabled state"
+ fi
+ else
+ logtext "Result: skipping /etc/modprobe.d, directory found but no files in it"
fi
fi
if [ -f /etc/modprobe.conf ]; then
- FIND1=`egrep -r "blacklist (ohci1394|firewire-ohci)" /etc/modprobe.conf | grep "ohci" | grep -v "#"`
+ FIND1=`egrep -r "blacklist (ohci1394|firewire-ohci)" /etc/modprobe.conf | grep "ohci" | grep -v "#"`
FIND2=`egrep -r "install (ohci1394|firewire-ohci) /bin/true" /etc/modprobe.conf | grep "ohci" | grep -v "#"`
if [ ! "${FIND1}" = "" -o ! "${FIND2}" = "" ]; then
FOUND=1