Skip to content
Snippets Groups Projects
Commit 1363d4bf authored by Howard Chu's avatar Howard Chu
Browse files

Fix prev commit - require passed descriptor to be a pipe (FIFO) and

require it to only be accessible by its owner, otherwise ignore it.
parent 09679eb7
No related branches found
No related tags found
No related merge requests found
......@@ -62,9 +62,13 @@ int getpeereid( int s, uid_t *euid, gid_t *egid )
msg.msg_accrightslen = sizeof(fd);
if( recvmsg( s, &msg, 0) >= 0 && msg.msg_accrightslen == sizeof(int) )
{
/* We must receive a valid descriptor, it must be a pipe,
* and it must only be accessible by its owner.
*/
dummy = fstat( fd, &st );
close(fd[0]);
if( dummy == 0 )
if( dummy == 0 && S_ISFIFO(st.st_mode) &&
((st.st_mode & (S_IRWXG|S_IRWXO)) == 0))
{
*euid = st.st_uid;
*egid = st.st_gid;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment