diff options
author | Andreas Vögele <andreas@kurzegasse.de> | 2010-06-19 11:14:35 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-06-19 13:47:10 +0200 |
commit | dda5415def1ce78febb75199e5986aa051b00e96 (patch) | |
tree | dc95507e268fe76c2ebf386bde23ed89e4ee220b /src | |
parent | 4347114455a605f5d1f7da629e56d189a97e5967 (diff) | |
download | mpd-dda5415def1ce78febb75199e5986aa051b00e96.tar.gz mpd-dda5415def1ce78febb75199e5986aa051b00e96.tar.xz mpd-dda5415def1ce78febb75199e5986aa051b00e96.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/listen.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/listen.c b/src/listen.c index 9fb60edcb..3028b9476 100644 --- a/src/listen.c +++ b/src/listen.c @@ -416,7 +416,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 } |