skip book previous and next navigation links
go up to top of book: HP Open Source Security for OpenVMS Volume 3:... HP Open Source Security for OpenVMS Volume 3:...
go to beginning of chapter: KRB5 (Kerberos V5) Application Programming Interface KRB5 (Kerberos V5) Application Programming Interface
go to previous page: krb5_rd_safe  Parse a KRB_SAFE message krb5_rd_safe Parse a KRB_SAFE message
go to next page: krb5_realm_compare  Compare the realms of two principalskrb5_realm_compare Compare the realms of two principals
end of book navigation links

krb5_read_password -- Read a password from the keyboard  



C Prototype 

krb5_error_code krb5_read_password(
         krb5_context     context,
         const char       *prompt,
         const char       *prompt2,
         char             *return_pwd,
         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.



go to previous page: krb5_rd_safe  Parse a KRB_SAFE message krb5_rd_safe Parse a KRB_SAFE message
go to next page: krb5_realm_compare  Compare the realms of two principalskrb5_realm_compare Compare the realms of two principals