Bug 1000815 - semanage throws an exception because of a syntax error
semanage throws an exception because of a syntax error
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: policycoreutils (Show other bugs)
rawhide
Unspecified Linux
unspecified Severity high
: ---
: ---
Assigned To: Daniel Walsh
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-25 11:27 EDT by Nicolas Iooss
Modified: 2014-05-15 07:59 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-05-15 07:59:46 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nicolas Iooss 2013-08-25 11:27:29 EDT
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 12:02:34 EDT
This patch seems to fix this bug: http://comments.gmane.org/gmane.comp.security.selinux/19129
Comment 2 Daniel Walsh 2013-08-28 16:03:34 EDT
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.