diff --git a/include/tests_authentication b/include/tests_authentication index 0f4b95e0..7458c487 100644 --- a/include/tests_authentication +++ b/include/tests_authentication @@ -1048,7 +1048,7 @@ if [ -n "${FIND}" ]; then LogText "Result: found /etc/profile.d, with one or more files in it" for FILE in ${FIND}; do - HAS_MASK=$(${GREPBINARY} umask ${FILE} | ${SEDBINARY} 's/^[ \t]*//' | ${GREPBINARY} -v "^#" | ${AWKBINARY} '{ print $2 }') + HAS_MASK=$(${GREPBINARY} umask ${FILE} 2> /dev/null | ${SEDBINARY} 's/^[ \t]*//' | ${GREPBINARY} -v "^#" | ${AWKBINARY} '{ print $2 }') for MASK in ${HAS_MASK}; do if [ "${MASK}" = "077" -o "${MASK}" = "027" -o "${MASK}" = "0077" -o "${MASK}" = "0027" ]; then LogText "Result: found a strong umask '${MASK}' set in ${FILE}" diff --git a/include/tests_kernel b/include/tests_kernel index 56df2a99..95634786 100644 --- a/include/tests_kernel +++ b/include/tests_kernel @@ -527,6 +527,7 @@ for I in $(file ${ROOTDIR}boot/vmlinuz-linux); do if [ ${NEXTLINE} -eq 1 ]; then FINDVERSION="${I}" + break else # Searching for the Linux kernel after the keyword 'version' if [ "${I}" = "version" ]; then NEXTLINE=1; fi @@ -541,16 +542,28 @@ else ReportException "${TEST_NO}:1" "Can't determine kernel version on disk, need debug data" fi - elif [ -f ${ROOTDIR}boot/vmlinuz-linux -o -f ${ROOTDIR}boot/vmlinuz-linux-lts ]; then + elif [ -f ${ROOTDIR}boot/vmlinuz-linux -o -f ${ROOTDIR}boot/vmlinuz-linux-lts -o -f $(ls -t ${ROOTDIR}boot/vmlinuz-* | head -1) ]; then if [ -f ${ROOTDIR}boot/vmlinuz-linux ]; then - LogText "Result: /found /boot/vmlinuz-linux (usually Arch Linux or similar)" - LogText "Test: checking kernel version on disk" - VERSION_ON_DISK=$(${FILEBINARY} -b ${ROOTDIR}boot/vmlinuz-linux | ${AWKBINARY} '{ if ($1=="Linux" && $7=="version") { print $8 }}') + FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-linux + elif [ -f ${ROOTDIR}boot/vmlinuz-linux-lts ]; then + FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-linux-lts else - LogText "Result: /found /boot/vmlinuz-linux-lts (usually Arch Linux or similar)" - LogText "Test: checking kernel version on disk" - VERSION_ON_DISK=$(${FILEBINARY} -b ${ROOTDIR}boot/vmlinuz-linux-lts | ${AWKBINARY} '{ if ($1=="Linux" && $7=="version") { print $8 }}') + FOUND_VMLINUZ=$(ls -t ${ROOTDIR}boot/vmlinuz-* | head -1) fi + LogText "Result: /found /boot/vmlinuz-linux-lts (usually Arch Linux or similar)" + LogText "Test: checking kernel version on disk" + #VERSION_ON_DISK=$(${FILEBINARY} -b ${FOUND_VMLINUZ} | ${AWKBINARY} '{ if ($1=="Linux" && $7=="version") { print $8 }}') + NEXTLINE=0 + VERSION_ON_DISK="" + for I in $(file ${FOUND_VMLINUZ}); do + if [ ${NEXTLINE} -eq 1 ]; then + VERSION_ON_DISK="${I}" + break + else + # Searching for the Linux kernel after the keyword 'version' + if [ "${I}" = "version" ]; then NEXTLINE=1; fi + fi + done if [ -n "${VERSION_ON_DISK}" ]; then LogText "Result: found version ${VERSION_ON_DISK}" ACTIVE_KERNEL=$(uname -r)