sepolgen: initialize gen_cil
PATCH 1/2 sepolgen: initialize gen_cil
From: Dmitry Sharshakov <[email protected]>
Avoid errors when adding comments to CIL output like in audit2allow
Signed-off-by Dmitry Sharshakov <[email protected]>
--- python/sepolgen/src/sepolgen/refpolicy.py | 1 + 1 file changed, 1 insertion(+)
python/sepolgen/src/sepolgen/refpolicy.py +1 -0
@@ -1217,6 +1217,7 @@ class Comment: self.lines = l else: self.lines = [] + self.gen_cil = False def to_string(self): # If there are no lines, treat this as a spacer between
Signature · 1 line
2.45.2
PATCH 2/2 policygen: respect CIL option when generating comments
From: Dmitry Sharshakov <[email protected]>
Make explanatory comments follow the common style of comments (Classic language / CIL)
Signed-off-by Dmitry Sharshakov <[email protected]>
--- python/sepolgen/src/sepolgen/policygen.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
python/sepolgen/src/sepolgen/policygen.py +3 -1
@@ -179,7 +179,9 @@ class PolicyGenerator: rule.rule_type = rule.DONTAUDIT rule.comment = "" if self.explain: - rule.comment = str(refpolicy.Comment(explain_access(av, verbosity=self.explain))) + comment = refpolicy.Comment(explain_access(av, verbosity=self.explain)) + comment.set_gen_cil(self.gen_cil) + rule.comment = str(comment) if av.type == audit2why.ALLOW: rule.comment += "\n%s!!!! This avc is allowed in the current policy" % self.comment_start
Signature · 1 line
2.45.2
Quoted 6 lines · On Thu, Aug 1, 2024 at 3:35 PM <[email protected]> wrote:
From: Dmitry Sharshakov <[email protected]>
Avoid errors when adding comments to CIL output like in audit2allow
Signed-off-by Dmitry Sharshakov <[email protected]>
For these two patches:
Acked-by James Carter <[email protected]>
Quoted 20 lines
--- python/sepolgen/src/sepolgen/refpolicy.py | 1 + 1 file changed, 1 insertion(+)python/sepolgen/src/sepolgen/refpolicy.py +1
-1@@ -1217,6 +1217,7 @@ class Comment: self.lines = l else: self.lines = [] + self.gen_cil = False def to_string(self): # If there are no lines, treat this as a spacer between --2.45.2
Quoted 12 lines · James Carter
Quoted 6 lines · On Thu, Aug 1, 2024 at 3:35 PM <[email protected]> wrote:
From: Dmitry Sharshakov <[email protected]>
Avoid errors when adding comments to CIL output like in audit2allow
Signed-off-by Dmitry Sharshakov <[email protected]>For these two patches:
Acked-by James Carter <[email protected]>
These two patches have been merged.
Thanks,
Jim
Quoted 20 lines
Quoted 20 lines
--- python/sepolgen/src/sepolgen/refpolicy.py | 1 + 1 file changed, 1 insertion(+)python/sepolgen/src/sepolgen/refpolicy.py +1
-1@@ -1217,6 +1217,7 @@ class Comment: self.lines = l else: self.lines = [] + self.gen_cil = False def to_string(self): # If there are no lines, treat this as a spacer between --2.45.2