summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/os
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/krb5/os')
-rw-r--r--src/lib/krb5/os/ChangeLog6
-rw-r--r--src/lib/krb5/os/read_pwd.c14
2 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog
index 5f5bf002c5..7e80873fe5 100644
--- a/src/lib/krb5/os/ChangeLog
+++ b/src/lib/krb5/os/ChangeLog
@@ -1,3 +1,9 @@
+2002-10-11 Tom Yu <tlyu@mit.edu>
+
+ * read_pwd.c (krb5_read_password): Restore name of size_return.
+ Set *size_return after successful call to krb5_prompter_posix,
+ since some callers were actually checking, e.g. kadm5.
+
2002-10-10 Sam Hartman <hartmans@mit.edu>
* read_pwd.c (krb5_read_password): Reimplement in terms of krb5_prompter_posix for unix
diff --git a/src/lib/krb5/os/read_pwd.c b/src/lib/krb5/os/read_pwd.c
index e113df469e..73a3670f1c 100644
--- a/src/lib/krb5/os/read_pwd.c
+++ b/src/lib/krb5/os/read_pwd.c
@@ -41,12 +41,12 @@
#endif /* ECHO_PASSWORD */
krb5_error_code
-krb5_read_password(krb5_context context, const char *prompt, const char *prompt2, char *return_pwd, unsigned int *bufsize_in)
+krb5_read_password(krb5_context context, const char *prompt, const char *prompt2, char *return_pwd, unsigned int *size_return)
{
krb5_data reply_data;
krb5_prompt k5prompt;
krb5_error_code retval;
- reply_data.length = *bufsize_in;
+ reply_data.length = *size_return; /* NB: size_return is also an input */
reply_data.data = return_pwd;
k5prompt.prompt = (const char *) prompt;
k5prompt.hidden = 1;
@@ -56,8 +56,8 @@ krb5_read_password(krb5_context context, const char *prompt, const char *prompt2
if ((retval==0) && prompt2) {
krb5_data verify_data;
- verify_data.data = malloc(*bufsize_in);
- verify_data.length = *bufsize_in;
+ verify_data.data = malloc(*size_return);
+ verify_data.length = *size_return;
k5prompt.prompt = (const char *) prompt2;
k5prompt.reply = &verify_data;
if (!verify_data.data)
@@ -68,12 +68,16 @@ krb5_read_password(krb5_context context, const char *prompt, const char *prompt2
free(verify_data.data);
} else {
/* compare */
- if (strncmp(return_pwd, (char *)verify_data.data, *bufsize_in)) {
+ if (strncmp(return_pwd, (char *)verify_data.data, *size_return)) {
retval = KRB5_LIBOS_BADPWDMATCH;
free(verify_data.data);
}
}
}
+ if (!retval)
+ *size_return = k5prompt.reply->length;
+ else
+ memset(return_pwd, 0, *size_return);
return retval;
}
#endif