Commit | Line | Data |
---|---|---|
ae59e04c CL |
1 | .\" Copyright (c) 1989, 1991 The Regents of the University of California. |
2 | .\" All rights reserved. | |
0adf1b99 | 3 | .\" |
ae59e04c CL |
4 | .\" %sccs.include.redist.man% |
5 | .\" | |
9e0f9f92 | 6 | .\" @(#)getpass.3 6.6 (Berkeley) %G% |
ae59e04c CL |
7 | .\" |
8 | .Dd | |
9 | .Dt GETPASS 3 | |
10 | .Os | |
11 | .Sh NAME | |
12 | .Nm getpass | |
13 | .Nd get a password | |
14 | .Sh SYNOPSIS | |
913ee8ae | 15 | .Fd #include <pwd.h> |
ae59e04c CL |
16 | .Fd #include <unistd.h> |
17 | .Ft char * | |
18 | .Fn getpass "const char *prompt" | |
19 | .Sh DESCRIPTION | |
20 | The | |
21 | .Fn getpass | |
c8328751 | 22 | function displays a prompt to, and reads in a password from, |
ae59e04c | 23 | .Pa /dev/tty . |
c8328751 KB |
24 | If this file is not accessible, |
25 | .Nm getpass | |
26 | displays the prompt on the standard error output and reads from the standard | |
27 | input. | |
28 | .Pp | |
913ee8ae KB |
29 | The password may be up to _PASSWORD_LEN (currently 128) |
30 | characters in length. | |
31 | Any additional | |
c8328751 KB |
32 | characters and the terminating newline character are discarded. |
33 | .Pp | |
34 | .Nm Getpass | |
35 | turns off character echoing while reading the password. | |
ae59e04c CL |
36 | .Pp |
37 | .Sh RETURN VALUES | |
c8328751 KB |
38 | .Nm Getpass |
39 | returns a pointer to the null terminated password. | |
ae59e04c CL |
40 | .Sh FILES |
41 | .Bl -tag -width /dev/tty - compact | |
42 | .It Pa /dev/tty | |
43 | .El | |
44 | .Sh SEE ALSO | |
45 | .Xr crypt 3 | |
46 | .Sh HISTORY | |
47 | A | |
c8328751 | 48 | .Nm getpass |
ae59e04c CL |
49 | function appeared in |
50 | .At v7 . | |
51 | .Sh BUGS | |
52 | The | |
c8328751 | 53 | .Nm getpass |
ae59e04c | 54 | function leaves its result in an internal static object and returns |
c8328751 KB |
55 | a pointer to that object. |
56 | Subsequent calls to | |
57 | .Nm getpass | |
ae59e04c | 58 | will modify the same object. |
c8328751 KB |
59 | .Pp |
60 | The calling process should zero the password as soon as possible to | |
61 | avoid leaving the cleartext password visible in the process's address | |
62 | space. |