Libinfo-278.0.3.tar.gz
[apple/libinfo.git] / membership.subproj / mbr_uid_to_uuid.3
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_UID_TO_UUID 3
31 .Os "Mac OS X"
32 .Sh NAME
33 .Nm mbr_uid_to_uuid,
34 .Nm mbr_gid_to_uuid,
35 .Nm mbr_uuid_to_id,
36 .Nm mbr_sid_to_uuid,
37 .Nm mbr_uuid_to_sid
38 .Nd user and group identifier translation functions
39 .Sh SYNOPSIS
40 .In membership.h
41 .Ft int
42 .Fn mbr_uid_to_uuid "uid_t id" "uuid_t uu"
43 .Ft int
44 .Fn mbr_gid_to_uuid "gid_t id" "uuid_t uu"
45 .Ft int
46 .Fn mbr_uuid_to_id "const uuid_t uu" "uid_t *id" "int *id_type"
47 .Ft int
48 .Fn mbr_sid_to_uuid "const nt_sid_t *sid" "uuid_t uu"
49 .Ft int
50 .Fn mbr_uuid_to_sid "const uuid_t uu" "nt_sid_t *sid"
51 .Sh DESCRIPTION
52 Users and groups can be referred to in multiple ways.
53 In addition to the traditional uid and gid, 
54 every user or group can be referenced by a 128 bit uuid.
55 Additionally, if the user or group is hosted on a PDC
56 or Active Directory server, it will have a 128 bit or larger sid.
57 .Pp
58 These routines communicate with the
59 .Xr DirectoryService 8
60 daemon.
61 .Pp
62 .Fn mbr_uid_to_uuid
63 takes a uid and looks up the associated user account.
64 It provides the the uuid for that user as an output parameter.
65 .Pp
66 .Fn mbr_gid_to_uuid
67 similarly gets the uuid associated with a group.
68 .Pp
69 .Fn mbr_uuid_to_id
70 takes a uuid that refers to a user or group and fetches the corresponding uid or gid.
71 .Fa id_type
72 is set to ID_TYPE_UID or ID_TYPE_GID to indicate which type was found.
73 Note that
74 .Fn mbr_uuid_to_id
75 always returns an id even if the uuid is not found.
76 This returned id is not persistant, 
77 but can be used to map back to the uuid during runtime.
78 To determine if the uuid exists, the returned id can be used in a call to
79 .Xr getpwuid 3
80 or
81 .Xr getgrgid 3 .
82 .Pp
83 .Fn mbr_sid_to_uuid
84 takes a sid and returns the associated uuid.
85 Like
86 .Fn mbr_uuid_to_id ,
87 .Fn mbr_sid_to_uuid
88 always returns a uuid for the sid, even if the sid can not be found.
89 .Pp
90 .Fn mbr_uuid_to_sid
91 returns a sid for the associated uuid.
92 .Sh RETURN VALUES
93 These functions return 0 on success, or EIO if communications with the
94 .Xr DirectoryService 8
95 daemon fails.
96 ENOENT is returned if the mapping can not be performed.
97 .Sh SEE ALSO
98 .Xr getpwuid 3 ,
99 .Xr getgrgid 3 ,
100 .Xr mbr_check_membership 3 ,
101 .Xr DirectoryService 8