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 Wed, Jun 12, 2002 at 08:57:11PM -0400, Pierre A. Humblet wrote:
>/* I just found the mail of Chris from last nite (spend a day
>   on the road) but as all of the following was ready and tested, 
>   I am sending it anyway. Pick what you want. */
>
>As explained previously, the main purpose of the patches is to increase
>performances of servers that fork() and setuid() but do not exec().  In
>particular, the number of accesses to logonservers (either directly, or
>through LookupAccountSid ) is greatly reduced.  The performance of
>programs that setuid() and exec() is improved as well, e.g.  by not
>reading the passwd file in the child.

Yes, and as I explained previously, I didn't really like what you did to
spawn_guts or your additions to environ.cc.  I tried to clear the way
for you not to have to worry about that.  You shouldn't have to worry
about setting most environment variables either.  I see I missed
USERDOMAIN, though.

I like the concept of speeding up things, of course.  However, I don't
understand how this can be right:

>--- dcrt0.cc.orig      2002-06-11 00:05:40.000000000 -0400
>+++ dcrt0.cc   2002-06-12 19:53:06.000000000 -0400
>@@ -608,7 +608,6 @@
>                                 DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
>             h = NULL;
>           set_myself (mypid, h);
>-          myself->uid = spawn_info->moreinfo->uid;
>           __argc = spawn_info->moreinfo->argc;
>           __argv = spawn_info->moreinfo->argv;
>           envp = spawn_info->moreinfo->envp;

If you don't set the child's uid here then where is it going to be set?

>In addition the code (mostly uinfo.cc and seteuid) is greatly 
>streamlined (IMHO). The changes are pretty self explanatory,
>except perhaps the following.
>dll_crt0_1() passes a flag to uinfo_init() to indicate if the
>parent is a Cygwin process. The previous method (ppid != 1) 
>is not reliable and causes the following bug: when a cygwin 
>process with ppid == 1 exec()'s after setgid(), the new gid 
>gets lost.

The correct way to find out if the parent is a cygwin process is to
check for ppid_handle.  If it is zero, then the parent was not a cygwin
process.  I've already made this change to uinfo.cc.

>Another minor bug is fixed: LOGONSERVER is always set correctly.

This isn't obvious from your patch.  I'll have to take your word for it.

cgf


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