Skip to contentSkip to conversation

Fix boolean handling in semanage

PATCH Daniel J Walsh 2 participants 2 messages Sep 30, 2009 – Nov 10, 2009 SELinux security module

lore
Share & tools
lore
#0 lore raw

Also fix error message triggered by broken boolean handling.

policycoreutils/semanage/semanage +2 -1
index ffaca5b..437eca3 100644
@@ -315,6 +315,7 @@ Object-specific Options (see above):
 		
 		if object == "boolean":
 			OBJECT = seobject.booleanRecords(store)
+                        modify = True
 		
 		if object == "permissive":
 			OBJECT = seobject.permissiveRecords(store)
@@ -404,7 +405,7 @@ Object-specific Options (see above):
 
                         return
 
-                raise ValueError(_("Invalid command") % " ".join(argv))
+                raise ValueError(_("Invalid command: semanage %s") % " ".join(argv))
 
 	#
 	# 
#1 lore raw

policycoreutils/semanage/semanage Object-specific Options (see above): · line 319

Quoted 13 lines · Daniel J Walsh

Also fix error message triggered by broken boolean handling.

policycoreutils/semanage/semanage +1 -0
index ffaca5b..437eca3 100644
@@ -315,6 +315,7 @@ Object-specific Options (see above):
 
         if object == "boolean":
             OBJECT = seobject.booleanRecords(store)
+                        modify = True
 

Not sure I see what was broken here. The usage and man page say you have to specify -d or -m to semanage boolean (which is just like all the other subcommands). Here you're trying to make that optional, and default to -m if not specified (unless I'm guessing wrong at your intentions). I'd be fine with that, but you broke -d in the process:

# semanage boolean -d xen_use_nfs
Traceback (most recent call last):
  File "/usr/sbin/semanage", line 461, in <module>
    process_args(sys.argv[1:])
  File "/usr/sbin/semanage", line 370, in process_args
    OBJECT.modify(target, value, use_file)
  File "/usr/lib/python2.6/site-packages/seobject.py", line 1642, in modify
    self.__mod(name, value)
  File "/usr/lib/python2.6/site-packages/seobject.py", line 1610, in __mod
    if value.upper() in self.dict:
AttributeError: 'NoneType' object has no attribute 'upper'
Quoted 11 lines
policycoreutils/semanage/semanage +1 -1
         if object == "permissive":
             OBJECT = seobject.permissiveRecords(store)
@@ -404,7 +405,7 @@ Object-specific Options (see above):
 
                         return
 
-                raise ValueError(_("Invalid command") % " ".join(argv))
+                raise ValueError(_("Invalid command: semanage %s") % "
 ".join(argv))
 
     #
Quoted 3 lines
     # 

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.