PW_MAPPING(S) UNIX System V PW_MAPPING(S)
Name
pw_mapping: pw_nametoid, pw_idtoname, gr_nametoid,
gr_idtoname - map between user and group names and IDs
Syntax
int pw_nametoid(name)
char *name;
char *pw_idtoname(id)
int id;
int gr_nametoid(name)
char *name;
char *gr_idtoname(id)
int id;
Description.
These routines provide an efficient mapping between user and
group names and identifiers (IDs). They maintain a separate
binary database, which is automatically updated each time
the routines encounter a changed /etc/passwd or /etc/group
file. Also, these routines do not interfere with the
behavior of the getpwent(S) and getgrent(S) routines, and
are thus used by the Protected Database routines, which must
frequently convert between names and identifiers but may not
disrupt an application's use of password mapping routines.
These routines are much more efficient than the getpwent(S)
and getgrent(S) routines, in that they do not parse the
underlying files and keep the database in memory after the
first use. Thus, savings are much greater for the second
and subsequent lookups. The binary databases are stored in
the /etc/auth/system directory, which is maintained by the
Auth protected subsystem.
Diagnostics
Routines returning character strings return NULL on failure,
and a pointer to a string in an internal (to the routines)
memory area containing the user or group name on success.
Routines returning integers return a non-negative user or
group ID on success, or a -1 on failure.
See Also
getpwent(S), getgrent(S), getprpwent(S)
Files
/etc/auth/system/pw_id_map
/etc/auth/system/gr_id_map
/etc/passwd
/etc/group
Notes
Programs using these routines must be linked with -lprot.
(printed 6/20/89)