chiark / gitweb /
fishdescriptor: Work if child is not running as root, but we are
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 7 Jun 2018 16:33:34 +0000 (17:33 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 7 Jun 2018 16:35:39 +0000 (17:35 +0100)
We make a socket, normally in /var/run/user for the victim process,
which is therefore accessible only to the victim uid (and to root).
If we are running as root, the socket will typically not be writeable
by the user, and this will fail.  We need to chmod it.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
fishdescriptor/py/fishdescriptor/fish.py

index 0f180bc..b47ac3d 100644 (file)
@@ -154,6 +154,7 @@ class Donor():
 
             s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
             s.bind(our_sockname)
+            os.chmod(our_sockname, 666)
             s.listen(1)
 
             ancil_len = d.donate(our_sockname, fds)