From 45ab24ce12137ea7601e86dfc8cc2714f147a84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 27 Feb 2017 20:15:24 +0100 Subject: [PATCH] Fix local socket communication Don't try to send 'None' argument. Close writing end after sending full request. QubesOS/qubes-issues#853 --- qubesmgmt/app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qubesmgmt/app.py b/qubesmgmt/app.py index 588f8c2..c856dd2 100644 --- a/qubesmgmt/app.py +++ b/qubesmgmt/app.py @@ -109,12 +109,15 @@ class QubesLocal(QubesBase): # src, method, dest, arg for call_arg in ('dom0', method, dest, arg): - client_socket.sendall(call_arg.encode('ascii')) + if call_arg is not None: + client_socket.sendall(call_arg.encode('ascii')) client_socket.sendall(b'\0') if payload is not None: client_socket.sendall(payload) - return_data = b''.join(iter(client_socket.recv(BUF_SIZE), b'')) + client_socket.shutdown(socket.SHUT_WR) + + return_data = b''.join(iter(lambda: client_socket.recv(BUF_SIZE), b'')) return self._parse_qubesd_response(return_data)