Make get_remote_uid() work on BSD
I've attached a patch that will make file URIs work on operating systems that provide the getpeereid() function call to check the user ID of the peer connected to a UNIX domain socket.
This commit is contained in:
committed by
Max Kellermann
parent
0a0c78674f
commit
34415bf0b6
@@ -407,7 +407,13 @@ static int get_remote_uid(int fd)
|
||||
|
||||
return cred.uid;
|
||||
#else
|
||||
(void)fd;
|
||||
#ifdef HAVE_GETPEEREID
|
||||
uid_t euid;
|
||||
gid_t egid;
|
||||
|
||||
if (getpeereid(fd, &euid, &egid) == 0)
|
||||
return euid;
|
||||
#endif
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user