aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Vögele <andreas@kurzegasse.de>2010-06-30 21:42:01 +0200
committerMax Kellermann <max@duempel.org>2010-06-30 21:42:01 +0200
commit34415bf0b60738b22099023af5cd2cd1d202bf80 (patch)
tree6861c67dcf09d9cd8bd15a68492d9b5c38f0bf7a /src
parent0a0c78674f8ca6ffce08feabd7c292133fd2d86e (diff)
downloadmpd-34415bf0b60738b22099023af5cd2cd1d202bf80.tar.gz
mpd-34415bf0b60738b22099023af5cd2cd1d202bf80.tar.xz
mpd-34415bf0b60738b22099023af5cd2cd1d202bf80.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.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/listen.c b/src/listen.c
index 98108d9da..d6cade855 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -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
}