summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/getpeereid.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/getpeereid.3')
-rw-r--r--src/lib/libc/net/getpeereid.3121
1 files changed, 0 insertions, 121 deletions
diff --git a/src/lib/libc/net/getpeereid.3 b/src/lib/libc/net/getpeereid.3
deleted file mode 100644
index 4475bbd77d..0000000000
--- a/src/lib/libc/net/getpeereid.3
+++ /dev/null
@@ -1,121 +0,0 @@
1.\" $OpenBSD: getpeereid.3,v 1.4 2022/09/11 06:38:10 jmc Exp $
2.\"
3.\" Copyright (c) 1983, 1991, 1993
4.\" The Regents of the University of California. All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\" may be used to endorse or promote products derived from this software
16.\" without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.Dd $Mdocdate: September 11 2022 $
30.Dt GETPEEREID 3
31.Os
32.Sh NAME
33.Nm getpeereid
34.Nd get effective user and group identification of locally-connected peer
35.Sh SYNOPSIS
36.In sys/types.h
37.In sys/socket.h
38.Ft int
39.Fn getpeereid "int s" "uid_t *euid" "gid_t *egid"
40.Sh DESCRIPTION
41.Fn getpeereid
42returns the effective user ID and group ID of the peer connected to
43a
44.Ux Ns -domain
45socket (see
46.Xr unix 4 ) .
47The argument
48.Fa s
49must be of type
50.Dv SOCK_STREAM
51or
52.Dv SOCK_SEQPACKET .
53.Pp
54One common use is for
55.Ux Ns -domain
56servers to determine the credentials of clients that have connected to it.
57.Pp
58.Fn getpeereid
59takes three parameters:
60.Bl -bullet
61.It
62.Fa s
63contains the file descriptor of the socket whose peer credentials
64should be looked up.
65.It
66.Fa euid
67points to a
68.Vt uid_t
69variable into which the effective user ID for the connected peer will
70be stored.
71.It
72.Fa egid
73points to a
74.Vt gid_t
75variable into which the effective group ID for the connected peer will
76be stored.
77.El
78.Sh RETURN VALUES
79If the call succeeds, a 0 is returned and
80.Fa euid
81and
82.Fa egid
83are set to the effective user ID and group ID of the connected peer.
84Otherwise,
85.Va errno
86is set and a value of \-1 is returned.
87.Sh ERRORS
88On failure,
89.Va errno
90is set to one of the following:
91.Bl -tag -width Er
92.It Bq Er EBADF
93The argument
94.Fa s
95is not a valid descriptor.
96.It Bq Er ENOTSOCK
97The argument
98.Fa s
99is a file, not a socket.
100.It Bq Er EOPNOTSUPP
101The socket is not in the
102.Ux Ns -domain .
103.It Bq Er ENOTCONN
104The socket is not connected.
105.It Bq Er ENOBUFS
106Insufficient resources were available in the system
107to perform the operation.
108.El
109.Sh SEE ALSO
110.Xr accept 2 ,
111.Xr bind 2 ,
112.Xr getpeername 2 ,
113.Xr getsockname 2 ,
114.Xr getsockopt 2 ,
115.Xr socket 2 ,
116.Xr unix 4
117.Sh HISTORY
118The
119.Fn getpeereid
120function call appeared in
121.Ox 3.0 .