delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/13/07:35:55

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Mon, 13 May 2002 13:32:22 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cp.ese bug report -- possible fix?
Message-ID: <20020513133222.D6264@cygbert.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <3CD989CB DOT 4060806 AT ece DOT gatech DOT edu> <3CD98CF0 DOT 6050007 AT ece DOT gatech DOT edu> <3CDDABBE DOT 3020502 AT ece DOT gatech DOT edu> <20020512011000 DOT GB29021 AT redhat DOT com> <3CDEA8B5 DOT 1010507 AT ece DOT gatech DOT edu>
Mime-Version: 1.0
In-Reply-To: <3CDEA8B5.1010507@ece.gatech.edu>
User-Agent: Mutt/1.3.22.1i

On Sun, May 12, 2002 at 01:39:01PM -0400, Charles Wilson wrote:
> Christopher Faylor wrote:
> 
> >On Sat, May 11, 2002 at 07:39:42PM -0400, Charles Wilson wrote:
> >
> >>Well, I've attached a patch for this bug.  However, it uncovered another 
> >>problem with 'cp -p src dest', when src is not owned by the current user.
> >>
> >
> >If the system UID is 18 then maybe cygwin should be translating that to 0.
> >Especially if 0 has no meaning to windows.
> 
> Perhaps.  I just followed the example set by Corinna's changes to 
> inetutils.  It might make sense to have cygwin1.dll translate UID=18 to 
> UID=0.  This would subsequently require:

It doesn't make sense.  The problem in NT is that you have a user
called SYSTEM with RID 18 which you (under normal circumstances) can't
login to and which has devine permissions.  And another user called
Administrator with RID 500 which is sort of a natural representation
of a superuser which has only nearly devine permissions.  OTOH,
nobody holds you back to create any number of additional users with
the same permissions which is the group Administrators, RID 544,
by default.  Also there's no problem in creating another group with
any RID and with the same permissions.  Or changing the local or
global security policy to allow or disallow single user rights for
any user, including Administrator or one of it's clones.

The only reason to use the uid 18 in, say, cron is, that I made
the decision to use it and to document that cron is designed to
run under SYSTEM account in Cygwin.

I don't think that it makes at all sense to use somethink like

  myuid == SOME_UID

in a cp(1) implementation (and only barly in other applications).

I'd suggest to remove this part from the definition of DO_CHOWN
completely.  Otherwise, if you'd like to do it correctly in a
WinNT sort of sense, you'd have to check if the user is an
ADMIN user, roughly like that:

  BOOL
  is_admin (WCHAR username)
  {
    PUSER_INFO_2 ui;
    BOOL ret;

    NetUserGetInfo(NULL, username, 2, &ui);
    ret = (ui->usri2_priv == USER_PRIV_ADMIN);
    NetApiBufferFree (ui);
    return ret;
  }

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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