aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--src/listen.c8
2 files changed, 8 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 2a63e269a..c1d3bcd53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -445,6 +445,7 @@ esac
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
dnl --------------------------- Post Protocol Tests ---------------------------
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
}