public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: POSIX permission mapping and NULL SIDs
Date: Fri, 24 Jun 2016 22:31:00 -0000	[thread overview]
Message-ID: <20160624215948.GD27089@calimero.vinschen.de> (raw)
In-Reply-To: <D392F074.962E%billziss@navimatics.com>

[-- Attachment #1: Type: text/plain, Size: 3282 bytes --]

On Jun 24 21:37, Bill Zissimopoulos wrote:
> On 6/24/16, 12:51 PM, "Corinna Vinschen" <cygwin-owner@cygwin.com on
> behalf of corinna-cygwin@cygwin.com> wrote:
> >Not yet.  We're coming from the other side.  We always have *some* SID.
> >pwdgrp::fetch_account_from_windows() in uinfo.cc tries to convert the SID
> >to a passwd or group entry.  If everything fails, the SID is used in this
> >passwd/group entry verbatim, but mapped to uid/gid -1.
> 
> I also noticed that there is no uid mapping for nobody. On my OSX box it
> is -2. On many other POSIX systems it appears to be the 32-bit or 16-bit
> equivalent of -2.

In fact it's an entirely arbitrary choice.  On Fedora Linux, for instance,
there is no "nogroup", but there is:

/etc/passwd:

  nobody:x:99:99:Nobody:/:/sbin/nologin
  nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin

/etc/group:

  nobody:x:99:
  nfsnobody:x:65534:

Note the 65534 here.  This is -2 *if* the remote system uses 16 bit
signed uid/gid values.  However, these days uid/gid values are at least
32 bit, so -2 kind of lost its meaning.

> For the time being I am mapping unknown SID’s to -1 as per Cygwin.

We could kick this around a bit and maybe reserve -2, 99  or 65534 for
an arbitrary "nobody" account.  But since we're on Windows the SID value
is important, not so much the uid/gid values.

> >If you want some specific mapping we can arrange that, but it must not
> >be the NULL SID.  If you know you're communicating with a Cygwin process,
> >what about using an arbitrary, unused SID like S-1-0-42?
> 
> I am inclined to try S-1-5-7 (Anonymous). But I do not know if that is a
> bad choice for some reason or other.

I thought about Anonymous myself when I wrote my reply to your OP.  I
refrained from mentioning it because it might have some unexpected side
effect we're not aware about.

> The main reason that I am weary of using an unused SID is that Microsoft
> may decide to assign some special powers to it in a future release (e.g.
> GodMode SID). But I agree that this is rather unlikely in the S-1-0-X
> namespace.

I think it's very unlikely.  We could chose any RID value we like and
the chance for collision is nil.  When I created the new implementation
for POSIX ACLs, I toyed around with this already and used a special
Cygwin SID within the NULL SID AUTHORITY.  I'm not entirely sure why I
changed this to the NULL SID deny ACE.  I think I disliked the fact that
almost every Cygwin ACL would contain a mysterious "unknown SID".

On second thought, maybe that would have avoided the UoW problem?!?
Well, how should I have known about UoW when I implemanted this, right?

> >How do you differ nobody from nogroup if you use the same SID for both,
> >btw.?
> 
> I use the same SID for both nobody and nogroup. This should work as long
> as you use the permission mapping from the [PERMS] document.

Keep in mind that Interix only supported standard POSIX permission bits.
Cygwin strives to support POSIX ACLs per POSIX 1003.1e draft 17.  That's
a bit more extensive.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-06-24 22:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24 19:02 Bill Zissimopoulos
2016-06-24 21:37 ` Corinna Vinschen
2016-06-24 22:00   ` Corinna Vinschen
2016-06-24 22:06   ` Bill Zissimopoulos
2016-06-24 22:31     ` Corinna Vinschen [this message]
2016-06-24 22:36       ` Erik Soderquist
2016-06-24 23:03         ` Bill Zissimopoulos
2016-06-24 23:51           ` Bill Zissimopoulos
2016-06-27 13:20             ` Corinna Vinschen
2016-06-24 22:53       ` Bill Zissimopoulos
2016-06-25 17:10       ` Brian Inglis
2016-06-27 10:26       ` Bill Zissimopoulos
2016-06-27 10:29         ` Andrey Repin
2016-06-27 12:06           ` Corinna Vinschen
2016-06-27 20:31             ` Bill Zissimopoulos
2016-06-28 11:08               ` Corinna Vinschen
2016-06-28 19:17                 ` Bill Zissimopoulos
2016-06-28 19:17                   ` John Ruckstuhl
2016-06-29  8:43                   ` Corinna Vinschen
2016-06-29 15:14                     ` Corinna Vinschen
2016-06-29 16:06                       ` Corinna Vinschen
2016-06-30  9:26                     ` Bill Zissimopoulos
2016-06-30 14:15                       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160624215948.GD27089@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).