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 nfs4_gss_princ_to_grouplist, nfs4_gss_princ_to_ids_ex,
9 nfs4_gss_princ_to_grouplist_ex, nfs4_set_debug - ID mapping routines
10 used for NFSv4
11
13 #include <nfs4_idmap.h>
14
15 int nfs4_init_name_mapping(char *conffile);
16
17 int nfs4_get_default_domain(char *server, char *domain, size_t len);
18
19 int nfs4_uid_to_name(uid_t uid, char *domain, char *name, size_t len);
20
21 int nfs4_uid_to_owner(uid_t uid, char *domain, char *name, size_t len);
22
23 int nfs4_gid_to_name(gid_t gid, char *domain, char *name, size_t len);
24
25 int nfs4_gid_to_owner(gid_t gid, char *domain, char *name, size_t len);
26
27 int nfs4_name_to_uid(char *name, uid_t *uid);
28
29 int nfs4_name_to_gid(char *name, gid_t *gid);
30
31 int nfs4_owner_to_uid(char *name, uid_t *uid);
32
33 int nfs4_owner_to_gid(char *name, gid_t *gid);
34
35 int nfs4_gss_princ_to_ids(char *secname, char *princ, uid_t *uid, gid_t
36 *gid);
37
38 int nfs4_gss_princ_to_grouplist(char *secname, char *princ, gid_t
39 *groups, int *ngroups);
40
41 int nfs4_gss_princ_to_ids_ex(char *secname, char *princ, uid_t *uid,
42 gid_t *gid, extra_mapping_params **ex);
43
44 int nfs4_gss_princ_to_grouplist_ex(char *secname, char *princ, gid_t
45 *groups, int *ngroups, extra_mapping_params **ex);
46
47 void nfs4_set_debug(int dbg_level, void (*logger)(const char *, ...));
48
49
51 NFSv4 uses names of the form user@domain. To write code that helps the
52 kernel map uid's (as rpc.idmapd does) or that processes NFSv4 ACLs, you
53 need to be able to convert between NFSv4 names and local uids and gids.
54
55 The nfs4_uid_to_name() and nfs4_gid_to_name() functions, given uid or
56 gid and domain (as a null-terminated string), write the corresponding
57 nfsv4 name into the buffer provided in name, which must be of length at
58 least len.
59
60 The nfs4_uid_to_owner() and nfs4_gid_to_group_owner() functions, given
61 uid or gid and domain (as a null-terminated string), write the corre‐
62 sponding nfsv4 name into the buffer provided in name, which must be of
63 length at least len. If there is no valid mapping from uid or gid to
64 name, then the numerical string representing uid or gid is returned
65 instead.
66
67 The nfs4_name_to_uid() and nfs4_name_to_gid() functions, given name (as
68 a null-terminated string), return the corresponding uid or gid in the
69 second parameter.
70
71 The nfs4_owner_to_uid() and nfs4_group_owner_to_gid() functions, given
72 name (as a null-terminated string), return the corresponding uid or gid
73 in the second parameter. If there is no valid mapping from name to uid
74 or gid the value for the user or group "nobody" will be returned
75 instead.
76
77 The nfs4_init_name_mapping() function must be called before using any
78 of these functions. It reads defaults from the configuration file at
79 the provided path, usually "etc/idmapd.conf".
80
81 The domain argument to the id-to-name functions is there to provide a
82 hint to the name mapper in the case where an id might be mapped to
83 names in multiple domains. In most cases, this argument should just be
84 the name returned in the domain argument to nfs4_get_default_domain()
85 which should be called with server set to NULL. The domain should be a
86 buffer of length len. The constant NFS4_MAX_DOMAIN_LEN may be used to
87 determine a reasonable value for that length.
88
89 The function nfs4_get_grouplist(), given a name, fills the provided
90 array groups with up to *ngroups group IDs corresponding to which the
91 user name belongs to, setting *ngroups to the actual number of such
92 groups. If the user belongs to more than *ngroups groups, then an
93 error is returned and the actual number of groups is stored in
94 *ngroups.
95
96 Functions nfs4_gss_princ_to_ids(), nfs4_gss_princ_to_grouplist(),
97 nfs4_gss_princ_to_ids_ex(), and nfs4_gss_princ_to_grouplist_ex() are
98 used to convert from a gss principal name (as returned by gss_dis‐
99 play_name()) to a uid and gid, or list of gids.
100
101 Finally, nfs4_set_debug() allows the application to set a debugging
102 level to produce extra debugging information from within the library.
103 The optional logger function specifies an alternative logging function
104 to call for the debug messages rather than the default internal func‐
105 tion within the library.
106
108 All functions return 0 or, in the case of error, -ERRNO.
109
110
111
112 2004-08-05 nfs4_uid_to_name(3)