DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

getprdfent(S-osr5)


getprdfent, getprdfnam, setprdfent, endprdfent, putprdfnam -- manipulate default control database entry

Syntax

cc . . . -lprot -lx

#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;

Description

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.

Return value

Upon successful completion, the getprdfent and getprdfnam routines each returns a pointer to a pr_default structure. The putprdfnam routine returns a non-zero value on a successful substitution, deletion, or addition and a value of zero upon failure. If an end-of-file or an error is encountered on reading, these functions return a NULL pointer. No errors are defined for the setprdfent or endprdfent routines.

Diagnostics

Use feof( ) to test if a null return value is caused by an end-of-file or from a syntax error in the default control file. The feof macro is described in the ferror(S-osr5) manual page.

Note

All information is contained in a static area, so it must be copied if it is to be saved. Otherwise, it may be overwritten on subsequent calls to these routines.

Files

/etc/auth/defaults

See also

authcap(F), authcap(S-osr5) getprdfent(S-osr5), getprfient(S-osr5), getprpwent(S-osr5), getprtcent(S-osr5),

Standards conformance

endprdfent, getprdfent, getprdfnam, putprdfnam and setprdfent are not part of any currently supported standard; they are an extension of AT&T System V provided by the Santa Cruz Operation.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005