delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/07/21/13:52:10

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Message-ID: <39788CEA.B7DA0A47@cygnus.com>
Date: Fri, 21 Jul 2000 19:48:26 +0200
From: Corinna Vinschen <vinschen AT cygnus DOT com>
Reply-To: cygdev <cygwin-developers AT sources DOT redhat DOT com>
X-Mailer: Mozilla 4.73 [en] (X11; I; Linux 2.2.14-SMP i686)
X-Accept-Language: de, en
MIME-Version: 1.0
To: Kazuhiro Fujieda <fujieda AT jaist DOT ac DOT jp>
CC: cygwin-developers AT sources DOT redhat DOT com
Subject: Re: login-1.3 can't work on the recent snapshots.
References: <s1su2e4mz1d DOT fsf AT jaist DOT ac DOT jp> <s1s7lai5b7i DOT fsf AT jaist DOT ac DOT jp>
<20000719141458 DOT D17938 AT cygnus DOT com> <3975FB88 DOT 5A96123E AT cygnus DOT com>
<20000719150450 DOT C18820 AT cygnus DOT com> <s1s66q15mae DOT fsf AT jaist DOT ac DOT jp>

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019