|
|
1a445b |
From 3748b7eab7434698998edfcf613fe738cf19d5c9 Mon Sep 17 00:00:00 2001
|
|
|
e65efd |
From: Petr Lautrbach <plautrba@redhat.com>
|
|
|
e65efd |
Date: Mon, 27 Feb 2017 17:12:39 +0100
|
|
|
e65efd |
Subject: [PATCH] sepolicy: Drop old interface file_type_is_executable(f) and
|
|
|
e65efd |
file_type_is_entrypoint(f)
|
|
|
1a445b |
Content-type: text/plain
|
|
|
e65efd |
|
|
|
e65efd |
- use direct queries
|
|
|
e65efd |
- load exec_types and entry_types only once
|
|
|
e65efd |
---
|
|
|
e65efd |
python/sepolicy/sepolicy/manpage.py | 22 ++++++++++++++++++++--
|
|
|
e65efd |
1 file changed, 20 insertions(+), 2 deletions(-)
|
|
|
e65efd |
|
|
|
e65efd |
diff --git a/python/sepolicy/sepolicy/manpage.py b/python/sepolicy/sepolicy/manpage.py
|
|
|
1a445b |
index 3ae2f42b2fdf..5a434bd360ae 100755
|
|
|
e65efd |
--- a/python/sepolicy/sepolicy/manpage.py
|
|
|
e65efd |
+++ b/python/sepolicy/sepolicy/manpage.py
|
|
|
e65efd |
@@ -127,8 +127,24 @@ def gen_domains():
|
|
|
e65efd |
domains.sort()
|
|
|
e65efd |
return domains
|
|
|
e65efd |
|
|
|
e65efd |
-types = None
|
|
|
e65efd |
|
|
|
e65efd |
+exec_types = None
|
|
|
e65efd |
+
|
|
|
e65efd |
+def _gen_exec_types():
|
|
|
e65efd |
+ global exec_types
|
|
|
e65efd |
+ if exec_types is None:
|
|
|
e65efd |
+ exec_types = next(sepolicy.info(sepolicy.ATTRIBUTE, "exec_type"))["types"]
|
|
|
e65efd |
+ return exec_types
|
|
|
e65efd |
+
|
|
|
e65efd |
+entry_types = None
|
|
|
e65efd |
+
|
|
|
e65efd |
+def _gen_entry_types():
|
|
|
e65efd |
+ global entry_types
|
|
|
e65efd |
+ if entry_types is None:
|
|
|
e65efd |
+ entry_types = next(sepolicy.info(sepolicy.ATTRIBUTE, "entry_type"))["types"]
|
|
|
e65efd |
+ return entry_types
|
|
|
e65efd |
+
|
|
|
e65efd |
+types = None
|
|
|
e65efd |
|
|
|
e65efd |
def _gen_types():
|
|
|
e65efd |
global types
|
|
|
e65efd |
@@ -374,6 +390,8 @@ class ManPage:
|
|
|
e65efd |
self.all_file_types = sepolicy.get_all_file_types()
|
|
|
e65efd |
self.role_allows = sepolicy.get_all_role_allows()
|
|
|
e65efd |
self.types = _gen_types()
|
|
|
e65efd |
+ self.exec_types = _gen_exec_types()
|
|
|
e65efd |
+ self.entry_types = _gen_entry_types()
|
|
|
e65efd |
|
|
|
e65efd |
if self.source_files:
|
|
|
e65efd |
self.fcpath = self.root + "file_contexts"
|
|
|
e65efd |
@@ -691,7 +709,7 @@ Default Defined Ports:""")
|
|
|
e65efd |
for f in self.all_file_types:
|
|
|
e65efd |
if f.startswith(self.domainname):
|
|
|
e65efd |
flist.append(f)
|
|
|
e65efd |
- if not file_type_is_executable(f) or not file_type_is_entrypoint(f):
|
|
|
1a445b |
+ if f not in self.exec_types or f not in self.entry_types:
|
|
|
e65efd |
flist_non_exec.append(f)
|
|
|
e65efd |
if f in self.fcdict:
|
|
|
e65efd |
mpaths = mpaths + self.fcdict[f]["regex"]
|
|
|
e65efd |
--
|
|
|
1a445b |
2.35.1
|
|
|
e65efd |
|