* cygwin.din (getpeereid): Export.
* fhandler.h (class fhandler_socket): Add pipe and id members to exchange eid credentials for AF_LOCAL sockets. (eid_pipe_name): Declare new method. (getpeereid): Ditto. * fhandler_socket.cc (fhandler_socket::eid_pipe_name): New method. (fhandler_socket::fhandler_socket): Initialize sec_pipe. (fhandler_socket::connect): Exchange eid credentials with accepting socket process. (fhandler_socket::listen): Prepare eid credential transaction. (fhandler_socket::accept): Exchange eid credentials with connecting socket process. (fhandler_socket::close): Close eid credentials pipe if open. (fhandler_socket::getpeereid): New method. * net.cc (cygwin_getsockopt): Add SO_PEERCRED handling. (getpeereid): New function. * include/asm/socket.h (SO_PEERCRED): Define. * include/cygwin/socket.h (struct ucred): Define new type. * include/cygwin/version.h: Bump API minor version.
This commit is contained in:
@ -355,6 +355,16 @@ class fhandler_socket: public fhandler_base
|
||||
int type;
|
||||
int connect_secret [4];
|
||||
HANDLE secret_event;
|
||||
|
||||
HANDLE sec_pipe;
|
||||
pid_t sec_pid;
|
||||
__uid32_t sec_uid;
|
||||
__gid32_t sec_gid;
|
||||
pid_t sec_peer_pid;
|
||||
__uid32_t sec_peer_uid;
|
||||
__gid32_t sec_peer_gid;
|
||||
char *eid_pipe_name (char *buf);
|
||||
|
||||
struct _WSAPROTOCOL_INFOA *prot_info_ptr;
|
||||
char *sun_path;
|
||||
struct status_flags
|
||||
@ -395,6 +405,7 @@ class fhandler_socket: public fhandler_base
|
||||
int accept (struct sockaddr *peer, int *len);
|
||||
int getsockname (struct sockaddr *name, int *namelen);
|
||||
int getpeername (struct sockaddr *name, int *namelen);
|
||||
int getpeereid (pid_t *pid, __uid32_t *euid, __gid32_t *egid);
|
||||
|
||||
int open (int flags, mode_t mode = 0);
|
||||
ssize_t readv (const struct iovec *, int iovcnt, ssize_t tot = -1);
|
||||
|
Reference in New Issue
Block a user