Unixドメイン・ソケットで相手の「認証」を行う方法
http://www.linux.or.jp/JF/JFdocs/Secure-Programs-HOWTO/sockets.html
/* fd= file descriptor of Unix domain socket connected to the client you wish to identify */ struct ucred cr; int cl=sizeof(cr); if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl)==0) { printf("Peer's pid=%d, uid=%d, gid=%d\n", cr.pid, cr.uid, cr.gid);
この機能って知っているけど、いつ使うんだろう。
仕事でもUnixドメイン・ソケット(Local IPC)は使うんだけど
この機能はデバッグぐらいしか使うことが無い。