#22 policycoreutils/sctp_test: Fix a few minor issues
Closed 4 years ago by plautrba. Opened 4 years ago by vmojzis.
tests/ vmojzis/selinux SCTP_new  into  master

@@ -53,7 +53,6 @@ 

          rlRun "semodule -i userapp.cil" 0 "Loading custom policy module"

          rlRun "chcon -t userapp_exec_t `which sctp_test`" 0 "Change file context of sctp_test"

          OUTPUT_FILE=`mktemp`

-         rlRun "chcon -t tmp_t ${OUTPUT_FILE}"

          rlRun "setenforce 1"

          rlRun "sestatus"

      rlPhaseEnd
@@ -61,16 +60,24 @@ 

      rlPhaseStartTest

          rlRun "semanage port -a -t ${PORT_TYPE} -p sctp ${SERVER_PORT}" 0

          rlRun "semanage port -a -t ${PORT_TYPE} -p sctp ${CLIENT_PORT}" 0

+         rlRun "semanage port -l 2>&1 > ${OUTPUT_FILE}" 0

+         rlRun "grep -E \"${PORT_TYPE}.+sctp.+${CLIENT_PORT}\" ${OUTPUT_FILE}"

+         if [ $? -ne 0 ]; then cat ${OUTPUT_FILE}; fi

+         rlRun "semanage port -l -C 2>&1 > ${OUTPUT_FILE}" 0

+         rlRun "grep -E \"${PORT_TYPE}.+sctp.+${SERVER_PORT}\" ${OUTPUT_FILE}"

+         if [ $? -ne 0 ]; then cat ${OUTPUT_FILE}; fi

          rlRun "sctp_test -H localhost -P ${SERVER_PORT} -l 2>&1 > ${OUTPUT_FILE} &" 0

          rlRun "sctp_test -H localhost -P ${CLIENT_PORT} -h localhost -p ${SERVER_PORT} -s" 0

-         rlAssertGrep "recvmsg" ${OUTPUT_FILE} -i

+         rlRun "grep 'recvmsg' ${OUTPUT_FILE} -i" 0

+         if [ $? -ne 0 ]; then cat ${OUTPUT_FILE}; fi

      rlPhaseEnd

  

      rlPhaseStartCleanup

-         rlRun "rm ${OUTPUT_FILE}"

+         rlRun "rm -f ${OUTPUT_FILE}"

          rlRun "killall sctp_test"

          rlRun "semanage port -D"

          rlRun "semodule -r userapp"

+         rlRun "restorecon -Rv `which sctp_test`"

      rlPhaseEnd

  rlJournalPrintText

  rlJournalEnd

@@ -36,5 +36,6 @@ 

  (allow userapp_t userapp_exec_t (file (map)))

  (allow userapp_t userapp_exec_t (file (entrypoint execute read)))

  (allow userapp_t kernel_t (system (module_request)))

+ (allow userapp_t user_tmp_t (file (getattr open write append)))

  

  

  • userapp_t didn't have permission to write into temporary file which
    caused failure of the test even when sctp_test worked properly
  • Fix context of sctp_test during clean-up
  • Add listing of the new portcons to check they have been properly added

The changes look good to me. ack+

Pull-Request has been closed by plautrba

4 years ago