delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/11/09/03:59:35

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=3.2 required=5.0 tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
X-Rocket-MIMEInfo: 001.001,SGkgQ3lnd2luIGNvbW11bml0eSwKCkkgYW0gY3VycmVudGx5IGZhY2luZyBhIHByb2JsZW0gd2l0aCB0aGUgY29tYmluYXRpb24gb2Ygc2V0dWlkL2V4ZWN2IG9uIGEgQ3lnd2luL1dpbmRvd3MgNy4KCkhlcmUgaXMgdGhlIGRlc2NyaXB0aW9uIG9mIG15IGNvbmZpZ3VyYXRpb24gOgoqIEN5Z3dpbiAxLjcuMTcKKiBXaW5kb3dzIDcgUHJvICg2NCBiaXRzKSAtIFNlcnZpY2UgUGFjayAxCiogQ29tcGlsYXRpb24gKG5vIG9wdGlvbikgYW5kIGV4ZWN1dGlvbiBvZiBhIHNhbXBsZSBwcm9ncmFtIHVzaW5nIGFuIGEBMAEBAQE-
Message-ID: <1352451558.7009.YahooMailNeo@web133201.mail.ir2.yahoo.com>
Date: Fri, 9 Nov 2012 08:59:18 +0000 (GMT)
From: Laurent Cocault <laurent_cocault AT yahoo DOT fr>
Reply-To: Laurent Cocault <laurent_cocault AT yahoo DOT fr>
Subject: Problem with setuid/execv on Cygwin/Windows 7
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--1982344905-679561957-1352451559=:7009
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Cygwin community,

I am currently facing a problem with the combination of setuid/execv on a C=
ygwin/Windows 7.

Here is the description of my configuration :
* Cygwin 1.7.17
* Windows 7 Pro (64 bits) - Service Pack 1
* Compilation (no option) and execution of a sample program using an admin =
account having the following privileges :
=A0 - SeCreateTokenPrivilege
=A0 - SeAssignPrimaryTokenPrivilege
=A0 - SeTcbPrivilege
=A0 - SeIncreaseQuotaPrivilege
=A0 - SeRestorePrivilege
=A0 - SeServiceLogonRight
=A0 - SeBatchLogonRight

See attachment for the source code of the program.

An exemple of the observed output is the following :

=A0 Parent / My child is 2380
=A0 setuid returns 0
=A0 Child exited with status 32512 and word 2380
=A0 exited, status=3D127

The file /tmp/test.touched has not been created.

When executing the same code on an older configuration (Cygwin 1.5.25 / Win=
dows XP Pro 2002 SP 2), the program runs correctly and produces the followi=
ng output :

=A0 Parent / My child is 1616
=A0 setuid returns 0
=A0 Child exited with status 6912 and word 1616
=A0 exited, status=3D27

The file /tmp/test.touched has effectively been created.

Thanks for your help,
Laurent COCAULT
--1982344905-679561957-1352451559=:7009
Content-Type: text/plain; name="test.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.c"

I2luY2x1ZGUgPHVuaXN0ZC5oPg0KI2luY2x1ZGUgPHN0ZGxpYi5oPg0KI2lu
Y2x1ZGUgPHN0ZGlvLmg+DQoNCmludCBtYWluKGludCBhcmdjLCBjaGFyKiog
YXJndikNCnsNCg0KICAvKioqKioqKioqKioqKi8NCiAgLyogRk9SSy9FWEVD
ICovDQogIC8qKioqKioqKioqKioqLw0KDQogIGludCBzdGF0dXMgPSAwOw0K
ICBwaWRfdCB3ID0gMDsNCiAgDQogIC8qIENyZWF0ZSB0aGUgcGlwZSAqLw0K
ICBpbnQgc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oInN0b3BwZWQgYnkgc2lnbmFsICVkXG4iLCBXU1RPUFNJRyhz
dGF0dXMpKTsNCiAgICB9DQoNCiAgfQ0KDQogIHJldHVybiBzdGF0dXM7DQoN
Cn0NCg==


--1982344905-679561957-1352451559=:7009
Content-Type: text/plain; charset=us-ascii

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
--1982344905-679561957-1352451559=:7009--

- Raw text -


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