HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)
g
getprpwent(3) getprpwent(3)
getprpwnam() searches from the beginning of the database 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
setprpwent() has the effect of rewinding the protected password database to allow repeated
searches. endprpwent can be called to close the protected password database when processing is com-
plete.
putprpwnam() puts a new or replaces a protected password entry pr with key name into the database.
If the uflg.fg_name field is 0, the requested entry is deleted from the protected password database.
putprpwnam() locks the database for all update operations, and performs a
endprpwent() after the
update or failed attempt. For NIS+, this function will add or remove protected password information from
the
passwd table and/or trusted table and/or the local protected database.
NOTES
The value returned by
getprpwent() and getprpwnam() refers to a structure that is overwritten by
calls to these routines. To retrieve an entry, modify it, and replace it in the database, copy the entry using
structure assignment and supply the modified buffer to
putprpwnam() .
On systems supporting network connections, the fd_suctty and fd_unsuctty fields can be the ASCII
representation of the network address of the host from which the last successful or unsuccessful remote
login to the account occurred. Use
getdvagnam() (see getdvagent(3)) to investigate the type of device to
determine whether a host or a terminal was used for the last successful or unsuccessful login.
Programs using these routines must be compiled with -lsec
.
If you link your application with the archive version of
libsec (libsec.a), these routines work
independent of NIS+ or the Name Service Switch. The protected password database exists only in the local
system; for example, /tcb only and not the NIS+ passwd or trusted table.
getprpwent() assumes one name per UID and one UID per name. The sequential scan loops between
the first two instances of a multiple UID.
getprpwent() uses getpwent(3C) routines to sequentially scan databases. User program references to
password entries obtained using getpwent(3C) routines will not be valid after using any routines described
here (that is, the * prp*routines).
If NIS+ is configured in your system, the protected password information can be stored in three different
repositories:
1. The NIS+ passwd Table for the local domain.
2. The NIS+ Trusted Table for the local domain.
3. The Local Protected Database file.
Additionally, all of these routines depend on the configuration of the Name Service Switch file,
/etc/nsswitch.conf
. These routines use the switch for the passwd database.
APPLICATION USAGE
In a multithreaded application, these routines are safe to be called only from one dedicated thread. These
routines are not POSIX.1c async-cancel safe nor async-signal safe. In an NIS+ namespace, the user should
be aware of the configuration of the
/etc/nsswitch.conf file because protected password informa-
tion is stored in three different repositories: passwd table, trusted table, and local database. The Name
Service Switch database used for the protected database API is passwd (for example, an entry in
/etc/nsswitch.conf would contain passwd: nisplus files).
RETURN VALUE
getprpwent() , getprpwuid() , getprpwaid() , and getprpwnam() return NULL pointers on
EOF or error. putprpwnam() returns 0 if it cannot add or update the entry.
FILES
/etc/passwd System Password file
/tcb/files/auth/*/* Protected Password database
/tcb/files/auth/system/default System Defaults database
NIS+ TABLES
passwd, trusted
526 Hewlett-Packard Company − 4 − HP-UX 11i Version 2: December 2007 Update