.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified Sat Jul 24 19:23:25 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified Mon May 27 21:37:47 1996 by Martin Schulze (joey@linux.de) .\" Translated into Spanish Thu Jan 29 1998 by .\" Gerardo Aburruzaga García .\" Translation revised Tue Apr 18 2000 by Juan Piernas .\" .TH GETPW 3 "27 mayo 1996" "GNU" "Manual del Programador de Linux" .SH NOMBRE getpw \- Re-construye una línea del fichero de cuentas de usuario .SH SINOPSIS .nf .B #include .B #include .sp .BI "int getpw(uid_t " uid ", char *" buf ); .fi .SH DESCRIPCIÓN La función \fBgetpw()\fP reconstruye la línea del fichero de cuentas de usuario para el usuario cuyo UID se da como \fIuid\fP y el resultado se guarda en el sitio apuntado por \fIbuf\fP. El búfer devuelto en \fIbuf\fP contiene una línea con el formato .sp .RS .B nombre:contraseña:uid:gid:gecos:dir:shell .RE .PP La estructura \fIpasswd\fP se define en \fI\fP como sigue: .sp .RS .nf .ta 8n 16n 32n struct passwd { char *pw_name; /* nombre de usuario */ char *pw_passwd; /* contraseña cifrada */ uid_t pw_uid; /* id. del usuario */ gid_t pw_gid; /* id. del grupo primario */ char *pw_gecos; /* nombre real */ char *pw_dir; /* directorio de inicio */ char *pw_shell; /* programa caparazón */ }; .ta .fi .RE .SH "VALOR DEVUELTO" La función \fBgetpw()\fP devuelve 0 si acaba bien, o \-1 si ocurre un error. .SH ERRORES .TP .B ENOMEM Memoria insuficiente para alojar la estructura passwd. .SH FICHEROS .TP .I /etc/passwd fichero de datos de cuentas de usuario .SH "CONFORME A" SYSVr2. .SH FALLOS La función .BR getpw () es peligrosa ya que puede desbordar el búfer proporcionado, .IR buf . Está obsoleta y en su lugar debería utilizar .BR getpwuid (). .SH "VÉASE TAMBIÉN" .BR fgetpwent (3), .BR getpwent (3), .BR setpwent (3), .BR endpwent (3), .BR getpwnam (3), .BR getpwuid (3), .BR putpwent (3), .BR passwd (5)