1nfs4_uid_to_name(3) Library Functions Manual nfs4_uid_to_name(3)
2
3
4
6 nfs4_uid_to_name, nfs4_gid_to_name, nfs4_name_to_uid, nfs4_name_to_gid,
7 nfs4_init_name_mapping, nfs4_get_default_domain, nfs4_gss_princ_to_ids:
8 idmapping for nfsv4
9
11 #include <nfs4_idmap.h>
12
13 int nfs4_init_name_mapping(char *conffile);
14
15 int nfs4_get_default_domain(char *server, char *domain, size_t len);
16
17 int nfs4_uid_to_name(uid_t uid, char *domain, char *name, size_t len);
18
19 int nfs4_gid_to_name(gid_t gid, char *domain, char *name, size_t len);
20
21 int nfs4_name_to_uid(char *name, uid_t *uid);
22
23 int nfs4_name_to_gid(char *name, gid_t *gid);
24
25 int nfs4_gss_princ_to_ids(char *princ, uid_t *uid, gid_t *gid);
26 int nfs4_get_grouplist(const char *name, gid_t *groups, int *ngroups);
27
29 NFSv4 uses names of the form user@domain. To write code that helps the
30 kernel map uid's (as rpc.idmapd does) or that processes NFSv4 ACLs, you
31 need to be able to convert between NFSv4 names and local uids and gids.
32
33 The nfs4_uid_to_name() and nfs4_gid_to_name() functions, given uid or
34 gid and domain (as a null-terminated string), write the corresponding
35 nfsv4 name into the buffer provided in name, which must be of length at
36 least len.
37
38 The nfs4_name_to_uid() and nfs4_name_to_gid() functions, given name (as
39 a null-terminated string), return the corresponding uid or gid in the
40 second parameter.
41
42 The nfs4_init_name_mapping() function must be called before using any
43 of these functions. It reads defaults from the configuration file at
44 the provided path, usually "etc/idmapd.conf".
45
46 The domain argument to the id-to-name functions is there to provide a
47 hint to the name mapper in the case where an id might be mapped to
48 names in multiple domains. In most cases, this argument should just be
49 the name returned in the domain argument to nfs4_get_default_domain()
50 which should be called with server set to NULL. The domain should be a
51 buffer of length len. The constant NFS4_MAX_DOMAIN_LEN may be used to
52 determine a reasonable value for that length.
53
54 The function nfs4_get_grouplist(), given a name, fills the provided
55 array groups with up to *ngroups group IDs corresponding to which the
56 user name belongs to, setting *ngroups to the actual number of such
57 groups. If the user belongs to more than *ngroups groups, then an
58 error is returned and the actual number of groups is stored in
59 *ngroups.
60
61 Finally, nfs4_gss_princ_to_ids() is used to convert from a gss princiā
62 pal name (as returned by gss_display_name()) to a uid and gid.
63
65 All functions return 0 or, in the case of error, -ERRNO.
66
67
68
69 2004-08-05 nfs4_uid_to_name(3)