[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 33/48] policycoreutils: semanage: print local and dristo



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


   This patch looks good to me. acked.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7dHQsACgkQrlYvE4MpobODNwCgrmn5FzN01WZXnEMl5JONZJ/l
Y9gAnRK/V0ADTEky+DzYGX4jglo8VnzJ
=gt7R
-----END PGP SIGNATURE-----
>From 4a00fa5a7fad043df5f5c10db0902ff1246fe114 Mon Sep 17 00:00:00 2001
From: Dan Walsh <dwalsh@xxxxxxxxxx>
Date: Wed, 16 Nov 2011 15:32:27 -0500
Subject: [PATCH 33/48] policycoreutils: semanage: print local and dristo
 equiv rules

Print out the list of local and distribution file context equivalencies
rather than just local rules.

Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
---
 policycoreutils/semanage/seobject.py |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/policycoreutils/semanage/seobject.py b/policycoreutils/semanage/seobject.py
index e4b6c0d..6ff3ff5 100644
--- a/policycoreutils/semanage/seobject.py
+++ b/policycoreutils/semanage/seobject.py
@@ -1531,6 +1531,7 @@ class fcontextRecords(semanageRecords):
 	def __init__(self, store = ""):
 		semanageRecords.__init__(self, store)
                 self.equiv = {}
+                self.equiv_dist = {}
                 self.equal_ind = False
                 try:
                        fd = open(selinux.selinux_file_context_subs_path(), "r")
@@ -1540,6 +1541,14 @@ class fcontextRecords(semanageRecords):
                        fd.close()
                 except IOError:
                        pass
+                try:
+                       fd = open(selinux.selinux_file_context_subs_dist_path(), "r")
+                       for i in fd.readlines():
+                              src, dst = i.split()
+                              self.equiv_dist[src] = dst
+                       fd.close()
+                except IOError:
+                       pass
 
         def commit(self):
                 if self.equal_ind:
@@ -1600,7 +1609,7 @@ class fcontextRecords(semanageRecords):
                       raise ValueError(_("Invalid file specification"))
                if target.find(" ") != -1:
                       raise ValueError(_("File specification can not include spaces"))
-                      
+
 	def __add(self, target, type, ftype = "", serange = "", seuser = "system_u"):
                 self.validate(target)
 
@@ -1832,9 +1841,17 @@ class fcontextRecords(semanageRecords):
 					print "%-50s %-18s %s:%s:%s " % (k[0], k[1], fcon_dict[k][0], fcon_dict[k][1],fcon_dict[k][2])
 			else:
 				print "%-50s %-18s <<None>>" % (k[0], k[1])
-                if len(self.equiv.keys()) > 0:
+
+
+		if len(self.equiv_dist):
+		       if not locallist:
+			       if heading:
+				       print _("\nSELinux Distribution fcontext Equivalence \n")
+			       for src in self.equiv_dist.keys():
+				       print "%s = %s" % (src, self.equiv_dist[src])
+		if len(self.equiv):
                        if heading:
-                              print _("\nSELinux fcontext Equivalence \n")
+                              print _("\nSELinux Local fcontext Equivalence \n")
 
                        for src in self.equiv.keys():
                               print "%s = %s" % (src, self.equiv[src])
-- 
1.7.7.4


[Fedora Users]     [Fedora Legacy]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite News]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

Powered by Linux