getpass.3 (712dc76e87bd7bbeb3f781e690886b69a1f9c5ca) getpass.3 (bf5a138ec42c842d9402e45de366f7b71e267e42)
1.\" Copyright (c) 1989, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 34 unchanged lines hidden (view full) ---

43.Ft char *
44.Fn getpass "const char *prompt"
45.Sh DESCRIPTION
46The
47.Fn getpass
48function displays a prompt to, and reads in a password from,
49.Pa /dev/tty .
50If this file is not accessible,
1.\" Copyright (c) 1989, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 34 unchanged lines hidden (view full) ---

43.Ft char *
44.Fn getpass "const char *prompt"
45.Sh DESCRIPTION
46The
47.Fn getpass
48function displays a prompt to, and reads in a password from,
49.Pa /dev/tty .
50If this file is not accessible,
51.Nm getpass
51.Fn getpass
52displays the prompt on the standard error output and reads from the standard
53input.
54.Pp
55The password may be up to _PASSWORD_LEN (currently 128)
56characters in length.
57Any additional
58characters and the terminating newline character are discarded.
59.Pp
52displays the prompt on the standard error output and reads from the standard
53input.
54.Pp
55The password may be up to _PASSWORD_LEN (currently 128)
56characters in length.
57Any additional
58characters and the terminating newline character are discarded.
59.Pp
60.Nm Getpass
61turns off character echoing while reading the password.
60The
61.Fn getpass
62function turns off character echoing while reading the password.
62.Pp
63.Sh RETURN VALUES
63.Pp
64.Sh RETURN VALUES
64.Nm Getpass
65returns a pointer to the null terminated password.
65The
66.Fn getpass
67function returns a pointer to the null terminated password.
66.Sh FILES
67.Bl -tag -width /dev/tty -compact
68.It Pa /dev/tty
69.El
70.Sh SEE ALSO
71.Xr crypt 3
72.Sh HISTORY
73A
68.Sh FILES
69.Bl -tag -width /dev/tty -compact
70.It Pa /dev/tty
71.El
72.Sh SEE ALSO
73.Xr crypt 3
74.Sh HISTORY
75A
74.Nm getpass
76.Fn getpass
75function appeared in
76.At v7 .
77.Sh BUGS
78The
77function appeared in
78.At v7 .
79.Sh BUGS
80The
79.Nm getpass
81.Fn getpass
80function leaves its result in an internal static object and returns
81a pointer to that object.
82Subsequent calls to
82function leaves its result in an internal static object and returns
83a pointer to that object.
84Subsequent calls to
83.Nm getpass
85.Fn getpass
84will modify the same object.
85.Pp
86The calling process should zero the password as soon as possible to
87avoid leaving the cleartext password visible in the process's address
88space.
89.Pp
90Upon receipt of a SIGTSTP, the input buffer will be flushed, so any
91partially typed password must be retyped when the process
92continues.
86will modify the same object.
87.Pp
88The calling process should zero the password as soon as possible to
89avoid leaving the cleartext password visible in the process's address
90space.
91.Pp
92Upon receipt of a SIGTSTP, the input buffer will be flushed, so any
93partially typed password must be retyped when the process
94continues.