|
|
#include <sys/types.h> #include <sys/security.h> #include <sys/audit.h> #include <prot.h>struct pr_default *getprdfent ()
struct pr_default *getprdfnam (name) char *name;
void setprdfent ()
void endprdfent ()
int putprdfnam (name, pr) char *name; struct pr_default *pr;
The getprdfent and getprdfnam routines both return a pointer to an object with the following structure containing the broken-out fields of a line in the default control database. Only entries in the database dealing with users are scanned. Each line in the database contains a pr_default structure, declared in the <prot.h> header file:
struct pr_default { char dd_name[20]; char dg_name; struct pr_field prd; struct pr_flag prg; struct t_field tcd; struct t_flag tcg; struct dev_field devd; struct dev_flag devg; struct system_default_fields sfld; struct system_default_flags sflg; };Because this structure is declared in <prot.h>, it need not be redeclared.
When the getprdfent routine is first called, it returns a pointer to the first user pr_default structure in the database. Thereafter, it returns a pointer to the next user pr_default structure in the database. So, successive calls can be used to search the entire database.
The getprdfnam routine searches from the beginning of the database file until a login name matching the argument name is found. getprdfnam returns a pointer to the particular pr_default structure in which the argument name was found.
The setprdfent routine resets the file pointer to the beginning of the default control file to allow repeated searches. The endprdfent routine closes the default control file when processing is complete.
The putprdfnam
routine puts a new or replaced default control entry
pr with key name into the default control file.
If the uflg.fg_name
field is 0, the requested entry is
deleted from the default control database.
The putprdfnam
routine locks the database for all update operations,
and performs an endprdfent after the update or failed attempt.