Bug 1000815 - semanage throws an exception because of a syntax error
Summary: semanage throws an exception because of a syntax error
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: policycoreutils
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-25 15:27 UTC by Nicolas Iooss
Modified: 2014-05-15 11:59 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-05-15 11:59:46 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Nicolas Iooss 2013-08-25 15:27:29 UTC
Description of problem:

There is a syntax error in seobject.py file on line 92. http://userspace.selinuxproject.org/trac/browser/policycoreutils/semanage/seobject.py?rev=da867f68b2f7c94cbc6a455ba7033871e2e536f9#L92 contains: message += " %s name=%s" % (msg, name). As variable "message" is undefined here, Python raises an UnboundLocalError error. Changing += to = would fix this bug.


How reproducible: always


Steps to Reproduce:
1. Run "semanage login -a -s staff_u userlogin" where userlogin is a valid Unix user.
2.
3.

Actual results:

Traceback (most recent call last):
  File "/usr/sbin/semanage", line 569, in <module>
    process_args(sys.argv[1:])
  File "/usr/sbin/semanage", line 411, in process_args
    OBJECT.add(target, seuser, serange)
  File "/usr/lib/python2.7/dist-packages/seobject.py", line 536, in add
    self.__add(name, sename, serange)
  File "/usr/lib/python2.7/dist-packages/seobject.py", line 531, in __add
    self.mylog.log("login", name, sename=sename, serange=serange, serole=",".join(serole), oldserole=",".join(oldserole), oldsename=self.oldsename, oldserange=self.oldserange);
  File "/usr/lib/python2.7/dist-packages/seobject.py", line 90, in log
    message += " %s name=%s" % (msg, name)
UnboundLocalError: local variable 'message' referenced before assignment

Expected results:
No exception

Additional info:
I'm experiencing this issue on a Debian sid system. Gentoo seems to have a patch to fix its package.

Comment 1 Nicolas Iooss 2013-08-28 16:02:34 UTC
This patch seems to fix this bug: http://comments.gmane.org/gmane.comp.security.selinux/19129

Comment 2 Daniel Walsh 2013-08-28 20:03:34 UTC
policycoreutils-2.1.14-75.fc20.x86_64 already looks like this is fixed.

It is still broken in F19 though.


Note You need to log in before you can comment on or make changes to this bug.