sepolgen fix tests and refpolicy formatting
PATCH 1/1 sepolgen fix tests and refpolicy formatting
The changes I made to match sepolgen policy output with the refpolicy missed type transition rules and broke the unit tests. This patch fixes those two problems.
Signed-off-by Karl MacMillan <[email protected]>
sepolgen/src/sepolgen/refpolicy.py +1 -1
@@ -472,7 +472,7 @@ class TypeRule(Leaf): return "type_member" def to_string(self): - return "%s %s %s : %s %s;" % (self.__rule_type_str(), + return "%s %s %s:%s %s;" % (self.__rule_type_str(), self.src_types.to_space_str(), self.tgt_types.to_space_str(), self.obj_classes.to_space_str(),
sepolgen/tests/test_refpolicy.py +3 -3
@@ -88,7 +88,7 @@ class TestAVRule(unittest.TestCase): a.tgt_types.add("bar_t") a.obj_classes.add("file") a.perms.add("read") - self.assertEquals(a.to_string(), "allow foo_t bar_t : file read;") + self.assertEquals(a.to_string(), "allow foo_t bar_t:file read;") a.rule_type = a.DONTAUDIT a.src_types.add("user_t")
@@ -97,7 +97,7 @@ class TestAVRule(unittest.TestCase): a.perms.add("write") # This test might need to go because set ordering is not guaranteed self.assertEquals(a.to_string(), - "dontaudit { foo_t user_t } { user_home_t bar_t } : { lnk_file file } { read write };") + "dontaudit { foo_t user_t } { user_home_t bar_t }:{ lnk_file file } { read write };") class TestTypeRule(unittest.TestCase): def test_init(self):
@@ -114,7 +114,7 @@ class TestTypeRule(unittest.TestCase): a.tgt_types.add("bar_exec_t") a.obj_classes.add("process") a.dest_type = "bar_t" - self.assertEquals(a.to_string(), "type_transition foo_t bar_exec_t : process bar_t;") + self.assertEquals(a.to_string(), "type_transition foo_t bar_exec_t:process bar_t;") class TestParseNode(unittest.TestCase):
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 5 lines · Karl MacMillan
The changes I made to match sepolgen policy output with the refpolicy missed type transition rules and broke the unit tests. This patch fixes those two problems.
Signed-off-by Karl MacMillan <[email protected]>
Thanks, merged.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.