2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-17 21:23:18 +00:00

Fix sign of SO_PEERCRED

SO_PEERCRED uses ucred, where pid is signed and the other two are not.
Accurately handle large uid/gid
This commit is contained in:
Jarrod Johnon 2015-01-13 11:55:33 -05:00
parent 09c5b90c57
commit fa2b845b55

View File

@ -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