Re: [chrony-dev] [PATCH] Privilege Separation - Version 2 - Add helper process

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


> On 19/11/2015, at 5:47 AM, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
> 
> On Mon, Nov 16, 2015 at 01:42:27PM +1300, Bryan Christianson wrote:
>> 
> 
>>> +static int
>>> +receive_with_fd(int fd, void *data, int data_size, int *fd_recvd)
> 
> Here it would be a pointer to a cmsg buffer.
> 
>>> +  /* extract transferred descriptor (if any) */
>>> +  for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
>>> +    if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS)
>>> +      memcpy(fd_recvd, CMSG_DATA(cmsg), sizeof(int));
>>> +  }
> 
> This would be in do_bindsocket().

You suggest passing struct cmsghdr * as an argument to the receive_xxx() function, but extraction of the message depends on a pointer to the msghdr which is currently local to the receive_xxx() function. If we assume there is only a single result then its not really a problem, but that doesn't feel right to me

Bryan Christianson
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/