chiark / gitweb /
fishdescriptor: wip, before reconsider approach
[chiark-utils.git] / fishdescriptor / py / fishdescriptor / fish.py
index a363c5e5318518b2eaeefdeeecbd8396eab2b82f..1418aa19d71c8c628d591dc1416cd0035f910178 100644 (file)
@@ -1,9 +1,25 @@
 # python 3 only
 
 import socket
+import subprocess
+
+def _geteuid(pid):
+    def _shuffle_fd3():
+        dup(1,3)
+        dup(2,1)
+    sp = subprocess.Popen(preexec_fn = _suffle_fd3,
+          stdin = subprocess.DEVNULL, stdout = subprocess.PIPE,
+          close_fds = False,
+          args = ['gdb', '-p', pid, '-batch', '-ex'
+                  'python import os; os.fdopen(30,"w").write("%d\n" % '
+                  +'gdb.parse_and_eval("(uid_t)geteuid()"))'])
+    (output, dummy) = sp.communicate()
+    
+2009
 
 def fish(pid, fds):
     # -> list of fds in our process
+    sockname = '/run/user/' + 
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
 def deliver(pid, fds, path):