GETPRTCENT(S) UNIX System V GETPRTCENT(S)
Name
getprtcent, getprtcnam, setprtcent, endprtcent, putprtcnam -
manipulate terminal control database entry
Syntax
#include <sys/types.h>
#include <sys/security.h>
#include <sys/audit.h>
#include <prot.h>
struct pr_term *getprtcent ()
struct pr_term *getprtcnam (name);
char *name;
void setprtcent ();
void endprtcent ();
int putprtcnam (name, pr)
char *name;
struct pr_term *pr;
Description
Getprtcent and getprtcnam each returns a pointer to an
object with the following structure containing the broken-
out fields of a line in the terminal control database. Only
entries in the database dealing with users are scanned.
Each line in the database contains a ``pr_term'' structure,
declared in the <prot.h> header file:
struct t_field {
char fd_devname[12]; /* Same size as utmp entry */
ushort fd_uid; /* uid of last successful login */
time_t fd_slogin; /* time stamp of " " */
ushort fd_uuid; /* uid of last unsuccessful login */
time_t fd_ulogin; /* time stamp of " " */
ushort fd_loutuid; /* uid of last logout */
time_t fd_louttime; /* time stamp of " */
ushort fd_nlogins; /* consecutive failed attempts */
ushort fd_max_tries; /* max unsuc login tries allowed */
time_t fd_logdelay; /* delay between login tries */
char fd_label[AUTH_TLSIZ];/* terminal label */
char fd_lock; /* terminal locked? */
};
struct t_flag {
unsigned
fg_devname:1, /* Is fd_devname set? */
fg_uid:1, /* Is fd_uid set? */
fg_slogin:1, /* Is fd_stime set? */
fg_uuid:1, /* Is fd_uuid set? */
fg_ulogin:1, /* Is fd_ftime set? */
fg_loutuid:1, /* Is fd_loutuid set? */
fg_louttime:1, /* Is fd_louttime set? */
fg_nlogins:1, /* Is fd_nlogins set? */
fg_max_tries:1, /* Is fd_max_tries set? */
fg_logdelay:1, /* Is fd_logdelay set? */
fg_label:1, /* Is fd_label set? */
fg_lock:1, /* Is fd_lock set? */
fg_reserved:20; /* Reserved, leave set to 0 */
};
struct pr_term {
struct t_field ufld;
struct t_flag uflg;
struct t_field sfld;
struct t_flag sflg;
};
This structure is declared in <prot.h> so it is not
necessary to redeclare it.
Getprtcent when first called returns a pointer to the first
user pr_term structure in the database; thereafter, it
returns a pointer to the next pr_term structure in the
database; so successive calls can be used to search the
database. Getprtcnam searches from the beginning of the
file until a login name matching name is found, and returns
a pointer to the particular structure in which it was found.
If an end-of-file or an error is encountered on reading,
these functions return a NULL pointer.
A call to setprtcent has the effect of rewinding the
terminal control file to allow repeated searches.
Endprtcent may be called to close the terminal control file
when processing is complete.
Putprtcnam puts a new or replaced terminal control entry pr
with key name into the appropriate file(s). If the
"uflg.fg_name" field is 0, the requested entry is deleted
from the terminal control database. Putprtcnam locks the
database for all update operations, and performs a
endprtcent after the update or failed attempt.
Files
/etc/auth/ttys
See Also
getprpwent(S), getprfient(S), getprcment(S), getprdfent(S),
authcap(S), authcap(F)
DIAGNOSTICS
A NULL pointer is returned on EOF or error.
Notes
All information is contained in a static area, so it must be
copied if it is to be saved.
Value Added
endprtcent, getprtcent, getprtcnam, putprtcnam and
setprtcent are extensions of AT&T System V provided by the
Santa Cruz Operation.
(printed 6/20/89)