1GETPW(3)                   Linux Programmer's Manual                  GETPW(3)
2
3
4

NAME

6       getpw - Re-construct password line entry
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <pwd.h>
11
12       int getpw(uid_t uid, char *buf);
13

DESCRIPTION

15       The  getpw()  function  re-constructs  the  password line entry for the
16       given user ID uid in the buffer buf.  The returned  buffer  contains  a
17       line of format
18
19              name:passwd:uid:gid:gecos:dir:shell
20
21       The passwd structure is defined in <pwd.h> as follows:
22
23              struct passwd {
24                      char    *pw_name;       /* user name */
25                      char    *pw_passwd;     /* user password */
26                      uid_t   pw_uid;         /* user ID */
27                      gid_t   pw_gid;         /* group ID */
28                      char    *pw_gecos;      /* real name */
29                      char    *pw_dir;        /* home directory */
30                      char    *pw_shell;      /* shell program */
31              };
32

RETURN VALUE

34       The getpw() function returns 0 on success, or -1 if an error occurs.
35

ERRORS

37       ENOMEM Insufficient memory to allocate passwd structure.
38

FILES

40       /etc/passwd
41              password database file
42

CONFORMING TO

44       SVr2.
45

BUGS

47       The  getpw() function is dangerous as it may overflow the provided buf‐
48       fer buf.  It is obsoleted by getpwuid().
49

SEE ALSO

51       endpwent(3), fgetpwent(3), getpwent(3), getpwnam(3), getpwuid(3), putp‐
52       went(3), setpwent(3), passwd(5)
53
54
55
56GNU                               1996-05-27                          GETPW(3)
Impressum