Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (g - h) getpwnam(3)
NAME
getpwnam - Gets user attribute information from the user database
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZSECSRL
G-series native OSS processes: /G/system/sysnn/zsecsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZSECDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zsecdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ysecdll |
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <pwd.h>
struct passwd getpwnam(
const char name);
PARAMETERS
name Specifies the username of the user whose user attributes are to be returned.
DESCRIPTION
The getpwnam( ) function returns information about a user from the user authentication database
when the pw_name field in the database entry matches the username specified by the name
parameter.
User Structure
The user passwd structure returned by the getpwnam( ) function is defined in the pwd.h header
file. The structure contains the following fields:
pw_name The user login name.
pw_passwd The current user password (not returned).
pw_uid The user ID of the user.
pw_gid The group ID of the primary group of the user.
pw_age The password aging string (not returned).
pw_comment Comment string (not returned).
pw_gecos Personal information about the user (not returned).
pw_dir The home directory of the user.
pw_shell The initial program for the user.
The pw_passwd, pw_age, pw_comment, and pw_gecos fields are provided for compatibility
with some versions of UNIX, but these fields always contain null strings.
Database Structure and Access
Traditional UNIX implementations access user and group information by sequentially reading
unstructured files. In contrast, an HP NonStop server node stores user and group information in
structured, key-sequenced, Enscribe files. User information is accessed using a primary or alter-
nate key. A username or user ID can be specified as a key.
Sequential access to user information is supported by storing the most recently used key in static
storage. The setpwent( ) function resets this key. The endpwent( ) function satisfies references
when linking user applications.
527187-017 Hewlett-Packard Company 3123