GETPASSWD(S) UNIX System V GETPASSWD(S)
Name
getpasswd - read or clear a password
Syntax
#include <sys/types.h>
#include <sys/security.h>
#include <sys/audit.h>
#include <prot.h>
char *getpasswd (prompt, max_size)
char *prompt;
int max_size;
(void) getpasswd ((char *) 0, max_size)
char *prompt;
int max_size;
Description
Getpasswd, when given a non-NULL and null-terminated prompt,
reads up to a newline or EOF from the file /dev/tty, after
prompting on the standard error output with prompt and
disabling echoing. A pointer is returned to a null-
terminated string of at most max_size characters. If
/dev/tty cannot be opened, a NULL pointer is returned. An
interrupt will terminate input and send an interrupt signal
to the calling program before returning.
The returned pointer above points to a static area. As soon
as that password is no longer needed, getpasswd should again
be invoked with a NULL prompt string. That will clear the
password in the static area so that there is no chance of
`dirty memory' revealing passwords later on.
The standardgetpass(S) routine may be implemented as:
char *
getpass (prompt)
char *prompt;
{
return getpasswd(prompt, 8);
}
Files
/dev/tty
See Also
getpass(S)
Notes
The return value points to static data whose content is
overwritten by each call.
Value Added
getpasswd is an extension of AT&T System V provided by the
Santa Cruz Operation.
(printed 6/20/89)