| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=RY7wp57LUoT44Ae6WOv1m62oTKXS6IuU/aAvFBX59jU7F2b4wRvus | |
| oCIjsT5GEImOnkWlUKVKROdrayWN+tdvOiHocjOsZWM6ghimOmEo0L9X21v0ShXi | |
| pomgs8hUzzyxPtbpoIA4d4eAkQViFD6WF4RkyH2DgvHJfHXHbm++Bo= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; s=default; | |
| bh=q7NVTJlw7rJWq3PnyV0PNMMNdPM=; b=fuW2MJGp6m6pRBoEkY9o94twOHv+ | |
| raddRm43hdR2304bOyUvb6DhyzsEFrMEhFQKaoRNeDzAxA1clyZ80qro2rRN7SDK | |
| 9bGOEc7Exzqc8X6wWZ7bWi/fA+GoCRjGaTEm9UQ43SV7kepsLIlym0FTsoyBtYY4 | |
| WQPSiyqLrA/Ix6A= | |
| 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 |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 |
| X-HELO: | calimero.vinschen.de |
| Date: | Thu, 24 Jul 2014 15:52:22 +0200 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: The eternal uid issue |
| Message-ID: | <20140724135222.GD12212@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <53CF6CEC DOT 6D68E485 AT boland DOT nl> <20140723091409 DOT GH27005 AT calimero DOT vinschen DOT de> <53CF9E0F DOT F596FC60 AT boland DOT nl> <20140723152357 DOT GA24446 AT calimero DOT vinschen DOT de> <53D0AD3A DOT 1FDF0B3F AT boland DOT nl> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <53D0AD3A.1FDF0B3F@boland.nl> |
| User-Agent: | Mutt/1.5.23 (2014-03-12) |
--z4+8/lEcDcG5Ke9S
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Jul 24 08:52, D. Boland wrote:
> In your previous mail, you propose the following function to check for 'r=
oot'
> privileges, which an upstream maintainer could put in his code:
>=20
> int
> is_admin (uid_t uid)
> {
> #ifdef __CYGWIN__
> return [getgrouplist(uid, ...) contains group 544];
> #else [other platform]
> return [different test];
> #else
> return uid =3D=3D 0;
> #endif
> }
>=20
> But this only introduces a new function which she has to put into multipl=
e locations
> of the original code. So again, why not just modify the 'getuid' function=
in
> cygwin1.dll to return '0' if the current user is actually SYSTEM or one o=
f the
> administrators?
>=20
> Then you have rock-solid emulation. I would not have to modify a single l=
ine of
> code.
You're kidding, right? What about code like this:
struct stat st;
stat("foo", &st);
if (st.st_uid !=3D getuid ())
/*error*/
else
/*do something*/
I'm not saying that this is overly elegant coding, but just as you
expect that getuid() returns 0 for any admin, other applications will
expect that getuid() reflects reality.
Why don't you just override getuid in your application to serve the
applications needs?
#ifdef __CYGWIN__
#define getuid() CYG_getuid()
#endif
[...]
#ifdef __CYGWIN__
#undef getuid
uid_t
CYG_getuid ()
{
/* Return 0 for any admin user. */
if (/*getgroups() contains group 544*/)
return 0;
return getuid ();
}
But be careful. Just because there are multiple users with admin
permissions, that doesn't mean they all want their mail in the same
mailbox for user 0...
Corinna
--=20
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
--z4+8/lEcDcG5Ke9S
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJT0Q+WAAoJEPU2Bp2uRE+gVgsP/3Y5oszxoinHlVPYHSRmlojX
hlGDygk7bUB3czGtH7+TGd71h2qMhK75aycehPMXq4URGh4j2/bh7D6ja87l3A+b
EKEzSRJ2y0tz+FGccwfbQQTrpJKpwgmF8SBj4aIVKM+hVodKb7hviov1IsWVAYde
ytYJdihLwdrp5zIEaX5LyKa8FoiIyNuuSeZjyNnc21Ak5WoaQ+0s19PHvDhqAebL
MlAQA4qWVhZDHpYDt3lwgGrArQ/bFBB1mK6kq6YPJis7w66Gs+/guIpJYyYTD4iH
d4LgJ2pL+EwqsgZLlYheHf60jJx3TsgcBISYIs7bCsGBSmnY9Sih+How1Y8SqNtF
T++PuR+pFeoOQLk+5TNYuhvvDMccpulRwEZZjqIGsJwm8Ios2eSZD7jOHvCeTYIi
49i70ksLegQL/U+ji2AKBSQv3dBoYICeJN6ntzAh9XxtMWw71HLwbW2iqM7z8Dnn
6k+LXv2mlbtUqNI4hljewHFlYww15l1HlO87LKVhuebdKdeBdhDVB77ydMhyig+1
UAUsszrLZ+CqOo8tXaBT8jS1GZaGU+HDBbbUcnhFktq/tAQh7TFfnacWrrEhweAd
VbsYkrIqOPf2KSKYWeOyQQy93H+YS9AQx/Yxr5btSvocIIQXUvPb7zMDVF6ydfVE
rQOoAzY1Q2KhOL5N/BlK
=Chzj
-----END PGP SIGNATURE-----
--z4+8/lEcDcG5Ke9S--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |