NAME nfs4uidtoname, nfs4gidtoname, nfs4nametouid, nfs4nametogid, nfs4initnamemapping, nfs4getdefaultdomain, nfs4gssprinctoids, nfs4gssprinctogrouplist, nfs4gssprinctoidsex,
nfs4gssprinctogrouplistex, nfs4setdebug - ID mapping routines used for NFSv4 SYNOPSIS
#include
int nfs4initnamemapping(char *conffile); int nfs4getdefaultdomain(char *server, char *domain, sizet len); int nfs4uidtoname(uidt uid, char *domain, char *name, sizet len); int nfs4uidtoowner(uidt uid, char *domain, char *name, sizet len); int nfs4gidtoname(gidt gid, char *domain, char *name, sizet len); int nfs4gidtoowner(gidt gid, char *domain, char *name, sizet len); int nfs4nametouid(char *name, uidt *uid); int nfs4nametogid(char *name, gidt *gid); int nfs4ownertouid(char *name, uidt *uid); int nfs4ownertogid(char *name, gidt *gid); int nfs4gssprinctoids(char *secname, char *princ, uidt *uid, gidt *gid); int nfs4gssprinctogrouplist(char *secname, char *princ, gidt *groups, int *ngroups); int nfs4gssprinctoidsex(char *secname, char *princ, uidt *uid, gidt *gid, extramappingparams **ex); int nfs4gssprinctogrouplistex(char *secname, char *princ, gidt *groups, int *ngroups, extramappingparams **ex); void nfs4setdebug(int dbglevel, void (*logger)(const char *, ...)); DESCRIPTION NFSv4 uses names of the form user@domain. To write code that helps the kernel map uid's (as rpc.idmapd does) or that processes NFSv4 ACLs, you need to be able to convert between NFSv4 names and local uids and gids. The nfs4uidtoname() and nfs4gidtoname() functions, given uid or gid and domain (as a null-terminated string), write the corresponding nfsv4 name into the buffer provided in name, which must be of length at least len. The nfs4uidtoowner() and nfs4gidtogroupowner() functions, given
uid or gid and domain (as a null-terminated string), write the corre‐ sponding nfsv4 name into the buffer provided in name, which must be of length at least len. If there is no valid mapping from uid or gid to name, then the numerical string representing uid or gid is returned instead. The nfs4nametouid() and nfs4nametogid() functions, given name (as
a null-terminated string), return the corresponding uid or gid in the second parameter. The nfs4ownertouid() and nfs4groupownertogid() functions, given
name (as a null-terminated string), return the corresponding uid or gid in the second parameter. If there is no valid mapping from name to uid or gid the value for the user or group "nobody" will be returned instead. The nfs4initnamemapping() function must be called before using any of these functions. It reads defaults from the configuration file at the provided path, usually "etc/idmapd.conf".
The domain argument to the id-to-name functions is there to provide a hint to the name mapper in the case where an id might be mapped to names in multiple domains. In most cases, this argument should just be the name returned in the domain argument to nfs4getdefaultdomain() which should be called with server set to NULL. The domain should be a buffer of length len. The constant NFS4MAXDOMAINLEN may be used to determine a reasonable value for that length. The function nfs4getgrouplist(), given a name, fills the provided array groups with up to *ngroups group IDs corresponding to which the user name belongs to, setting *ngroups to the actual number of such groups. If the user belongs to more than *ngroups groups, then an error is returned and the actual number of groups is stored in *ngroups. Functions nfs4gssprinctoids(), nfs4gssprinctogrouplist(), nfs4gssprinctoidsex(), and nfs4gssprinctogrouplistex() are used to convert from a gss principal name (as returned by gssdis‐ playname()) to a uid and gid, or list of gids. Finally, nfs4setdebug() allows the application to set a debugging level to produce extra debugging information from within the library. The optional logger function specifies an alternative logging function to call for the debug messages rather than the default internal func‐ tion within the library. RETURN VALUE
All functions return 0 or, in the case of error, -ERRNO.
2004-08-05 nfs4uidtoname(3)