getspent(3C)getspent(3C)NAMEgetspnam(), getspnam_r(), getspent(), setspent(), endspent(), fget‐
spent() - access shadow password entries
The routines and return a pointer to a shadow password entry. Each
shadow password entry is an structure, declared in the header file,
with the following members:
The routine returns a pointer to a structure containing an entry from
the shadow password database with a matching
The routine is similar to except that it does not work on systems which
have been converted to trusted mode, and it has three extra parameters.
updates the structure pointed to by and returns a pointer to that
structure. Storage referenced by the structure pointed to by is allo‐
cated from the memory provided with the parameter, which is in size. A
buffer length of 2048 is recommended.
The initial call to returns a pointer to the first structure. Subse‐
quent calls return pointers to successive structures. Repeated calls to
can be used to search all entries in the password database. The routine
searches password entries from beginning to end, until a login name
matching name is found, and returns a pointer to that entry.
The routine is used to reset access to the shadow password entries.
After is called, the subsequent call to returns the first shadow pass‐
word entry. This mechanism is used to allow repeated searches of the
shadow password entries. The routine is used to indicate that process‐
ing of password entries is complete.
unlike the other functions above, does not use and does not access NIS.
It returns a pointer to the next structure in the standard I/O stream.
The I/O stream should be open for reading and its contents should match
the format of
Shadow password entries normally reside in However, there are two
exceptions to this. On a standard system with no file, the password
and aging information is obtained from and translated into an struc‐
ture. If the system has been converted to a trusted system, the pass‐
word and aging information is obtained from the Protected Password
Database and translated into an structure.
If the fields corresponding to or are not specified in the entry, they
default to If the returned value of or is then the feature associated
with that field is considered to be disabled.
The routines and depend on the configuration of the file. See nss‐
witch.conf(4). Entries may reside in any repository specified in These
routines use the switch for the database; for example, an entry in
Programs using these routines must be compiled with
In a multithreaded application on standard systems, and are thread-
safe, but not async-cancel-safe. A cancellation point may occur when a
thread is executing any of these interfaces. On systems which have
been converted to trusted mode, only is thread-safe.
If an EOF or error is encountered while reading, and return a pointer.
Otherwise, the return value points to a valid structure. In the case
of and the structure resides in an internal area. In the case of the
structure resides in the structure pointed to by the argument.
HP-UX 11i Version 3 is the last release to support trusted systems
system password file.
shadow password file.
protected password database, for trusted systems.
SEE ALSOgetpwent(3C), getprpwent(3), nsswitch.conf(4), passwd(4), shadow(4).