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 0f180bc11c8d59c11bb07caaaa22c81500ef35c4..b47ac3dbb6aeb493b56f86a33aed9ff1cbf72669 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)