]>
Commit | Line | Data |
---|---|---|
b3dd680f A |
1 | .\" Copyright (c) 2005-2007 Apple Inc |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
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. | |
15 | .\" | |
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 | |
26 | .\" SUCH DAMAGE. | |
27 | .\" | |
28 | .\" | |
29 | .Dd February 3, 2005 | |
30 | .Dt MBR_CHECK_MEMBERSHIP 3 | |
31 | .Os "Mac OS X" | |
32 | .Sh NAME | |
33 | .Nm mbr_check_membership | |
34 | .Nd check whether a user is a member of a group | |
35 | .Sh SYNOPSIS | |
36 | .In membership.h | |
37 | .Ft int | |
38 | .Fn mbr_check_membership "uuid_t user" "uuid_t group" "int *ismember" | |
39 | .Sh DESCRIPTION | |
40 | .Fn mbr_check_membership | |
41 | tests if a given user is a member of a group, individually or as a member of a nested group. | |
42 | .Fa ismember | |
43 | is set to 1 if the user is a member of the group, and 0 otherwise. | |
44 | .Pp | |
d49d4c81 | 45 | Users may belong to any number of groups. |
b3dd680f A |
46 | .Fn mbr_check_membership |
47 | should be always be used to check group membership, rather than | |
48 | calling | |
49 | .Xr getgroups 2 , | |
50 | and checking the returned list of gids. | |
51 | The | |
52 | .Xr setgroups 2 | |
53 | and | |
54 | .Xr getgroups 2 | |
55 | routines are limited to a fixed number of gids, | |
56 | and so may not include all of a user's groups. | |
57 | .Pp | |
58 | There are two special cases. | |
59 | If the two uuids are equal, then | |
60 | .Fa ismember | |
61 | is set to 1. | |
62 | If the | |
63 | .Fa group | |
64 | uuid is equal to the reserved "everyone" uuid (ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C), then | |
65 | .Fa ismember | |
66 | will be set to 1 for any valid user. | |
67 | .Pp | |
68 | Group membership information is managed by the | |
69 | .Xr DirectoryService 8 | |
70 | daemon. | |
71 | .Sh RETURN VALUES | |
72 | .Fn mbr_check_membership | |
73 | returns 0 on success. | |
74 | It returns EIO if it is unable to communicate with the | |
75 | .Xr DirectoryService 8 | |
76 | daemon. | |
77 | ENOENT is returned if | |
78 | .Fa user | |
79 | cannot be found. | |
80 | .Pp | |
81 | Note that | |
82 | .Fn mbr_check_membership | |
83 | does not test whether | |
84 | .Fa group | |
85 | exists or not. | |
d49d4c81 | 86 | Querying membership for a nonexistent group will result in |
b3dd680f A |
87 | .Fa ismember |
88 | being to 0 and a return value of 0. | |
89 | .Sh SEE ALSO | |
90 | .Xr setgroups 2 , | |
91 | .Xr getgroups 2 , | |
92 | .Xr mbr_uid_to_uuid 3 , | |
d49d4c81 | 93 | .Xr DirectoryService 8 |