170610ef88
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/policycoreutils.git#b96da6593911f3b75a2849b5cf8c90b3e98c2977
54 lines
1.8 KiB
Diff
54 lines
1.8 KiB
Diff
From 268cd1b3a346db400eedb66db6a7d0aac192cd5e Mon Sep 17 00:00:00 2001
|
|
From: Petr Lautrbach <plautrba@redhat.com>
|
|
Date: Tue, 28 Feb 2017 21:29:46 +0100
|
|
Subject: [PATCH] sepolicy: Another small optimization for mcs types
|
|
|
|
---
|
|
python/sepolicy/sepolicy/manpage.py | 16 +++++++++++-----
|
|
1 file changed, 11 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/python/sepolicy/sepolicy/manpage.py b/python/sepolicy/sepolicy/manpage.py
|
|
index d15522135288..ffcedb547993 100755
|
|
--- a/python/sepolicy/sepolicy/manpage.py
|
|
+++ b/python/sepolicy/sepolicy/manpage.py
|
|
@@ -144,6 +144,15 @@ def _gen_entry_types():
|
|
entry_types = next(sepolicy.info(sepolicy.ATTRIBUTE, "entry_type"))["types"]
|
|
return entry_types
|
|
|
|
+mcs_constrained_types = None
|
|
+
|
|
+def _gen_mcs_constrained_types():
|
|
+ global mcs_constrained_types
|
|
+ if mcs_constrained_types is None:
|
|
+ mcs_constrained_types = next(sepolicy.info(sepolicy.ATTRIBUTE, "mcs_constrained_type"))
|
|
+ return mcs_constrained_types
|
|
+
|
|
+
|
|
types = None
|
|
|
|
def _gen_types():
|
|
@@ -392,6 +401,7 @@ class ManPage:
|
|
self.types = _gen_types()
|
|
self.exec_types = _gen_exec_types()
|
|
self.entry_types = _gen_entry_types()
|
|
+ self.mcs_constrained_types = _gen_mcs_constrained_types()
|
|
|
|
if self.source_files:
|
|
self.fcpath = self.root + "file_contexts"
|
|
@@ -946,11 +956,7 @@ All executables with the default executable label, usually stored in /usr/bin an
|
|
%s""" % ", ".join(paths))
|
|
|
|
def _mcs_types(self):
|
|
- try:
|
|
- mcs_constrained_type = next(sepolicy.info(sepolicy.ATTRIBUTE, "mcs_constrained_type"))
|
|
- except StopIteration:
|
|
- return
|
|
- if self.type not in mcs_constrained_type['types']:
|
|
+ if self.type not in self.mcs_constrained_types['types']:
|
|
return
|
|
self.fd.write ("""
|
|
.SH "MCS Constrained"
|
|
--
|
|
2.30.0
|
|
|