HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
g
getspent(3C) getspent(3C)
NAME
getspent, getspnam, setspent, endspent - access secure password entries, for trusted systems
only.
SYNOPSIS
#include <shadow.h>
struct spwd * getspent (void);
struct spwd * getspnam (const char *name);
void setspent (void);
void endspent (void);
DESCRIPTION
The routines getspent() and getspnam() return a pointer to the next secured password entry. Each
entry is a spwd structure, declared in the shadow.h header file with the following members:
char *sp_namp; /* the user’s login name */
char *sp_pwdp; /* the encrypted password for the user */
long sp_lstchg; /* # of days from 1/1/70 when passwd was last modified */
long sp_min; /* min # of days allowed between password changes */
long sp_max; /* max # of days allowed between password changes */
long sp_warn; /* # of days before password expires and warning issued*/
long sp_inact; /* # of days between account inactive and disabled */
long sp_expire; /* # of days from 1/1/70 when account is locked */
unsigned long sp_flag;/* currently unused */
The getspent() routine returns a pointer to the first spwd structure when first called. Subsequent
calls return pointers to successive spwd structures. Repeated calls to getspent() can be used to search
all entries in the protected password database. The getspnam() routine searches password entries from
beginning to end until a login name matching name is found, and returns a pointer to that entry.
If the fields corresponding to
sp_min, sp_max, sp_lstchg, sp_warn, sp_inact, sp_expire,or
sp_flag are not specified in the entry, they default to -1. If an end-of-file or an error is encountered in
reading or a format error is detected, these functions return a null pointer and; for an error, errno
is set
to
EINVAL.
The setspent() routine is used to reset access to the secured password entries. After setspent() is
called, the subsequent call to
getspent() returns the first secured password entry. This mechanism is
used to allow repeated searches of the secured password entries. The endspent() routine is used to indi-
cate that processing of secured password entries is complete.
getspent() is only supported on trusted systems.
The secured password facility is implemented without the use of the /etc/shadow file. getspent() ,
getspnam(), setspent() , and endspent() read from the trusted systems protected password
database (/tcb/files/auth/*/*) and not /etc/shadow . The file /etc/shadow is not used in
any way by the HP-UX login facility.
These routines return a null pointer and sets ERRNO to ENOENT if the system has not been converted to
trusted system. In all other cases, the return value is set similarly to getprpwent() . See getprpwent(3)
for more information.
Programs using these routines must be compiled with
-lsec
.
DIAGNOSTICS
getspent(), getspnam(), and fgetspent() return a null pointer on EOF or error.
FILES
/etc/passwd System Password file.
/tcb/files/auth/*/* Protected password database, for trusted systems.
SEE ALSO
getpwent(3C), getprpwent(3), passwd(4).
Section 3352 1 HP-UX Release 11i: December 2000
___
___