Reorganizing internal_getlogin()

Christopher Faylor
Mon Jun 10 19:27:00 GMT 2002

On Mon, Jun 10, 2002 at 11:30:51AM -0400, Pierre A. Humblet wrote:
>Christopher Faylor wrote:
>> Ok.  I'm in favor of getting rid of sexec in 1.3.11, then.
>> I'll do that sometime today.
>Then you can also junk the first argument (token) in _spawnve()
>and spawn_guts() (FYI).

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.

>By the way, here is a diagram of what I proposed:
>seteuid   internal_getlogin (1 & 2)  spawn_guts
>             uinfo_init   internal_getlogin (1 & 2)
>seteuid   spawn_guts   internal_getlogin (2)   
>             uinfo_init   internal_getlogin (1)
>Another reason that 2) can't be pushed to the child 
>is that it might be a non Cygwin process, expecting
>a correct Windows environment.

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

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 (...);

So, setting the environment variables in setuid is no big deal.  The
only time it really could be a potential performance issue is if there
is a lot of switching back and forth between uids but I don't think that
is the norm.


More information about the Cygwin-patches mailing list