This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reorganizing internal_getlogin()


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:
>
>Currently:
>PARENT
>seteuid   internal_getlogin (1 & 2)  spawn_guts
>CHILD
>             uinfo_init   internal_getlogin (1 & 2)
>
>Proposed:
>PARENT
>seteuid   spawn_guts   internal_getlogin (2)   
>CHILD
>             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
program.

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.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]