The
user_from_uid() function returns the user name associated with the argument
uid. The user name is cached so that multiple calls with the same
uid do not require additional calls to
getpwuid(3). If there is no user associated with the
uid, a pointer is returned to a string representation of the
uid, unless the argument
nouser is non-zero, in which case a
NULL pointer is returned.
The
group_from_gid() function returns the group name associated with the argument
gid. The group name is cached so that multiple calls with the same
gid do not require additional calls to
getgrgid(3). If there is no group associated with the
gid, a pointer is returned to a string representation of the
gid, unless the argument
nogroup is non-zero, in which case a
NULL pointer is returned.
The
uid_from_user() function returns the uid associated with the argument
name. The uid is cached so that multiple calls with the same
name do not require additional calls to
getpwnam(3). If there is no uid associated with the
name, the
uid_from_user() function returns -1; otherwise it stores the uid at the location pointed to by
uid and returns 0.
The
gid_from_group() function returns the gid associated with the argument
name. The gid is cached so that multiple calls with the same
name do not require additional calls to
getgrnam(3). If there is no gid associated with the
name, the
gid_from_group() function returns -1; otherwise it stores the gid at the location pointed to by
gid and returns 0.
The
pwcache_userdb() function changes the user database access routines which
user_from_uid() and
uid_from_user() call to search for users. The caches are flushed and the existing
endpwent() method is called before switching to the new routines.
getpwnam and
getpwuid must be provided, and
setpassent and
endpwent may be
NULL pointers.
The
pwcache_groupdb() function changes the group database access routines which
group_from_gid() and
gid_from_group() call to search for groups. The caches are flushed and the existing
endgrent() method is called before switching to the new routines.
getgrnam and
getgrgid must be provided, and
setgroupent and
endgrent may be
NULL pointers.