Reorganizing internal_getlogin()

Pierre A. Humblet Pierre.Humblet@ieee.org
Mon Jun 10 20:59:00 GMT 2002


At 10:28 PM 6/10/2002 -0400, Christopher Faylor wrote:
>Yes, this was one of the things that I've wanted to do for a while.
>
>It's checked in now, btw, along with your "Define sec_attribs and call
>sec_user_nih() only once" change in spawn_guts' change.

Thanks

>But, we know (in some cases, at least) if it's going to be a cygwin
>process or not.  There may be no reason to go to the effort of filling
>out the environment if we know we're not starting a normal windows
>program.

That's fine with me too. I was going for minimum impact changes.

>However, I'm not convinced that we shouldn't just set the environment
>correctly in setuid, rather than doing it in spawn_guts.  I think the normal
>use of setuid is something like:
>
>if (!fork ())
>  {
>    setuid (...);
>    exec (...);
>  }

Yes, that's typical of sshd, telnetd, etc.. and my changes
would improve that case (e.g. avoid duplications and don't 
read the passwd file in the exec'ed program. That's not 
yet apparent in what I have sent, testing it now).

But there are also many programs (e.g. mail & pop servers) 
that look like

if (!fork ())
  {
    setuid (...);
    do some work without exec
    exit(0);
  }
That's mainly what I am trying to optimize.
 
Pierre



More information about the Cygwin-patches mailing list