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]

screen's usage of unix-domain sockets under Cygwin

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

% 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 :|


Peter A. Castro <> or <>
	"Cats are just autistic Dogs" -- Dr. Tony Attwood

Attachment: mkfoosock.c
Description: mkfoosock.c

Attachment: mkfoosock.trc
Description: mkfoosock.trc

Attachment: chmod.trc
Description: chmod.trc

Unsubscribe info:
Problem reports:

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