From fa2b845b55b363eb698383d24699f6ad89591e35 Mon Sep 17 00:00:00 2001 From: Jarrod Johnon Date: Tue, 13 Jan 2015 11:55:33 -0500 Subject: [PATCH] Fix sign of SO_PEERCRED SO_PEERCRED uses ucred, where pid is signed and the other two are not. Accurately handle large uid/gid --- confluent_server/confluent/sockapi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/sockapi.py b/confluent_server/confluent/sockapi.py index da857de3..1427f0c4 100644 --- a/confluent_server/confluent/sockapi.py +++ b/confluent_server/confluent/sockapi.py @@ -248,8 +248,8 @@ def _unixdomainhandler(): while True: cnn, addr = unixsocket.accept() creds = cnn.getsockopt(socket.SOL_SOCKET, SO_PEERCRED, - struct.calcsize('3i')) - pid, uid, gid = struct.unpack('3i', creds) + struct.calcsize('iII')) + pid, uid, gid = struct.unpack('iII', creds) skipauth = False if uid in (os.getuid(), 0): #this is where we happily accept the person