Subject: Re: calling setlogin before setsid
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 02/13/2003 16:06:15
On Thu, Feb 13, 2003 at 09:34:34AM -0500, Andrew Brown wrote:
> >The following bits of code call setlogin() before setsid().
> >Since setlogin affects all processes in the session, this can
> >change the logname of a different child.
> 
> and of the parent.

Yes - the parent catches it as well:

# ps -opid,logname,ppid,uid,command -ax | grep ftp
1623 userfifteenchar 1576 1016 ftpd: snowdrop.l8s.co.uk: usersixteenchars: PWD 
1624 userfifteenchar 1576 1015 ftpd: snowdrop.l8s.co.uk: userfifteenchar: FEAT
# ps -opid,logname,ppid,uid,command -p 1576       
 PID LOGIN           PPID UID COMMAND
1576 userfifteenchar    1   0 /usr/sbin/inetd -l

> maybe inetd should setsid() after forking?

There is probably a child that alredy calls setsid(), I can't remember
if netbsd lets session leaders call setsid, SVR4 doesn't.
> 
> >There may be a problem in gnu/dist/sendmail/sendmail/conf.c
> 
> whereabouts?

Where it calls setlogin()...

	David

-- 
David Laight: david@l8s.co.uk