[policycoreutils] Add alias man pages to sepolicy manpage

Daniel J Walsh dwalsh at fedoraproject.org
Tue Oct 30 20:40:20 UTC 2012


commit d76fa39cad5934e9ad2730136c8e1ae470b431fc
Author: rhatdan <dwalsh at redhat.com>
Date:   Tue Oct 30 16:40:08 2012 -0400

    Add alias man pages to sepolicy manpage

 policycoreutils-rhat.patch    |   40 ++++++++++++++++++++++++----------------
 policycoreutils.spec          |    5 ++++-
 selinux-polgengui.desktop     |    2 +-
 system-config-selinux.desktop |    2 +-
 4 files changed, 30 insertions(+), 19 deletions(-)
---
diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch
index 08ec8a6..156f3fc 100644
--- a/policycoreutils-rhat.patch
+++ b/policycoreutils-rhat.patch
@@ -343679,10 +343679,10 @@ index 0000000..93b0762
 +            return out
 diff --git a/policycoreutils/sepolicy/sepolicy/manpage.py b/policycoreutils/sepolicy/sepolicy/manpage.py
 new file mode 100755
-index 0000000..7a07b5a
+index 0000000..94d89b2
 --- /dev/null
 +++ b/policycoreutils/sepolicy/sepolicy/manpage.py
-@@ -0,0 +1,1279 @@
+@@ -0,0 +1,1287 @@
 +#! /usr/bin/python -Es
 +# Copyright (C) 2012 Red Hat
 +# AUTHOR: Dan Walsh <dwalsh at redhat.com>
@@ -343717,7 +343717,8 @@ index 0000000..7a07b5a
 +import commands
 +import sys, os, re, time
 +
-+equiv_dict={ "smbd" : "samba", "httpd" : "apache" }
++equiv_dict={ "smbd" : ( "samba" ), "httpd" : ( "apache" ), "virtd" : ( "virt", "libvirtd" ) }
++
 +def _gen_modules_dict():
 +        import xml.etree.ElementTree
 +        modules_dict = {}
@@ -343737,7 +343738,7 @@ index 0000000..7a07b5a
 +        except IOError, e:
 +                pass
 +        return modules_dict
-+modules_dict = None
++modules_dict = _gen_modules_dict()
 +
 +all_attributes = map(lambda x: x['name'], sepolicy.info(sepolicy.ATTRIBUTE))
 +entrypoints =  sepolicy.info(sepolicy.ATTRIBUTE,"entry_type")[0]["types"]
@@ -344137,16 +344138,11 @@ index 0000000..7a07b5a
 +    """
 +    def __init__(self, domainname, path = "/tmp", html = False):
 +        self.html = html
-+	if domainname.endswith("_t"):
-+		self.domainname = domainname[:-2]
-+	else:
-+		self.domainname = domainname
-+		
-+	if self.domainname + "_t" not in alldomains:
-+                raise  ValueError("domain %s_t does not exist" % self.domainname)
-+        self.short_name = self.domainname
++	self.path = path
++        self.domainname = domainname
++        self.short_name = domainname
 +        self.type = self.domainname + "_t"
-+        self.man_page_path = "%s/%s_selinux.8" % (path, self.domainname)
++        self.man_page_path = "%s/%s_selinux.8" % (path, domainname)
 +        self.fd = open(self.man_page_path, 'w')
 +        if domainname in roles:
 +            self.__gen_user_man_page()
@@ -344158,13 +344154,17 @@ index 0000000..7a07b5a
 +            self.__gen_man_page()
 +        self.fd.close()
 +
++	for k in equiv_dict.keys():
++		if k == self.domainname:
++			for alias in equiv_dict[k]:
++				self.__gen_man_page_link(alias)
++
 +    def get_man_page_path(self):
 +            return self.man_page_path
 +
 +    def __gen_user_man_page(self):
 +        self.role = self.domainname + "_r"
-+	if not modules_dict:
-+		modules_dict = _gen_modules_dict()
++
 +        try:
 +            self.desc = modules_dict[self.domainname]
 +        except:
@@ -344190,6 +344190,13 @@ index 0000000..7a07b5a
 +        self._writes()
 +        self._footer()
 +
++    def __gen_man_page_link(self, alias):
++	    path = "%s/%s_selinux.8" % (self.path, alias)
++	    self.fd = open("%s/%s_selinux.8" % (self.path, alias), 'w')
++	    self.fd.write(".so man8/%s_selinux.8" % self.domainname)
++	    self.fd.close()
++	    print path
++
 +    def __gen_man_page(self):
 +        if self.domainname[-1]=='d':
 +            self.short_name = self.domainname[:-1]
@@ -344363,7 +344370,8 @@ index 0000000..7a07b5a
 +    def _booleans(self):
 +        self.booltext = self._gen_bool_text(self.short_name)
 +        if self.domainname in equiv_dict.keys():
-+                self.booltext += self._gen_bool_text(equiv_dict[self.domainname])
++		for alias in equiv_dict[self.domainname]:
++			self.booltext += self._gen_bool_text(alias)
 +
 +        for bdict in bools:
 +            b = bdict['name']
diff --git a/policycoreutils.spec b/policycoreutils.spec
index c6cfad7..5f85c8d 100644
--- a/policycoreutils.spec
+++ b/policycoreutils.spec
@@ -7,7 +7,7 @@
 Summary: SELinux policy core utilities
 Name:	 policycoreutils
 Version: 2.1.13
-Release: 21%{?dist}
+Release: 22%{?dist}
 License: GPLv2
 Group:	 System Environment/Base
 # Based on git repository with tag 20101221
@@ -329,6 +329,9 @@ The policycoreutils-restorecond package contains the restorecond service.
 %{_bindir}/systemctl try-restart restorecond.service >/dev/null 2>&1 || :
 
 %changelog
+* Tue Oct 30 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.12-22
+- Add alias man pages to sepolicy manpage
+
 * Mon Oct 29 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.12-21
 - Redesign sepolicy to only read the policy file once, not for every call
 
diff --git a/selinux-polgengui.desktop b/selinux-polgengui.desktop
index 49e3c79..0c2f399 100644
--- a/selinux-polgengui.desktop
+++ b/selinux-polgengui.desktop
@@ -64,4 +64,4 @@ Type=Application
 Terminal=false
 Categories=System;Security;
 X-Desktop-File-Install-Version=0.2
-Keywords=policy;security;selinux;avc;permission;mac
+Keywords=policy;security;selinux;avc;permission;mac;
diff --git a/system-config-selinux.desktop b/system-config-selinux.desktop
index a10497d..8822ce2 100644
--- a/system-config-selinux.desktop
+++ b/system-config-selinux.desktop
@@ -64,4 +64,4 @@ Type=Application
 Terminal=false
 Categories=System;Security;
 X-Desktop-File-Install-Version=0.2
-Keywords=policy;security;selinux;avc;permission;mac
+Keywords=policy;security;selinux;avc;permission;mac;


More information about the scm-commits mailing list