rpms/policycoreutils/devel policycoreutils-rhat.patch, 1.332, 1.333 policycoreutils.spec, 1.472, 1.473

Daniel J Walsh (dwalsh) fedora-extras-commits at redhat.com
Fri Nov 9 17:11:13 UTC 2007


Author: dwalsh

Update of /cvs/extras/rpms/policycoreutils/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv21804

Modified Files:
	policycoreutils-rhat.patch policycoreutils.spec 
Log Message:
* Thu Nov 9 2007 Dan Walsh <dwalsh at redhat.com> 2.0.31-14
- Fix semanage to handle state where policy.xml is not installed


policycoreutils-rhat.patch:

Index: policycoreutils-rhat.patch
===================================================================
RCS file: /cvs/extras/rpms/policycoreutils/devel/policycoreutils-rhat.patch,v
retrieving revision 1.332
retrieving revision 1.333
diff -u -r1.332 -r1.333
--- policycoreutils-rhat.patch	6 Nov 2007 19:58:41 -0000	1.332
+++ policycoreutils-rhat.patch	9 Nov 2007 17:10:22 -0000	1.333
@@ -207,7 +207,7 @@
  
 diff --exclude-from=exclude --exclude=sepolgen-1.0.10 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/semanage/seobject.py policycoreutils-2.0.31/semanage/seobject.py
 --- nsapolicycoreutils/semanage/seobject.py	2007-10-07 21:46:43.000000000 -0400
-+++ policycoreutils-2.0.31/semanage/seobject.py	2007-11-02 15:54:42.000000000 -0400
++++ policycoreutils-2.0.31/semanage/seobject.py	2007-11-09 12:00:35.000000000 -0500
 @@ -1,5 +1,5 @@
  #! /usr/bin/python -E
 -# Copyright (C) 2005 Red Hat 
@@ -215,7 +215,62 @@
  # see file 'COPYING' for use and warranty information
  #
  # semanage is a tool for managing SELinux configuration files
-@@ -1095,7 +1095,13 @@
+@@ -88,6 +88,35 @@
+ 			
+ mylog = logger()		
+ 
++import sys, os
++import re
++import xml.etree.ElementTree
++
++booleans_dict={}
++try:
++       tree=xml.etree.ElementTree.parse("/usr/share/selinux/devel/policy.xml")
++       for l in  tree.findall("layer"):
++              for m in  l.findall("module"):
++                     for b in  m.findall("tunable"):
++                            desc = b.find("desc").find("p").text.strip("\n")
++                            desc = re.sub("\n", " ", desc)
++                            booleans_dict[b.get('name')] = (m.get("name"), b.get('dftval'), desc)
++                     for b in  m.findall("bool"):
++                            desc = b.find("desc").find("p").text.strip("\n")
++                            desc = re.sub("\n", " ", desc)
++                            booleans_dict[b.get('name')] = (m.get("name"), b.get('dftval'), desc)
++              for i in  tree.findall("bool"):
++                     desc = i.find("desc").find("p").text.strip("\n")
++                     desc = re.sub("\n", " ", desc)
++                     booleans_dict[i.get('name')] = (_("global"), i.get('dftval'), desc)
++       for i in  tree.findall("tunable"):
++              desc = i.find("desc").find("p").text.strip("\n")
++              desc = re.sub("\n", " ", desc)
++              booleans_dict[i.get('name')] = (_("global"), i.get('dftval'), desc)
++except IOError, e:
++       print _("Failed to translate booleans.\n%s") % e
++       pass
++
+ def validate_level(raw):
+ 	sensitivity = "s[0-9]*"
+ 	category = "c[0-9]*"
+@@ -139,7 +168,7 @@
+ 			translations = fd.readlines()
+ 			fd.close()
+ 		except IOError, e:
+-			raise ValueError(_("Unable to open %s: translations not supported on non-MLS machines: %s") % (self.filename, e) )
++			raise ValueError(_("Unable to open %s: translations not supported on non-MLS machines") % (self.filename) )
+ 			
+ 		self.ddict = {}
+ 		self.comments = []
+@@ -236,9 +265,6 @@
+ 		if rc < 0:
+ 			semanage_handle_destroy(self.sh)
+ 			raise ValueError(_("Could not establish semanage connection"))
+-        def deleteall(self):
+-               raise ValueError(_("Not yet implemented"))
+-               
+ 
+ class loginRecords(semanageRecords):
+ 	def __init__(self, store = ""):
+@@ -1095,7 +1121,13 @@
  
                  return con
                 
@@ -229,7 +284,7 @@
  		if is_mls_enabled == 1:
                         serange = untranslate(serange)
  			
-@@ -1154,6 +1160,7 @@
+@@ -1154,6 +1186,7 @@
  	def modify(self, target, setype, ftype, serange, seuser):
  		if serange == "" and setype == "" and seuser == "":
  			raise ValueError(_("Requires setype, serange or seuser"))
@@ -237,43 +292,15 @@
  
  		(rc,k) = semanage_fcontext_key_create(self.sh, target, file_types[ftype])
  		if rc < 0:
-@@ -1303,9 +1310,35 @@
- 			else:
+@@ -1304,6 +1337,7 @@
  				print "%-50s %-18s <<None>>" % (fcon[0], fcon[1])
  				
-+import sys, os
-+import re
-+import xml.etree.ElementTree
-+
  class booleanRecords(semanageRecords):
 +
  	def __init__(self, store = ""):
  		semanageRecords.__init__(self, store)
-+                self.dict={}
-+
-+                tree=xml.etree.ElementTree.parse("/usr/share/selinux/devel/policy.xml")
-+                for l in  tree.findall("layer"):
-+                       for m in  l.findall("module"):
-+                              for b in  m.findall("tunable"):
-+                                     desc = b.find("desc").find("p").text.strip("\n")
-+                                     desc = re.sub("\n", " ", desc)
-+                                     self.dict[b.get('name')] = (m.get("name"), b.get('dftval'), desc)
-+                              for b in  m.findall("bool"):
-+                                     desc = b.find("desc").find("p").text.strip("\n")
-+                                     desc = re.sub("\n", " ", desc)
-+                                     self.dict[b.get('name')] = (m.get("name"), b.get('dftval'), desc)
-+                for i in  tree.findall("bool"):
-+                       desc = i.find("desc").find("p").text.strip("\n")
-+                       desc = re.sub("\n", " ", desc)
-+                       self.dict[i.get('name')] = ("Global", i.get('dftval'), desc)
-+                for i in  tree.findall("tunable"):
-+                       desc = i.find("desc").find("p").text.strip("\n")
-+                       desc = re.sub("\n", " ", desc)
-+                       self.dict[i.get('name')] = ("Global", i.get('dftval'), desc)
- 
- 	def modify(self, name, value = ""):
- 		if value == "":
-@@ -1328,11 +1361,14 @@
+ 
+@@ -1328,11 +1362,14 @@
  		if value != "":
  			nvalue = int(value)
  			semanage_bool_set_value(b, nvalue)
@@ -288,16 +315,22 @@
  		rc = semanage_bool_modify_local(self.sh, k, b)
  		if rc < 0:
  			raise ValueError(_("Could not modify boolean %s") % name)
-@@ -1416,11 +1452,19 @@
+@@ -1416,11 +1453,25 @@
  
  		return ddict
  			
 +        def get_desc(self, boolean):
-+               if boolean in self.dict:
-+                      return _(self.dict[boolean][2])
++               if boolean in booleans_dict:
++                      return _(booleans_dict[boolean][2])
 +               else:
 +                      return boolean
 +
++        def get_category(self, boolean):
++               if boolean in booleans_dict:
++                      return _(booleans_dict[boolean][0])
++               else:
++                      return _("unknown")
++
  	def list(self, heading = 1, locallist = 0):
 +                on_off = (_("off"),_("on")) 
  		if heading:


Index: policycoreutils.spec
===================================================================
RCS file: /cvs/extras/rpms/policycoreutils/devel/policycoreutils.spec,v
retrieving revision 1.472
retrieving revision 1.473
diff -u -r1.472 -r1.473
--- policycoreutils.spec	6 Nov 2007 19:58:42 -0000	1.472
+++ policycoreutils.spec	9 Nov 2007 17:10:22 -0000	1.473
@@ -6,7 +6,7 @@
 Summary: SELinux policy core utilities
 Name:	 policycoreutils
 Version: 2.0.31
-Release: 13%{?dist}
+Release: 14%{?dist}
 License: GPLv2+
 Group:	 System Environment/Base
 Source:	 http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz
@@ -207,6 +207,9 @@
 fi
 
 %changelog
+* Thu Nov 9 2007 Dan Walsh <dwalsh at redhat.com> 2.0.31-14
+- Fix semanage to handle state where policy.xml is not installed
+
 * Mon Nov 5 2007 Dan Walsh <dwalsh at redhat.com> 2.0.31-13
 - Remove -v from restorecon in fixfiles
 




More information about the fedora-extras-commits mailing list