Skip to contentSkip to conversation

semanage: TypeError: cannot concatenate 'str' and 'NoneType' objects

DISCUSSION Laurent Bigonville 1 participant 3 messages May 18, 2014 – Jul 13, 2015 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hello,

On a machine without python-audit installed, changing the seuser is creating the following backtrace.

$ sudo semanage login -m -s root root
Traceback (most recent call last):
  File "/usr/sbin/semanage", line 840, in <module>
    do_parser()
  File "/usr/sbin/semanage", line 819, in do_parser
    args.func(args)
  File "/usr/sbin/semanage", line 201, in handleLogin
    OBJECT.modify(args.login, args.seuser, args.range)
  File "/usr/lib/python2.7/dist-packages/seobject.py", line 594, in modify
    self.__modify(name, sename, serange)
  File "/usr/lib/python2.7/dist-packages/seobject.py", line 589, in __modify
    self.mylog.log("login", name,sename=self.sename,serange=self.serange, serole=",".join(serole), oldserole=",".join(oldserole), oldsename=self.oldsename, oldserange=self.oldserange);
  File "/usr/lib/python2.7/dist-packages/seobject.py", line 110, in log
    message += " sename=" + sename
TypeError: cannot concatenate 'str' and 'NoneType' objects

Looking at the code, it seems that semange is only checking if sename is an empty string or not (if sename != "") but here it seems that sename is a None object. I guess the code should also check this?

Cheers,

Laurent Bigonville

#1 lore raw

Hello,

Bumping a (quite) old mail.

If the audit python binding, "semanage login -m -s root root" is crashing with a backtrace in the logging part of the code.

It seems that the sename variable is not properly set (type None), the question is, is that expected?

The original bug report is located at:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734806

Cheers,

Laurent Bigonville

Quoted 37 lines · Laurent Bigonville

Hello,

On a machine without python-audit installed, changing the seuser is creating the following backtrace.

$ sudo semanage login -m -s root root
Traceback (most recent call last):
  File "/usr/sbin/semanage", line 840, in <module>
    do_parser()
  File "/usr/sbin/semanage", line 819, in do_parser
    args.func(args)
  File "/usr/sbin/semanage", line 201, in handleLogin
    OBJECT.modify(args.login, args.seuser, args.range)
  File "/usr/lib/python2.7/dist-packages/seobject.py", line 594, in
modify self.__modify(name, sename, serange)
  File "/usr/lib/python2.7/dist-packages/seobject.py", line 589, in
__modify self.mylog.log("login",
name,sename=self.sename,serange=self.serange,
serole=",".join(serole), oldserole=",".join(oldserole),
oldsename=self.oldsename, oldserange=self.oldserange); File
"/usr/lib/python2.7/dist-packages/seobject.py", line 110, in log
message += " sename=" + sename TypeError: cannot concatenate 'str'
and 'NoneType' objects

Looking at the code, it seems that semange is only checking if sename is an empty string or not (if sename != "") but here it seems that sename is a None object. I guess the code should also check this?

Cheers,

Laurent Bigonville
_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to [email protected].

#2 lore raw
Quoted 6 lines · Laurent Bigonville

Hello,

Bumping a (quite) old mail.

If the audit python binding, "semanage login -m -s root root" is crashing with a backtrace in the logging part of the code.

If the audit python binding *is not installed*, "semanage login -m -s root root" is crashing with a backtrace in the logging part of the code.