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.
This commit is contained in:
parent
0a0c78674f
commit
34415bf0b6
1
NEWS
1
NEWS
@ -5,6 +5,7 @@ ver 0.15.11 (2010/??/??)
|
|||||||
- mp4ff: support tags "albumartist", "band"
|
- mp4ff: support tags "albumartist", "band"
|
||||||
- mikmod: fix memory leak
|
- mikmod: fix memory leak
|
||||||
* playlist: emit IDLE_OPTIONS when resetting single mode
|
* playlist: emit IDLE_OPTIONS when resetting single mode
|
||||||
|
* listen: make get_remote_uid() work on BSD
|
||||||
|
|
||||||
|
|
||||||
ver 0.15.10 (2010/05/30)
|
ver 0.15.10 (2010/05/30)
|
||||||
|
@ -177,6 +177,7 @@ AC_ARG_ENABLE(un,
|
|||||||
if test x$enable_un = xyes; then
|
if test x$enable_un = xyes; then
|
||||||
AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
|
AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
|
||||||
STRUCT_UCRED
|
STRUCT_UCRED
|
||||||
|
AC_CHECK_FUNCS(getpeereid)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -407,7 +407,13 @@ static int get_remote_uid(int fd)
|
|||||||
|
|
||||||
return cred.uid;
|
return cred.uid;
|
||||||
#else
|
#else
|
||||||
(void)fd;
|
#ifdef HAVE_GETPEEREID
|
||||||
|
uid_t euid;
|
||||||
|
gid_t egid;
|
||||||
|
|
||||||
|
if (getpeereid(fd, &euid, &egid) == 0)
|
||||||
|
return euid;
|
||||||
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user