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: {Patch]: Giving access to pinfo after seteuid and exec


Corinna Vinschen wrote:
> 
> On Thu, Sep 25, 2003 at 09:47:48PM -0400, Pierre A. Humblet wrote:
> > This patch sets the _pinfo acl in order to allow access after
> > seteuid and exec.
> >
> > While looking at spawn.cc I also noticed oddities in pinfo related
> > error handling, and reworked them. I also restored impersonation in
> > case of CreateProcessAsUser failure.
> 
> Looks ok except for:
> 
> > @@ -42,9 +43,9 @@ pinfo_fixup_after_fork ()
> >  {
> >    if (hexec_proc)
> >      CloseHandle (hexec_proc);
> > -
> > +  /* Keeps the cygpid from being reused. No rights required */
> >    if (!DuplicateHandle (hMainProc, hMainProc, hMainProc, &hexec_proc, 0,
> > -                     TRUE, DUPLICATE_SAME_ACCESS))
> > +                     TRUE, 0))
> >      {
> >        system_printf ("couldn't save current process handle %p, %E", hMainProc);
> >        hexec_proc = NULL;
> 
> Somehow I'm missing a description why that's necessary and the
> implications.
> 
I am getting paranoid. Most often we duplicate DUPLICATE_SAME_ACCESS
without thinking about what access is really needed. It would be a good
discipline to ask ourselves what is needed and give just that. Here nothing
is needed at all. 
Also, if you use sysinternals you can see the access mask. Setting it
properly creates differentiating features that help distinguish between
all the handles.


Pierre


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