Skip to contentSkip to conversation

semanage Equal.patch

PATCH Daniel J Walsh 1 participant 1 message Sep 30, 2009 SELinux security module

lore
Share & tools
lore
#0 lore raw

This is a patch that provides the fcontext equial to semanage.

policycoreutils/semanage/semanage +15 -2
index 128ab47..e974d33 100644
@@ -84,6 +84,7 @@ Object-specific Options (see above):
 
         -F, --file       Treat target as an input file for command, change multiple settings
 	-p, --proto      Port protocol (tcp or udp) or internet protocol version of node (ipv4 or ipv6)
+        -e, --equal      Make target equal to this paths labeling
 	-M, --mask       Netmask
 	-P, --prefix     Prefix for home directory labeling
 	-L, --level      Default SELinux Level (MLS/MCS Systems only)
@@ -193,6 +194,7 @@ Object-specific Options (see above):
 		locallist = False
 		use_file = False
                 store = ""
+                equal=""
                 enable = False
                 disable = False
 			
@@ -208,6 +210,7 @@ Object-specific Options (see above):
 					    ['add',
 					     'delete',
 					     'deleteall',
+					     'equal=',
 					     'ftype=',
 					     'file',
 					     'help',
@@ -248,6 +251,9 @@ Object-specific Options (see above):
                                        raise ValueError(_("%s bad option") % o)
 				deleteall = True
 
+			if o == "-e"  or o == "--equal":
+				equal = a
+
 			if o == "--enable":
                                 if disable:
                                        raise ValueError(_("You can't disable and enable at the same time"))
@@ -384,7 +390,11 @@ Object-specific Options (see above):
 				OBJECT.add(target, mask, proto, serange, setype)
 
 			if object == "fcontext":
-				OBJECT.add(target, setype, ftype, serange, seuser)
+                                if equal == "":
+                                       OBJECT.add(target, setype, ftype, serange, seuser)
+                                else:
+                                       OBJECT.add_equal(target, equal)
+
 			if object == "permissive":
 				OBJECT.add(target)
 
@@ -419,7 +429,10 @@ Object-specific Options (see above):
 				OBJECT.modify(target, mask, proto, serange, setype)
 
 			if object == "fcontext":
-				OBJECT.modify(target, setype, ftype, serange, seuser)
+                                if equal == "":
+                                       OBJECT.modify(target, setype, ftype, serange, seuser)
+                                else:
+                                       OBJECT.modify_equal(target, equal)
 
                         return
 
policycoreutils/semanage/seobject.py +52 -2

78 lines not on this page · raw message