Mail Archives: cygwin-developers/2000/07/21/13:52:10
This is a multi-part message in MIME format.
--------------663D76D886A14E94A9CCB025
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Kazuhiro Fujieda wrote:
>
> >>> On Wed, 19 Jul 2000 15:04:50 -0400
> >>> Chris Faylor <cgf AT cygnus DOT com> said:
>
> > >login-1.3 is still using `sexec..()' of course.
> >
> > I'm not sure why it is a problem even for when child == myself,
> > actually.
>
> My problem is triggered by the following code.
> [...]
> myself->psid has been modified to NULL at the line 548 of
> spawn.cc, so getlogin is invoked at the line 220. But it can't
> return the user name because myself->username has been modified
> to "" at the line 547 of spawn.cc.
Thanks for the hint.
Would you mind to check if the attached patch solves your problem?
Corinna
--------------663D76D886A14E94A9CCB025
Content-Type: text/plain; charset=us-ascii;
name="spawn.p0"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="spawn.p0"
Index: spawn.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/spawn.cc,v
retrieving revision 1.18
diff -u -p -r1.18 spawn.cc
--- spawn.cc 2000/07/19 20:27:27 1.18
+++ spawn.cc 2000/07/21 17:48:12
@@ -536,6 +536,12 @@ skip_arg_parsing:
else
system_printf ("GetTokenInformation: %E");
+ /* Retrieve security attributes before setting psid to NULL
+ since it's value is needed by `sec_user'. */
+ PSECURITY_ATTRIBUTES sec_attribs = allow_ntsec && sid
+ ? sec_user (sa_buf, sid)
+ : &sec_all_nih;
+
/* Remove impersonation */
uid_t uid = geteuid();
if (myself->impersonated && myself->token != INVALID_HANDLE_VALUE)
@@ -553,12 +559,8 @@ skip_arg_parsing:
rc = CreateProcessAsUser (hToken,
real_path, /* image name - with full path */
one_line.buf, /* what was passed to exec */
- /* process security attrs */
- allow_ntsec && sid ? sec_user (sa_buf, sid)
- : &sec_all_nih,
- /* thread security attrs */
- allow_ntsec && sid ? sec_user (sa_buf, sid)
- : &sec_all_nih,
+ sec_attribs, /* process security attrs */
+ sec_attribs, /* thread security attrs */
TRUE, /* inherit handles from parent */
flags,
envblock,/* environment */
--------------663D76D886A14E94A9CCB025--
- Raw text -