148352Scael.\" Copyright (c) 1989, 1991 The Regents of the University of California. 248352Scael.\" All rights reserved. 320337Smckusick.\" 448352Scael.\" %sccs.include.redist.man% 548352Scael.\" 6*48488Sbostic.\" @(#)getpass.3 6.4 (Berkeley) 04/21/91 748352Scael.\" 848352Scael.Dd 948352Scael.Dt GETPASS 3 1048352Scael.Os 1148352Scael.Sh NAME 1248352Scael.Nm getpass 1348352Scael.Nd get a password 1448352Scael.Sh SYNOPSIS 1548352Scael.Fd #include <unistd.h> 1648352Scael.Ft char * 1748352Scael.Fn getpass "const char *prompt" 1848352Scael.Sh DESCRIPTION 1948352ScaelThe 2048352Scael.Fn getpass 21*48488Sbosticfunction displays a prompt to, and reads in a password from, 2248352Scael.Pa /dev/tty . 23*48488SbosticIf this file is not accessible, 24*48488Sbostic.Nm getpass 25*48488Sbosticdisplays the prompt on the standard error output and reads from the standard 26*48488Sbosticinput. 2748352Scael.Pp 28*48488SbosticThe password may be up to 128 characters in length; any additional 29*48488Sbosticcharacters and the terminating newline character are discarded. 30*48488Sbostic.Pp 31*48488Sbostic.Nm Getpass 32*48488Sbosticturns off character echoing while reading the password. 33*48488Sbostic.Pp 3448352Scael.Sh RETURN VALUES 35*48488Sbostic.Nm Getpass 36*48488Sbosticreturns a pointer to the null terminated password. 3748352Scael.Sh FILES 3848352Scael.Bl -tag -width /dev/tty - compact 3948352Scael.It Pa /dev/tty 4048352Scael.El 4148352Scael.Sh SEE ALSO 4248352Scael.Xr crypt 3 4348352Scael.Sh HISTORY 4448352ScaelA 45*48488Sbostic.Nm getpass 4648352Scaelfunction appeared in 4748352Scael.At v7 . 4848352Scael.Sh BUGS 4948352ScaelThe 50*48488Sbostic.Nm getpass 5148352Scaelfunction leaves its result in an internal static object and returns 52*48488Sbostica pointer to that object. 53*48488SbosticSubsequent calls to 54*48488Sbostic.Nm getpass 5548352Scaelwill modify the same object. 56*48488Sbostic.Pp 57*48488SbosticThe calling process should zero the password as soon as possible to 58*48488Sbosticavoid leaving the cleartext password visible in the process's address 59*48488Sbosticspace. 60