diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2019-07-16 14:20:30 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2019-07-16 14:20:30 +0300 |
commit | fa8bad20db100d95cf089b0b2d897c339327215c (patch) | |
tree | 2f80f2e015d26056cd741137dc4fdd069a6c4c5d /include/tests_usb | |
parent | 2777caf6d218aeb40c2ebd8af2564be8201eeff1 (diff) |
Use -n instead of ! -z
Diffstat (limited to 'include/tests_usb')
-rw-r--r-- | include/tests_usb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/include/tests_usb b/include/tests_usb index eada5d12..3ba19cc9 100644 --- a/include/tests_usb +++ b/include/tests_usb @@ -39,7 +39,7 @@ # # Test to determine if USBGuard is installed. If it is, we will limit # suggestions from other tests. - if [ ! -z "${USBGUARDBINARY}" ]; then + if [ -n "${USBGUARDBINARY}" ]; then USBGUARD_FOUND=1 fi # @@ -53,10 +53,10 @@ LogText "Test: Checking USB storage driver in directory /etc/modprobe.d and configuration file /etc/modprobe.conf" if [ -d /etc/modprobe.d ]; then FIND=$(${LSBINARY} ${ROOTDIR}etc/modprobe.d/* 2> /dev/null) - if [ ! -z "${FIND}" ]; then + if [ -n "${FIND}" ]; then FIND=$(${EGREPBINARY} -r "install usb[-_]storage /bin/(false|true)" ${ROOTDIR}etc/modprobe.d/* | ${GREPBINARY} -v "#") FIND2=$(${EGREPBINARY} -r "^blacklist usb[-_]storage" ${ROOTDIR}etc/modprobe.d/*) - if [ ! -z "${FIND}" -o ! -z "${FIND2}" ]; then + if [ -n "${FIND}" -o -n "${FIND2}" ]; then FOUND=1 LogText "Result: found usb-storage driver in disabled state (blacklisted)" fi @@ -66,7 +66,7 @@ fi if [ -f ${ROOTDIR}etc/modprobe.conf ]; then FIND=$(${EGREPBINARY} "install usb[-_]storage /bin/(false|true)" ${ROOTDIR}etc/modprobe.conf | ${GREPBINARY} "usb-storage" | ${GREPBINARY} -v "#") - if [ ! -z "${FIND}" ]; then + if [ -n "${FIND}" ]; then FOUND=1 LogText "Result: found usb-storage driver in disabled state" fi @@ -146,14 +146,14 @@ USBGUARD_CONFIG="" fi - if [ ! -z "${USBGUARD_CONFIG}" ]; then + if [ -n "${USBGUARD_CONFIG}" ]; then LogText "Result: USBGuard configuration found (${USBGUARD_CONFIG})" Display --indent 4 --text "- Configuration" --result "${STATUS_FOUND}" --color GREEN AddHP 1 1 LogText "Checking USBGuard restore controller device state (RestoreControllerDeviceState)" USBGUARD_RESTORE_POLICY=$(${AWKBINARY} -F '=' -v OPT="RestoreControllerDeviceState" 'index($0, OPT) == 1 {print $2}' ${USBGUARD_CONFIG}) - if [ ! -z "${USBGUARD_RESTORE_POLICY}" ]; then + if [ -n "${USBGUARD_RESTORE_POLICY}" ]; then LogText "Result: RestoreControllerDeviceState = ${USBGUARD_RESTORE_POLICY}" case "${USBGUARD_RESTORE_POLICY}" in "true") @@ -184,7 +184,7 @@ LogText "Checking USBGuard rule for controllers connected before daemon starts (PresentControllerPolicy)" USBGUARD_CONTROLLER_POLICY=$(${AWKBINARY} -F '=' -v OPT="PresentControllerPolicy" 'index($0, OPT) == 1 {print $2}' ${USBGUARD_CONFIG}) - if [ ! -z "${USBGUARD_CONTROLLER_POLICY}" ]; then + if [ -n "${USBGUARD_CONTROLLER_POLICY}" ]; then LogText "Result: PresentControllerPolicy = ${USBGUARD_CONTROLLER_POLICY}" case "${USBGUARD_CONTROLLER_POLICY}" in "allow" | "keep") @@ -214,7 +214,7 @@ LogText "Checking USBGuard rule for devices connected before daemon starts (PresentDevicePolicy)" USBGUARD_DEVICE_POLICY=$(${AWKBINARY} -F '=' -v OPT="PresentDevicePolicy" 'index($0, OPT) == 1 {print $2}' ${USBGUARD_CONFIG}) - if [ ! -z "${USBGUARD_DEVICE_POLICY}" ]; then + if [ -n "${USBGUARD_DEVICE_POLICY}" ]; then LogText "Result: PresentDevicePolicy = ${USBGUARD_DEVICE_POLICY}" case "${USBGUARD_DEVICE_POLICY}" in "allow" | "keep") @@ -244,7 +244,7 @@ LogText "Checking USBGuard rule for devices inserted after daemon starts (InsertedDevicePolicy)" USBGUARD_INSERTED_POLICY=$(${AWKBINARY} -F '=' -v OPT="InsertedDevicePolicy" 'index($0, OPT) == 1 {print $2}' ${USBGUARD_CONFIG}) - if [ ! -z "${USBGUARD_INSERTED_POLICY}" ]; then + if [ -n "${USBGUARD_INSERTED_POLICY}" ]; then LogText "Result: InsertedDevicePolicy = ${USBGUARD_INSERTED_POLICY}" case "${USBGUARD_INSERTED_POLICY}" in "allow" | "keep") @@ -274,7 +274,7 @@ LogText "Checking USBGuard rule for devices not in RuleFile (ImplicitPolicyTarget)" USBGUARD_DEFAULT_POLICY=$(${AWKBINARY} -F '=' -v OPT="ImplicitPolicyTarget" 'index($0, OPT) == 1 {print $2}' ${USBGUARD_CONFIG}) - if [ ! -z "${USBGUARD_DEFAULT_POLICY}" ]; then + if [ -n "${USBGUARD_DEFAULT_POLICY}" ]; then LogText "Result: ImplicitPolicyTarget = ${USBGUARD_DEFAULT_POLICY}" case "${USBGUARD_DEFAULT_POLICY}" in "allow") @@ -304,7 +304,7 @@ LogText "Checking RuleFile" USBGUARD_RULES=$(${AWKBINARY} -F '=' -v OPT="RuleFile" 'index($0, OPT) == 1 {print $2}' ${USBGUARD_CONFIG}) - if [ ! -z "${USBGUARD_RULES}" ] && [ -f "${USBGUARD_RULES}" ]; then + if [ -n "${USBGUARD_RULES}" ] && [ -f "${USBGUARD_RULES}" ]; then LogText "Result: RuleFile found (${USBGUARD_RULES})" Display --indent 4 --text "- RuleFile" --result "${STATUS_FOUND}" --color GREEN AddHP 1 1 |