Skip to contentSkip to conversation

sepolgen fix tests and refpolicy formatting

PATCH In review Karl MacMillan 2 participants 2 messages Mar 20, 2007 – Mar 21, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

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.

sepolgen/src/sepolgen/refpolicy.py +1 -1
diff -r c1ec2b56423b sepolgen/src/sepolgen/refpolicy.py
@@ -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
diff -r c1ec2b56423b sepolgen/tests/test_refpolicy.py
@@ -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.

#1 lore raw
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.

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.