This is the mail archive of the 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: screen's usage of unix-domain sockets under Cygwin

On Fri, 2 May 2003, Peter A. Castro wrote:

> Hi,
>   I'm one of those people who makes use of 'screen' on unix systems, and,
> after reading about the various problems people were having getting
> screen to work under Cygwin, decided to take a closer look at it myself.
> I now understand what screen is doing, and why it's failing, but it's not
> a trivial fix.  Screen make some assumptions concerning unix-domain
> sockets (ie: a file-system based socket) that basically don't work under
> Cygwin.  However, they should!  I've gone through cygwin code and it
> looks like it should actually provide the necessary support, but it's not
> doing the right thing.
>   The symptom is that once a unix-domain socket is create, you can't
> change it's permissions (or any of it attributes), reguardless of weither
> it's actively being used or not.
>   To demonstrate, create a socket somewhere.  I've attached sample C
> source to create a socket (/tmp/foosock).  The socket will be created
> based on your current umask, of course.  Now, try changing the
> permissions on the socket, using chmod.  Notice that you can't change the
> permissions at all.  Not only that, but you can't change the ownerid or
> groupid.
>   Note that I am using CYGWIN="ntsec tty".  I am doing this on a plain,
> local NTFS filesystems (running NT4+SP6) and I'm not connected to any
> NTdomain; I'm logged in locally as "Administrator".  I can change
> permissions and ownership on any regular file in the same filesystem.
>   I've also attached an strace of the creating of the socket
> (mkfoosock.trc) and an strace of chmod trying to set the mode
> (chmod.trc).
> % strace --mask=all --output=mkfoosock.trc ./mkfoosock
> % ls -al /tmp/foosock
> srwxrwxrwt    1 Administ None            0 May  2 18:16 /tmp/foosock
> % strace --mask=all --output=chmod.trc chmod 600 /tmp/foosock
> % ls -al /tmp/foosock
> srwxrwxrwt    1 Administ None            0 May  2 18:16 /tmp/foosock
> Note that to Windows this file is marked as a (S)ystem file and isn't
> visible to most applications.
> I've examined the traces and looked through some of the cygwin specific
> code (winsup/cygwin/,,, but
> without a debug environment, I can't really follow the flow effectively.
> Can someone who's got a debug environment setup, try tracing
> fhandler_socket::bind() and see if it actually creates the security
> descriptors correctly?  Then trace chmod to see why it can't change the
> security descriptor?
> If this can be solved, it'll go a long way towards making screen work
> under Cygwin and making the usability/security of unix-domain sockets
> better.  If noone can readily test-drive this, I'll just have to go
> figure out how to setup a debug env myself :|
> Thanks!


Looks like you're using a stock release of Cygwin.  Before you go to the
trouble of building your own cygwin1.dll, could you try the latest
snapshot, and see if the problem still manifests with it?  Corinna says
that the chmod problem has been fixed since the day after the 1.3.22
release... :-)

2003-03-19  Corinna Vinschen  <>
       * (chmod): Allow chmod'ing of socket files.

The chown problem has been fixed here:

So, do try the May 4 snapshot.
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Knowledge is an unending adventure at the edge of uncertainty.
  -- Leto II

Unsubscribe info:
Problem reports:

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