1 .\" Copyright (c) 2005-2011 Apple Inc
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 4. Neither the name of Apple Computer nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER 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
30 .Dt MBR_CHECK_MEMBERSHIP 3
33 .Nm mbr_check_membership,
34 .Nm mbr_check_service_membership
35 .Nd check whether a user is a member of a group or service ACL
39 .Fn mbr_check_membership "uuid_t user" "uuid_t group" "int *ismember"
41 .Fn mbr_check_service_membership "uuid_t user" "const char *service" "int *ismember"
43 .Fn mbr_check_membership
44 tests if a given user is a member of a group (either direct or indirect via a
47 is set to 1 if the user is a member or 0 if not a member of the group.
48 .Fn mbr_check_service_membership
49 similarly tests if a given user is a member of a service ACL group. Service
50 ACLs are special groups defined with the prefix "com.apple.access_". The
51 service is then prefixed (e.g., "afp" would check "com.apple.access_afp").
52 There is a special group that grants accessto all services called
53 "com.apple.access_all_services".
55 Users may belong to any number of groups.
56 .Fn mbr_check_membership
57 should always be used to check group membership, rather than calling
65 routines are limited to a fixed number of gids,
66 and so may not include all of a user's groups.
68 There are two special cases.
69 If the two uuids are equal, then
74 uuid is equal to the reserved "everyone" uuid (ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C), then
76 will be set to 1 for any valid user.
78 Group membership information is managed by
79 .Xr opendirectoryd 8 .
81 .Fn mbr_check_membership
85 Querying membership for a nonexistent group will result in
87 being set to 0. The function returns 0 on success or one of the following error
99 .Fn mbr_check_service_membership
101 .Fn mbr_check_membership
102 except that ENOENT means no service ACL has been defined.
108 .Xr mbr_uid_to_uuid 3 ,