aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--NEWS1
-rw-r--r--configure.ac1
-rw-r--r--src/listen.c8
3 files changed, 9 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 4a4c4405f..6e1c41076 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ ver 0.15.11 (2010/??/??)
- mp4ff: support tags "albumartist", "band"
- mikmod: fix memory leak
* playlist: emit IDLE_OPTIONS when resetting single mode
+* listen: make get_remote_uid() work on BSD
ver 0.15.10 (2010/05/30)
diff --git a/configure.ac b/configure.ac
index 9249ada70..1043b2f65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,6 +177,7 @@ AC_ARG_ENABLE(un,
if test x$enable_un = xyes; then
AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
STRUCT_UCRED
+ AC_CHECK_FUNCS(getpeereid)
fi
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
}