This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cp.ese bug report -- possible fix?


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@cygwin.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]