Add setsockopt(sd, SOL_SOCKET, SO_PEERCRED, NULL, 0) to disable

initial handshake on AF_LOCAL sockets.
	* fhandler.h (class fhandler_socket): Add no_getpeereid status flag.
	(fhandler_socket::af_local_set_no_getpeereid): New prototype.
	* fhandler_socket.cc (fhandler_socket::af_local_connect): Skip handshake
	if no_getpeereid is set.  Add debug output.
	(fhandler_socket::af_local_accept): Likewise.
	(fhandler_socket::af_local_set_no_getpeereid): New function.
	(fhandler_socket::af_local_copy): Copy no_getpeereid.
	(fhandler_socket::getpeereid): Fail if no_getpeereid is set.
	* net.cc (cygwin_setsockopt): Add SO_PEERCRED for AF_LOCAL/SOCK_STREAM
	sockets.  Add comment to explain why we need it.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
This commit is contained in:
Corinna Vinschen
2014-10-11 18:28:04 +00:00
parent a85ab1d482
commit 697b9afe00
5 changed files with 74 additions and 4 deletions

View File

@ -452,12 +452,13 @@ details. */
CW_GETENT, CW_ENDENT, CW_GETNSSSEP, CW_GETPWSID, CW_GETGRSID,
CW_CYGNAME_FROM_WINNAME.
276: Export ffsl, ffsll.
277: Add setsockopt(SO_PEERCRED).
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 276
#define CYGWIN_VERSION_API_MINOR 277
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible