summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/gen/getpass.347
1 files changed, 41 insertions, 6 deletions
diff --git a/lib/libc/gen/getpass.3 b/lib/libc/gen/getpass.3
index 8cebb5dca72..2d77ffb8d16 100644
--- a/lib/libc/gen/getpass.3
+++ b/lib/libc/gen/getpass.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: getpass.3,v 1.8 2001/02/10 06:04:31 aaron Exp $
+.\" $OpenBSD: getpass.3,v 1.9 2001/12/07 23:56:09 millert Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd June 4, 1993
+.Dd December 7, 2001
.Dt GETPASS 3
.Os
.Sh NAME
@@ -52,9 +52,11 @@ If this file is not accessible,
displays the prompt on the standard error output and reads from the standard
input.
.Pp
-The password may be up to _PASSWORD_LEN (currently 128, as defined in
-the include file
-.Aq Pa pwd.h )
+The password may be up to
+.Dv _PASSWORD_LEN
+(currently 128, as defined in the
+.Aq Pa pwd.h
+include file)
characters in length.
Any additional
characters and the terminating newline character are discarded.
@@ -66,8 +68,28 @@ The calling process should zero the password as soon as possible to
avoid leaving the cleartext password visible in the process's address
space.
.Sh RETURN VALUES
+Upon successful completion,
.Fn getpass
-returns a pointer to the null-terminated password.
+returns a pointer to a null-terminated string of at most
+.Dv _PASSWORD_LEN
+characters.
+If an error is encountered, the terminal state is restored and
+a null pointer is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EINTR
+The
+.Fn getpass
+function was interrupted by a signal.
+.It Bq Er EIO
+The process is a member of a background process attempting to read
+from its controlling terminal, the process is ignoring or blocking
+the SIGTTIN signal or the process group is orphaned.
+.It Bq Er EMFILE
+The process has already reached its limit for open file descriptors.
+.It Bq Er ENFILE
+The system file table is full.
+.El
.Sh FILES
.Bl -tag -width /dev/tty -compact
.It Pa /dev/tty
@@ -75,6 +97,19 @@ returns a pointer to the null-terminated password.
.Sh SEE ALSO
.Xr crypt 3 ,
.Xr readpassphrase 3
+.Sh STANDARDS
+Historically,
+.Bx
+versions of
+.Fn getpass
+have accepted a password on the standard input if
+.Pa /dev/tty
+is unavailable.
+This contradicts
+.St -xpg4.2
+but the
+.Ox
+implementation is conformant in all other respects.
.Sh HISTORY
A
.Fn getpass