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: Wed, 29 Jun 2016 16:06:00 -0000	[thread overview]
Message-ID: <20160629151322.GN981@calimero.vinschen.de> (raw)
In-Reply-To: <20160629134515.GL981@calimero.vinschen.de>


[-- Attachment #1.1: Type: text/plain, Size: 904 bytes --]

On Jun 29 15:45, Corinna Vinschen wrote:
> Hi Bill,
> 
> On Jun 29 10:21, Corinna Vinschen wrote:
> > On Jun 28 18:06, Bill Zissimopoulos wrote:
> > > In any case I will use your mapping of S-1-0-65534 <-> 65534.
> > 
> > Thanks.  Do you want to add handling for this mapping to
> > pwdgrp::fetch_account_from_windows yourself or shall I do it?  I could
> > come up with a patch in the next couple of days.  I will prepare a
> > developer's snapshot then, so you can immediately test if it works as
> > desired.
> 
> How do we avoid name collisions?  I can easily see admins creating an
> AD account called "nobody".
> 
> Shall we fake a "WinFSP" domain such that the name is "WinFSP+nobody"?

Preliminary patch attached.


Corinna

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

[-- Attachment #1.2: 0001-Handle-WinFSP-nobody-account.patch --]
[-- Type: text/plain, Size: 2102 bytes --]

From a0bdba1cc4b8515e933e1c1caf59fcc310c48613 Mon Sep 17 00:00:00 2001
From: Corinna Vinschen <corinna@vinschen.de>
Date: Wed, 29 Jun 2016 17:12:38 +0200
Subject: [PATCH] Handle WinFSP nobody account

Per discussion started at
https://cygwin.com/ml/cygwin/2016-06/msg00347.html

S-1-0-65534 == WinFSP\nobody == WinFSP+nobody == uid/gid 65534
---
 winsup/cygwin/uinfo.cc | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 247131d..af1a4e5 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -1894,6 +1894,14 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
 	}
       if (!ret)
 	{
+	  if (!strcmp (arg.name, "WinFSP+nobody"))
+	    {
+	      /* Special case "nobody" for reproducible construction of a
+		 nobody SID for WinFSP.  We use the value 65534 which is
+		 -2 with 16 bit uid/gids. */
+	      csid.create (0, 1, 0xfffe);
+	      break;
+	    }
 	  debug_printf ("LookupAccountNameW (%W), %E", name);
 	  return NULL;
 	}
@@ -2004,6 +2012,15 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
 	  sid = logon_sid;
 	  break;
 	}
+      else if (arg.id == 0xfffe)
+	{
+	  /* Special case "nobody" for reproducible construction of a
+	     nobody SID for WinFSP.  We use the value 65534 which is
+	     -2 with 16 bit uid/gids. */
+	  csid.create (0, 1, 0xfffe);
+	  sid = csid;
+	  break;
+	}
       else if (arg.id < 0x10000)
 	{
 	  /* Nothing. */
@@ -2428,6 +2445,14 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
 	  return NULL;
 	}
     } 
+  else if (sid_id_auth (sid) == 0 && sid_sub_auth (sid, 0) == 0xfffe)
+    {
+      uid = gid = 0xfffe;
+      wcpcpy (dom, L"WinFSP");
+      wcpcpy (name = namebuf, L"nobody");
+      fully_qualified_name = true;
+      acc_type = SidTypeUnknown;
+    }
   else if (sid_id_auth (sid) == 5 /* SECURITY_NT_AUTHORITY */
 	   && sid_sub_auth (sid, 0) == SECURITY_LOGON_IDS_RID)
     {
-- 
2.5.5


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

  reply	other threads:[~2016-06-29 15:13 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
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 [this message]
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=20160629151322.GN981@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).