*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Linux man pages -> getpw (3)              
Title
Content
Arch
Section
 

GETPW(3)

Contents


NAME    [Toc]    [Back]

       getpw - Re-construct password line entry

SYNOPSIS    [Toc]    [Back]

       #include <pwd.h>
       #include <sys/types.h>

       int getpw(uid_t uid, char *buf);

DESCRIPTION    [Toc]    [Back]

       The  getpw()  function  re-constructs  the  password line entry for the
       given user uid uid in the buffer buf.  The returned buffer  contains  a
       line of format

	      name:passwd:uid:gid:gecos:dir:shell

       The passwd structure is defined in <pwd.h> as follows:

	      struct passwd {
		      char    *pw_name;       /* user name */
		      char    *pw_passwd;     /* user password */
		      uid_t   pw_uid;	      /* user id */
		      gid_t   pw_gid;	      /* group id */
		      char    *pw_gecos;      /* real name */
		      char    *pw_dir;	      /* home directory */
		      char    *pw_shell;      /* shell program */
	      };

RETURN VALUE    [Toc]    [Back]

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

ERRORS    [Toc]    [Back]

       ENOMEM Insufficient memory to allocate passwd structure.

FILES    [Toc]    [Back]

       /etc/passwd
	      password database file

CONFORMING TO    [Toc]    [Back]

       SYSVr2.

BUGS    [Toc]    [Back]

       The  getpw()  function  is  dangerous  as  it may overflow the provided
       buffer buf.  It is obsoleted by getpwuid().

SEE ALSO    [Toc]    [Back]

      
      
       fgetpwent(3), getpwent(3), setpwent(3), endpwent(3), getpwnam(3), getp-
       wuid(3), putpwent(3), passwd(5)



GNU				  1996-05-27			      GETPW(3)
[ Back ]
 Similar pages
Name OS Title
getpwent Linux get password file entry
getpwnam Linux get password file entry
getpwent IRIX get password file entry
fgetpwent Linux get password file entry
putpwent IRIX write password file entry
putpwent Linux write a password file entry
putspent IRIX write shadow password file entry
getspent IRIX manipulate shadow password file entry
getespwent Tru64 Manipulate protected password database entry (Enhanced Security)
getespwuid Tru64 Manipulate protected password database entry (Enhanced Security)
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service