Add alias man pages to sepolicy manpage

This commit is contained in:
rhatdan 2012-10-30 16:40:08 -04:00
parent 13f0c57022
commit d76fa39cad
4 changed files with 30 additions and 19 deletions

View File

@ -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@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']

View File

@ -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@redhat.com> - 2.1.12-22
- Add alias man pages to sepolicy manpage
* Mon Oct 29 2012 Dan Walsh <dwalsh@redhat.com> - 2.1.12-21
- Redesign sepolicy to only read the policy file once, not for every call

View File

@ -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;

View File

@ -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;