Fix Fenrir Unix socket ownership reporting

This commit is contained in:
Storm Dragon
2026-05-07 23:43:11 -04:00
parent 6d4f55ffe5
commit 37e281a1f7
3 changed files with 142 additions and 6 deletions
@@ -115,14 +115,22 @@ class driver(remoteDriver):
def _socket_file_matches_socket(self, fenrir_sock, socket_file):
try:
socket_stat = os.stat(socket_file)
if os.stat(socket_file).st_uid != os.getuid():
return False
fd_stat = os.fstat(fenrir_sock.fileno())
socket_inode = str(fd_stat.st_ino)
with open("/proc/net/unix", "r", encoding="utf-8") as proc_file:
for line in proc_file:
line_parts = line.split()
if (
len(line_parts) >= 8
and line_parts[6] == socket_inode
and line_parts[7] == socket_file
):
return True
except OSError:
return False
return (
socket_stat.st_dev == fd_stat.st_dev
and socket_stat.st_ino == fd_stat.st_ino
)
return False
def _cleanup(self):
for fenrir_sock in self.fenrirSocks: