GETPEEREID(3) | NetBSD Library Functions Manual | GETPEEREID(3) |
int
getpeereid(int s, uid_t *euid, gid_t *egid);
The credentials returned to the accept(2) caller are those of its peer at the time it called connect(2); the credentials returned to the connect(2) caller are those of its peer at the time it called bind(2). This mechanism is reliable; there is no way for either side to influence the credentials returned to its peer except by calling the appropriate system call (i.e., either connect(2) or bind(2)) under different effective credentials.
One common use of this routine is for a UNIX-domain server to verify the credentials of its client. Likewise, the client can verify the credentials of the server.
August 8, 2007 | NetBSD 5.99 |