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:
authorMichael Boelen <michael.boelen@cisofy.com>2018-01-18 22:26:19 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2018-01-18 22:26:19 +0300
commit1bf789861d7673a00e9929345e48e6b648679e54 (patch)
treed0e5415d96b2c629331e868931c22c35247d494e
parent25faab842878ad6102e633d11c85f3291ea177aa (diff)
Add possibility to define an array of allowed operating systems for a test
-rw-r--r--include/functions14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/functions b/include/functions
index 73878f55..01e62e42 100644
--- a/include/functions
+++ b/include/functions
@@ -2143,11 +2143,15 @@
if [ ${SKIPTEST} -eq 0 -a "${TEST_WEIGHT}" = "H" -a "${SCAN_TEST_HEAVY}" = "NO" ]; then SKIPTEST=1; SKIPREASON="Test to system intensive for scan mode (H)"; fi
if [ ${SKIPTEST} -eq 0 -a "${TEST_WEIGHT}" = "M" -a "${SCAN_TEST_MEDIUM}" = "NO" ]; then SKIPTEST=1; SKIPREASON="Test to system intensive for scan mode (M)"; fi
- # Skip test if OS is different than requested
- if [ ${SKIPTEST} -eq 0 -a ! -z "${TEST_NEED_OS}" -a ! "${OS}" = "${TEST_NEED_OS}" ]; then
- SKIPTEST=1; SKIPREASON="Incorrect guest OS (${TEST_NEED_OS} only)"
- if [ ${LOG_INCORRECT_OS} -eq 0 ]; then
- SKIPLOGTEST=1
+ # Test if our OS is the same as the requested OS (can be multiple values)
+ if [ ${SKIPTEST} -eq 0 -a ! -z "${TEST_NEED_OS}" ]; then
+ HASMATCH=0
+ for I in ${TEST_NEED_OS}; do
+ if [ "${I}" = "${OS}" ]; then HASMATCH=1; fi
+ done
+ if [ ${HASMATCH} -eq 0 ]; then
+ SKIPTEST=1; SKIPREASON="Incorrect guest OS (${TEST_NEED_OS} only)"
+ if [ ${LOG_INCORRECT_OS} -eq 0 ]; then SKIPLOGTEST=1; fi
fi
fi