aboutsummaryrefslogtreecommitdiffstats
path: root/dbus/selinux_server.py
diff options
context:
space:
mode:
authorPetr Lautrbach <plautrba@redhat.com>2017-05-03 12:30:32 +0200
committerStephen Smalley <sds@tycho.nsa.gov>2017-05-05 11:52:19 -0400
commitbe0acfb491dff3e0a9c8ad7320f3d69260337c1e (patch)
tree59e9e9bd32db1d774cab8bcba78c8a8c903f3c89 /dbus/selinux_server.py
parent4a7de9ffdc18828eb91fdbe23579eaea217ea711 (diff)
downloadandroid_external_selinux-be0acfb491dff3e0a9c8ad7320f3d69260337c1e.tar.gz
android_external_selinux-be0acfb491dff3e0a9c8ad7320f3d69260337c1e.tar.bz2
android_external_selinux-be0acfb491dff3e0a9c8ad7320f3d69260337c1e.zip
dbus: Use text streams in selinux_server.py
subprocess.Popen called without universal_newlines=True opens stdin, stout and stderr as binary stream which cause problems with Python 3. Fixes: Traceback (most recent call last): File "/usr/lib64/python3.4/site-packages/sepolicy/gui.py", line 2773, in unconfined_toggle self.dbus.semanage("module -e unconfined") File "<string>", line 2, in semanage File "/usr/lib/python3.4/site-packages/slip/dbus/polkit.py", line 121, in _enable_proxy return func(*p, **k) File "/usr/lib64/python3.4/site-packages/sepolicy/sedbus.py", line 14, in semanage ret = self.dbus_object.semanage(buf, dbus_interface = "org.selinux") File "/usr/lib64/python3.4/site-packages/dbus/proxies.py", line 145, in __call__ **keywords) File "/usr/lib64/python3.4/site-packages/dbus/connection.py", line 651, in call_blocking message, timeout) dbus.exceptions.DBusException: org.freedesktop.DBus.Python.TypeError: TypeError: 'dbus.String' does not support the buffer interface Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
Diffstat (limited to 'dbus/selinux_server.py')
-rw-r--r--dbus/selinux_server.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/dbus/selinux_server.py b/dbus/selinux_server.py
index aae8b5fa..6e380e58 100644
--- a/dbus/selinux_server.py
+++ b/dbus/selinux_server.py
@@ -24,7 +24,7 @@ class selinux_server(slip.dbus.service.Object):
@slip.dbus.polkit.require_auth("org.selinux.semanage")
@dbus.service.method("org.selinux", in_signature='s')
def semanage(self, buf):
- p = Popen(["/usr/sbin/semanage", "import"], stdout=PIPE, stderr=PIPE, stdin=PIPE)
+ p = Popen(["/usr/sbin/semanage", "import"], stdout=PIPE, stderr=PIPE, stdin=PIPE, universal_newlines=True)
p.stdin.write(buf)
output = p.communicate()
if p.returncode and p.returncode != 0:
@@ -38,7 +38,7 @@ class selinux_server(slip.dbus.service.Object):
@slip.dbus.polkit.require_auth("org.selinux.customized")
@dbus.service.method("org.selinux", in_signature='', out_signature='s')
def customized(self):
- p = Popen(["/usr/sbin/semanage", "export"], stdout=PIPE, stderr=PIPE)
+ p = Popen(["/usr/sbin/semanage", "export"], stdout=PIPE, stderr=PIPE, universal_newlines=True)
buf = p.stdout.read()
output = p.communicate()
if p.returncode and p.returncode != 0:
@@ -52,7 +52,7 @@ class selinux_server(slip.dbus.service.Object):
@slip.dbus.polkit.require_auth("org.selinux.semodule_list")
@dbus.service.method("org.selinux", in_signature='', out_signature='s')
def semodule_list(self):
- p = Popen(["/usr/sbin/semodule", "--list=full"], stdout=PIPE, stderr=PIPE)
+ p = Popen(["/usr/sbin/semodule", "--list=full"], stdout=PIPE, stderr=PIPE, universal_newlines=True)
buf = p.stdout.read()
output = p.communicate()
if p.returncode and p.returncode != 0: