This is the mail archive of the
cygwin-developers@sources.redhat.com
mailing list for the Cygwin project.
Re: login-1.3 can't work on the recent snapshots.
Kazuhiro Fujieda wrote:
>
> >>> On Wed, 19 Jul 2000 15:04:50 -0400
> >>> Chris Faylor <cgf@cygnus.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
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 */