xref: /freebsd/share/man/man9/groupmember.9 (revision f5463265955b829775bbb32e1fd0bc11dafc36ce)
1.\"
2.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
3.\" Copyright (C) 2023 Olivier Certner <olce.freebsd@certner.fr>
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice(s), this list of conditions and the following disclaimer as
10.\"    the first lines of this file unmodified other than the possible
11.\"    addition of one or more copyright notices.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice(s), this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
17.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
20.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26.\" DAMAGE.
27.\"
28.Dd August 18, 2023
29.Dt GROUPMEMBER 9
30.Os
31.Sh NAME
32.Nm groupmember
33.Nd checks if credentials mandate some group membership
34.Sh SYNOPSIS
35.In sys/param.h
36.In sys/ucred.h
37.Ft bool
38.Fn groupmember "gid_t gid" "struct ucred *cred"
39.Ft bool
40.Fn realgroupmember "gid_t gid" "struct ucred *cred"
41.Sh DESCRIPTION
42The
43.Fn groupmember
44function checks if credentials
45.Fa cred
46indicate that the associated subject or object is a member of the group
47designated by the group ID
48.Fa gid .
49.Pp
50Considered groups in
51.Fa cred
52are the effective and supplementary groups.
53The real group is not taken into account.
54.Pp
55Function
56.Fn realgroupmember
57works the same except that it considers instead the real and supplementary
58groups, and not the effective one.
59.Sh RETURN VALUES
60The
61.Fn groupmember
62and
63.Fn realgroupmember
64functions return
65.Dv true
66if the given credentials indicate membership of the group
67.Fa gid ,
68or
69.Dv false
70otherwise.
71.Sh SEE ALSO
72.Xr getgroups 2
73.Xr setgroups 2
74.Sh AUTHORS
75This manual page was initially written by
76.An -nosplit
77.An Chad David Aq Mt davidc@acns.ab.ca
78and was revised by
79.An Olivier Certner Aq Mt olce.freebsd@certner.fr .
80