getpwent(3C)getpwent(3C)NAMEgetpwent(), getpwuid(), getpwuid_r(), getpwnam(), getpwnam_r(), setp‐
went(), endpwent(), fgetpwent() - get password file entry
SYNOPSIS
Obsolescent Interfaces
DESCRIPTION
and are used to obtain password entries, and return a pointer to an
object of structure. An entry may come from any of the sources for
specified in the file. See nsswitch.conf(4).
The structure is defined in and includes the following members:
The pw_comment field is unused. For more information on the other
fields, see the passwd(4) manpage.
When first called, returns a pointer to the first structure in the
password database. Thereafter, it returns a
pointer to the next structure in the database.
Has the effect of rewinding the password database to allow repeated
searches.
Can be called to indicate that password database processing is com‐
plete.
Searches from the beginning of the password database until a numeric
user ID
matching uid is found, and returns a pointer to the
particular structure in which it was found.
Searches from the beginning of the password database until a login
name matching name is found, and returns a pointer
to the particular structure in which it was found.
Unlike the other functions above, does not use
nor access NIS It returns a pointer to the next
structure in the standard I/O stream stream, which
should be open for reading, and its contents should
match the format of
Obsolescent Interfaces
get password file entry.
Reentrant Interfaces
and both update the pointed to by and store a pointer to that structure
at the location pointed to by The structure must contain an entry from
the user database with a matching or Storage referenced by the struc‐
ture pointed to by is allocated from the memory provided with the
parameter, which is defined as in size. The maximum size needed for
this buffer can be determined with the parameter. A NULL pointer is
returned at the location pointed to by on error or if the requested
entry is not found.
Notes
When the repository is set to in the file, then the and calls return
the structure exactly as it appears in the file. In shadowed standard
mode, the calls normally return "x" (instead of the encrypted password
and aging information) in the pw_passwd field. The same applies for
calls to when the argument stream is set to
SECURITY FEATURES
If the system has been converted to a trusted system, the password,
audit ID, and audit flag are not returned. The password will be the
default that is in and the audit ID and audit flag will be set to On
trusted systems, if it is not necessary to obtain information from the
regular password file, users should use to access the protected pass‐
word database. See getprpwent(3) and getspwent(3X).
affects only and the audit ID and audit flag in the password structure
are ignored. must be used to modify the protected password database
entries. See getprpwent(3).
See about trusted system support.
RETURN VALUE
and return a NULL pointer if an end-of-file or error is encountered on
reading. returns a NULL pointer on encountering an invalid entry. An
invalid entry is one which does not follow the structure. Otherwise,
the return value points to an internal static area containing a valid
structure.
and return zero upon success. Otherwise, an error number is returned
to indicate the error.
ERRORS
and fail if any of the following are true:
An I/O error has occurred.
OPEN_MAX descriptors are currently open in the calling
process.
The maximum allowable number of files is currently open in the
system.
The and functions will fail if:
Insufficient storage was supplied via
buffer and bufsize to contain the data to be refer‐
enced by the resulting structure
WARNINGS
The value returned by and points to a single static area that is over‐
written by each call to any of the functions, so it must be copied if
it is to be saved.
The following fields have numerical limitations as noted:
· The user ID is an integer value between -2 and inclusive.
· The group ID is an integer value between 0 and inclusive.
Users of and should note that these interfaces now conform with
POSIX.1c. and are obsolescent interfaces. These interfaces and the
old prototypes of and are supported for compatibility with existing DCE
applications only.
The interfaces and use the Dynamic Name Service Switch. See nss‐
witch.conf(4). An application that uses these interfaces cannot be
fully archive bound.
HP-UX 11i Version 3 is the last release to support trusted systems
functionality.
EXAMPLE
The following code excerpt prints name and uid of a user logged in on
this terminal:
DEPENDENCIES
NFS
AUTHOR
and were developed by Sun and HP.
FILES
System Password file
SEE ALSOypcat(1), cuserid(3S), getgrent(3C), getlogin(3C), getprpwent(3), get‐
spwent(3X), stdio(3S), putpwent(3C), nsswitch.conf(4), passwd(4), lim‐
its(5), thread_safety(5).
STANDARDS CONFORMANCEgetpwent(3C)