All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] Separate local file contexts into file_contexts.local
@ 2006-08-11 13:34 Christopher J. PeBenito
  2006-08-11 20:52 ` Stephen Smalley
  0 siblings, 1 reply; 8+ messages in thread
From: Christopher J. PeBenito @ 2006-08-11 13:34 UTC (permalink / raw)
  To: SELinux Mail List

Semanage was looking at the main file contexts in some cases, since the
local file contexts were merged into the main file contexts.  This patch
fixes the code to look at the appropriate file context databases.

 policycoreutils/semanage/seobject.py |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --exclude .svn -urN trunk/policycoreutils/semanage/seobject.py fc-local-fix/policycoreutils/semanage/seobject.py
--- trunk/policycoreutils/semanage/seobject.py	2006-07-31 16:41:07.033676000 -0400
+++ fc-local-fix/policycoreutils/semanage/seobject.py	2006-08-10 09:57:09.205707250 -0400
@@ -1085,13 +1085,13 @@
 		if rc < 0:
 			raise ValueError(_("Could not create a key for %s") % target)
 
-		(rc,exists) = semanage_fcontext_exists(self.sh, k)
+		(rc,exists) = semanage_fcontext_exists_local(self.sh, k)
 		if rc < 0:
 			raise ValueError(_("Could not check if file context for %s is defined") % target)
 		if not exists:
 			raise ValueError(_("File context for %s is not defined") % target)
 		
-		(rc,fcontext) = semanage_fcontext_query(self.sh, k)
+		(rc,fcontext) = semanage_fcontext_query_local(self.sh, k)
 		if rc < 0:
 			raise ValueError(_("Could not query file context for %s") % target)
 
@@ -1124,17 +1124,17 @@
 		if rc < 0:
 			raise ValueError(_("Could not create a key for %s") % target)
 
-		(rc,exists) = semanage_fcontext_exists(self.sh, k)
-		if rc < 0:
-			raise ValueError(_("Could not check if file context for %s is defined") % target)
-		if not exists:
-			raise ValueError(_("File context for %s is not defined") % target)
-		
 		(rc,exists) = semanage_fcontext_exists_local(self.sh, k)
 		if rc < 0:
 			raise ValueError(_("Could not check if file context for %s is defined") % target)
 		if not exists:
-			raise ValueError(_("File context for %s is defined in policy, cannot be deleted") % target)
+			(rc,exists) = semanage_fcontext_exists(self.sh, k)
+			if rc < 0:
+				raise ValueError(_("Could not check if file context for %s is defined") % target)
+			if exists:
+				raise ValueError(_("File context for %s is defined in policy, cannot be deleted") % target)
+			else:
+				raise ValueError(_("File context for %s is not defined") % target)
 
 		rc = semanage_begin_transaction(self.sh)
 		if rc < 0:
@@ -1156,6 +1156,12 @@
 		if rc < 0:
 			raise ValueError(_("Could not list file contexts"))
 
+		(rc, fclocal) = semanage_fcontext_list_local(self.sh)
+		if rc < 0:
+			raise ValueError(_("Could not list local file contexts"))
+
+		self.flist += fclocal
+
 		for fcontext in self.flist:
 			expr = semanage_fcontext_get_expr(fcontext)
 			ftype = semanage_fcontext_get_type(fcontext)


-- 
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-08-16 13:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-11 13:34 [PATCH 3/3] Separate local file contexts into file_contexts.local Christopher J. PeBenito
2006-08-11 20:52 ` Stephen Smalley
2006-08-12 13:21   ` Joshua Brindle
2006-08-14 14:38     ` Stephen Smalley
2006-08-14 19:06       ` Stephen Smalley
2006-08-15 23:42         ` [PATCH 3/3] Separate local file contextsinto file_contexts.local Joshua Brindle
2006-08-16 12:41           ` Stephen Smalley
2006-08-16 13:00             ` Karl MacMillan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.