HPlogo HP-UX Reference Volume 4 of 5 > g

getspent(3C)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

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 indicate 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 system's 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.

STANDARDS CONFORMANCE

getspent : SVID3

© Hewlett-Packard Development Company, L.P.