HP Open Source Security for OpenVMS Volume 3: Kerberos > Chapter 6 KRB5 (Kerberos V5) Application Programming Interface

krb5_read_password — Read a password from the keyboard

 » Table of Contents

 » Glossary

 » Index

C Prototype

krb5_error_code krb5_read_password(
krb5_context context,
const char *prompt,
const char *prompt2,
char *return_pwd,
unsigned int *size_return );

Arguments

context (input) 

The context structure.

prompt (input) 

First user prompt when reading password.

prompt2 (input)  

Second user prompt, or NULL to read the password only once.

return_pwd (output) 

The returned password.

size_return (input/output) 

On input, the maximum size of the password to be returned. On output, the total number of bytes returned in return_pwd.

Description

This routine reads a password from the keyboard. The first *size_return bytes of the password entered are returned in return_pwd. If fewer than *size_return bytes are typed as a password, the remainder of return_pwd is zeroed. Upon success, the total number of bytes filled in is stored in *size_return.

The prompt argument is used as the prompt for the first reading of a password. It is printed to the terminal, and then a password is read from the keyboard. No newline or spaces are emitted between the prompt and the cursor, unless the newline/space is included in the prompt.

If prompt2 is a NULL pointer, then the password is read once.

If prompt2 is set, then it is used as a prompt to read another password in the same manner as described for prompt. After the second password is read, the two passwords are compared, and an error is returned if they are not identical.

Echoing is turned off when the password is read.

Return Values

This routine returns one of the following KRB5 status codes:

0

Successful completion.

Error in reading or verifying the password.