1*61111Sbostic.\" Copyright (c) 1989, 1991, 1993 2*61111Sbostic.\" The Regents of the University of California. All rights reserved. 320337Smckusick.\" 448352Scael.\" %sccs.include.redist.man% 548352Scael.\" 6*61111Sbostic.\" @(#)getpass.3 8.1 (Berkeley) 06/04/93 748352Scael.\" 848352Scael.Dd 948352Scael.Dt GETPASS 3 1048352Scael.Os 1148352Scael.Sh NAME 1248352Scael.Nm getpass 1348352Scael.Nd get a password 1448352Scael.Sh SYNOPSIS 1549829Sbostic.Fd #include <pwd.h> 1648352Scael.Fd #include <unistd.h> 1748352Scael.Ft char * 1848352Scael.Fn getpass "const char *prompt" 1948352Scael.Sh DESCRIPTION 2048352ScaelThe 2148352Scael.Fn getpass 2248488Sbosticfunction displays a prompt to, and reads in a password from, 2348352Scael.Pa /dev/tty . 2448488SbosticIf this file is not accessible, 2548488Sbostic.Nm getpass 2648488Sbosticdisplays the prompt on the standard error output and reads from the standard 2748488Sbosticinput. 2848352Scael.Pp 2949829SbosticThe password may be up to _PASSWORD_LEN (currently 128) 3049829Sbosticcharacters in length. 3149829SbosticAny additional 3248488Sbosticcharacters and the terminating newline character are discarded. 3348488Sbostic.Pp 3448488Sbostic.Nm Getpass 3548488Sbosticturns off character echoing while reading the password. 3648488Sbostic.Pp 3748352Scael.Sh RETURN VALUES 3848488Sbostic.Nm Getpass 3948488Sbosticreturns a pointer to the null terminated password. 4048352Scael.Sh FILES 4148352Scael.Bl -tag -width /dev/tty - compact 4248352Scael.It Pa /dev/tty 4348352Scael.El 4448352Scael.Sh SEE ALSO 4548352Scael.Xr crypt 3 4648352Scael.Sh HISTORY 4748352ScaelA 4848488Sbostic.Nm getpass 4948352Scaelfunction appeared in 5048352Scael.At v7 . 5148352Scael.Sh BUGS 5248352ScaelThe 5348488Sbostic.Nm getpass 5448352Scaelfunction leaves its result in an internal static object and returns 5548488Sbostica pointer to that object. 5648488SbosticSubsequent calls to 5748488Sbostic.Nm getpass 5848352Scaelwill modify the same object. 5948488Sbostic.Pp 6048488SbosticThe calling process should zero the password as soon as possible to 6148488Sbosticavoid leaving the cleartext password visible in the process's address 6248488Sbosticspace. 63