public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: policycoreutils/sctp_test: Fix a few minor issues
@ 2026-09-11 13:17 Vit Mojzis
  0 siblings, 0 replies; only message in thread
From: Vit Mojzis @ 2026-09-11 13:17 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 34b485bf017da922307fc4a6b7cec0aaf3154284
            Author : Vit Mojzis <vmojzis@redhat.com>
            Date   : 2019-11-15T07:57:02+01:00
            Stats  : +11/-3 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/34b485bf017da922307fc4a6b7cec0aaf3154284?branch=pr775-checkpolicy-revdeps

            Log:
            policycoreutils/sctp_test: Fix a few minor issues

- 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

Fixes: https://src.fedoraproject.org/tests/selinux/issue/21

---
diff --git a/policycoreutils/sctp_test/runtest.sh b/policycoreutils/sctp_test/runtest.sh
index d8f386c..a7e55c7 100755
--- a/policycoreutils/sctp_test/runtest.sh
+++ b/policycoreutils/sctp_test/runtest.sh
@@ -53,7 +53,6 @@ rlJournalStart
         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 @@ rlJournalStart
     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

diff --git a/policycoreutils/sctp_test/userapp.cil b/policycoreutils/sctp_test/userapp.cil
index 88e065e..4a5114a 100644
--- a/policycoreutils/sctp_test/userapp.cil
+++ b/policycoreutils/sctp_test/userapp.cil
@@ -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)))
 
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-11 13:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 13:17 [tests/selinux] pr775-checkpolicy-revdeps: policycoreutils/sctp_test: Fix a few minor issues Vit Mojzis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox