Commit dda5415d authored by Andreas Vögele's avatar Andreas Vögele Committed by Max Kellermann

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.
parent 43471144
......@@ -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 ---------------------------
......
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment