public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin dll: UID and GID information not shown from remote drive
@ 2011-12-13 14:24 Jari Aalto
  2011-12-13 15:12 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Jari Aalto @ 2011-12-13 14:24 UTC (permalink / raw)
  To: cygwin; +Cc: Corinna Vinschen


** To CC Emacs BTS, use 10257(at)debbugs.gnu.org

My full original bug report was sent initially to Emacs, because the editor
started considering remotes file as read-only and requiring confirmation
after every save. See:

    http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10257

It appears that Cygwin doesn't show UID and GID on Network drives (Win 7
x64), that are connected with windows "Map Network Drive" to a
Debian/Samba(2.3.5.11):

    $ ls -la /cygdrive/z/tmp/test-epackage.el
    -rwxr--r-- 1 ???????? ???????? 437 Dec  9 20:02 /cygdrive/z/tmp/test-epackage.el

Ken Brown <kbrown <at> cornell.edu>, the Cygwin Emacs maintainer, answered
in original bug report suggesting to contact Cygwin mailing list to see if
anything could be done at Cygwin DLL side:

    | emacs uses file-writable-p, which calls check_writable() (defined in
    | fileio.c), which calls euidaccess().  That explains why emacs thinks
    | the file is not writable when Cygwin can't determine the UID.  It
    | would certainly be possible to make check_writable() use a different
    | method of determining writability on Cygwin, as it already does on
    | MSDOS.  But I still think it would be best to try to fix this in
    | Cygwin first.
    |
    | >The Disk drive has been mapped with Standard Windows "Map network
    | >drive" feature.
    | 
    | So why don't you ask on the Cygwin list whether access() and
    | euidaccess() can be taught to give the "right" answer for files on
    | such drives.  Or maybe the question is simply whether Cygwin can be
    | taught to determine the correct UID.

I'm hoping the Cygwin DLL developer(s) could share their thoughts
on this to thelp the Emacs team.

Jari


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Cygwin dll: UID and GID information not shown from remote drive
  2011-12-13 14:24 Cygwin dll: UID and GID information not shown from remote drive Jari Aalto
@ 2011-12-13 15:12 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2011-12-13 15:12 UTC (permalink / raw)
  To: cygwin

On Dec 13 16:24, Jari Aalto wrote:
> 
> ** To CC Emacs BTS, use 10257(at)debbugs.gnu.org
> 
> My full original bug report was sent initially to Emacs, because the editor
> started considering remotes file as read-only and requiring confirmation
> after every save. See:
> 
>     http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10257
> 
> It appears that Cygwin doesn't show UID and GID on Network drives (Win 7
> x64), that are connected with windows "Map Network Drive" to a
> Debian/Samba(2.3.5.11):
> 
>     $ ls -la /cygdrive/z/tmp/test-epackage.el
>     -rwxr--r-- 1 ???????? ???????? 437 Dec  9 20:02 /cygdrive/z/tmp/test-epackage.el

It's not a bug.

If you use winbind and the user accounts are correctly mapped to
Windows accounts, then you would see the Cygwin UIDs/GIDs correspoding
to the SID of the AD user account.

If you don't do that, there's only an invisible mapping from the Windows
SID to the Unix uid/gid.  The actual UNIX account has not the same mapping
back to the Windows SID.  Instead, the SID returned from Samba to
Windows is a fake SID S-1-22-1-UnixUID or S-1-22-2-UnixGID.

The easiest way to workaround this issue is to mount the share with
the noacl mount option:

  //sambaserver/share /myserver somefs binary,noacl 0 0

Alternatively you must coax Cygwin into thinking that both SIDs are the
same account.  What you can do is to map these SIDs to the desired
Cygwin UID/GID using matching entries in /etc/passwd and /etc/group,
like this:

  /etc/passwd:

    corinna:unused:11001:11125:corinna,U-VINSCHEN\corinna,S-1-5-21-2913048732-1697188782-3448811101-1001:/home/corinna:/bin/tcsh
    corinna:unused:11001:99999:,S-1-22-1-500::

  /etc/group

    vinschen:S-1-5-21-2913048732-1697188782-3448811101-1125:11125:
    vinschen:S-1-22-2-11125:11125:
  
To generate the Unix SID entries for /etc/passwd and /etc/group, see
the mkpasswd/mkgroup -U options:

  $ mkpasswd -l sambaserver -U corinna
  corinna:unused:10500:99999:,S-1-22-1-500::
  $ mkgroup -l sambaserver -U vinschen
  vinschen:S-1-22-2-11125:21125:

Just tweak the UID/GID fields and make sure that the Samba fake entries
are later in the file than the entries with the correct Windows SID mapping.


Corinna

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

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-13 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-13 14:24 Cygwin dll: UID and GID information not shown from remote drive Jari Aalto
2011-12-13 15:12 ` Corinna Vinschen

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).