Blame SOURCES/0004-Fix-STANDARD_FILE_CONTEXT-section-in-man-pages.patch

0cec52
From 7504614fdd7dcf11b3a7568ca9b4b921973531dd Mon Sep 17 00:00:00 2001
0cec52
From: Dan Walsh <dwalsh@redhat.com>
0cec52
Date: Mon, 21 Apr 2014 13:54:40 -0400
0cec52
Subject: [PATCH 04/20] Fix STANDARD_FILE_CONTEXT section in man pages
0cec52
0cec52
Signed-off-by: Miroslav Grepl <mgrepl@redhat.com>
0cec52
---
0cec52
 python/sepolicy/sepolicy/manpage.py | 7 +++++--
0cec52
 1 file changed, 5 insertions(+), 2 deletions(-)
0cec52
0cec52
diff --git a/python/sepolicy/sepolicy/manpage.py b/python/sepolicy/sepolicy/manpage.py
0cec52
index 1d367962..24e311a3 100755
0cec52
--- a/python/sepolicy/sepolicy/manpage.py
0cec52
+++ b/python/sepolicy/sepolicy/manpage.py
0cec52
@@ -735,10 +735,13 @@ Default Defined Ports:""")
0cec52
 
0cec52
     def _file_context(self):
0cec52
         flist = []
0cec52
+        flist_non_exec = []
0cec52
         mpaths = []
0cec52
         for f in self.all_file_types:
0cec52
             if f.startswith(self.domainname):
0cec52
                 flist.append(f)
0cec52
+                if not file_type_is_executable(f) or not file_type_is_entrypoint(f):
0cec52
+                    flist_non_exec.append(f)
0cec52
                 if f in self.fcdict:
0cec52
                     mpaths = mpaths + self.fcdict[f]["regex"]
0cec52
         if len(mpaths) == 0:
0cec52
@@ -797,12 +800,12 @@ SELinux %(domainname)s policy is very flexible allowing users to setup their %(d
0cec52
 SELinux defines the file context types for the %(domainname)s, if you wanted to
0cec52
 store files with these types in a diffent paths, you need to execute the semanage command to sepecify alternate labeling and then use restorecon to put the labels on disk.
0cec52
 
0cec52
-.B semanage fcontext -a -t %(type)s '/srv/%(domainname)s/content(/.*)?'
0cec52
+.B semanage fcontext -a -t %(type)s '/srv/my%(domainname)s_content(/.*)?'
0cec52
 .br
0cec52
 .B restorecon -R -v /srv/my%(domainname)s_content
0cec52
 
0cec52
 Note: SELinux often uses regular expressions to specify labels that match multiple files.
0cec52
-""" % {'domainname': self.domainname, "type": flist[0]})
0cec52
+""" % {'domainname': self.domainname, "type": flist_non_exec[-1]})
0cec52
 
0cec52
         self.fd.write(r"""
0cec52
 .I The following file types are defined for %(domainname)s:
0cec52
-- 
0cec52
2.21.0
0cec52