mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 00:59:45 -05:00
Fix prev commit - require passed descriptor to be a pipe (FIFO) and
require it to only be accessible by its owner, otherwise ignore it.
This commit is contained in:
parent
09679eb715
commit
1363d4bf1a
1 changed files with 5 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue