BUG: filter_exclude fails when execute in specific context
SElinux context is parsed in filter_exclude test incorrectly:
if($subj =~ /([^:]+):([^:]+):([^:]+):([^-]+)-([^-]+)/) {
($subj_user, $subj_role, $subj_type, $subj_sen, $subj_clr) = ($1, $2, $3, $4, $5);
}
When there is no clearance (eg. system_u:unconfined_r:unconfined_t:s0 [*]) parsing will not work. The following regex works: ([^:]+):([^:]+):([^:]+):([^-]+)-?([^-]+)?.
Please notice that clearance is used in several places of the test and hence we need to fix those parts as well.
[*] FYI, when I am running testsuite via Beaker, tests are executed with this context.
Reproducer: runcon system_u:unconfined_r:unconfined_t:s0 make tests
Quick fix - https://github.com/The-Mule/audit-testsuite/commit/783e2a558e35a34ba28782866393aa92655c6cdc
Understood. The fix looks good to me.