sepolgen: better match refpolicy style in output
PATCH 1/1 sepolgen: better match refpolicy style in output
This patch makes the output of sepolgen better match the reference policy by:
* removing the space between target types and object classes (e.g., allow foo bar:file read).
* using self when the source and target match.
Signed-off-by Karl MacMillan <[email protected]>
sepolgen/src/sepolgen/refpolicy.py +5 -2
@@ -427,7 +427,10 @@ class AVRule(Leaf): rule. """ self.src_types.add(av.src_type) - self.tgt_types.add(av.tgt_type) + if av.src_type == av.tgt_type: + self.tgt_types.add("self") + else: + self.tgt_types.add(av.tgt_type) self.obj_classes.add(av.obj_class) self.perms.update(av.perms)
@@ -436,7 +439,7 @@ class AVRule(Leaf): that is a valid policy language representation (assuming that the types, object class, etc. are valie). """ - 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(),
--
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.