*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> getpeereid (2)              
Title
Content
Arch
Section
 

GETPEEREID(2)

Contents


NAME    [Toc]    [Back]

     getpeereid - get effective user and group identification  of
locally-connected
 peer

SYNOPSIS    [Toc]    [Back]

     #include <sys/types.h>
     #include <sys/socket.h>

     int
     getpeereid(int s, uid_t *euid, gid_t *egid);

DESCRIPTION    [Toc]    [Back]

     getpeereid()  returns  the effective user ID and group ID of
the peer connected
 to a UNIX domain socket (see unix(4)).  The  argument
s must be of
     type SOCK_STREAM.

     One  common  use is for UNIX domain servers to determine the
credentials of
     clients that have connected to it.

     getpeereid() takes three parameters:

     s Contains the file descriptor of the socket whose peer credentials
     should be looked up.

     euid Points to a uid_t variable into which the effective user ID for the
     connected peer will be stored.

     egid Points to a gid_t variable  into  which  the  effective
group ID for the
     connected peer will be stored.

RETURN VALUES    [Toc]    [Back]

     If  the call succeeds, a 0 is returned and euid and egid are
set to the
     effective user ID and group ID of the connected peer.   Otherwise, errno
     is set and a value of -1 is returned.

ERRORS    [Toc]    [Back]

     On failure, errno is set to one of the following:

     [EBADF]       The argument s is not a valid descriptor.

     [ENOTSOCK]    The argument s is a file, not a socket.

     [EOPNOTSUPP]  The socket is not in the UNIX domain.

     [ENOTCONN]    The socket is not connected.

     [ENOBUFS]      Insufficient  resources were available in the
system to perform
 the operation.

     [EFAULT]      The euid or egid parameters  point  to  memory
not in a valid
                   part of the process address space.

SEE ALSO    [Toc]    [Back]

      
      
     accept(2),  bind(2),  getpeername(2),  getsockname(2), socket(2), unix(4)

HISTORY    [Toc]    [Back]

     The getpeereid() function call appeared in OpenBSD 3.0.

OpenBSD     3.6                           June      26,      2001
[ Back ]
 Similar pages
Name OS Title
seteuid Linux set effective user or group ID
setreuid Linux set real and/or effective user or group ID
geteuid HP-UX get real user, effective user, real group, and effective group IDs
getuid HP-UX get real user, effective user, real group, and effective group IDs
getgid HP-UX get real user, effective user, real group, and effective group IDs
getuid IRIX get real user, effective user, real group, and effective group IDs
getegid HP-UX get real user, effective user, real group, and effective group IDs
getresuid OpenBSD get or set real, effective and saved user or group ID
getresgid OpenBSD get or set real, effective and saved user or group ID
getresuid Linux get real, effective and saved user or group ID
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service