diff options
author | John Kohl <jtkohl@mit.edu> | 1990-05-01 14:16:59 +0000 |
---|---|---|
committer | John Kohl <jtkohl@mit.edu> | 1990-05-01 14:16:59 +0000 |
commit | 5b6f17280ecc3d9d4557042a87aef3e8d4434a15 (patch) | |
tree | 7a58c59ea29a7d422d5aae11ff2502510ec4a81e /src/lib/krb5/krb/in_tkt_pwd.c | |
parent | a91000e0f10995ce2c06a042ad5c4b58090696a5 (diff) | |
download | krb5-5b6f17280ecc3d9d4557042a87aef3e8d4434a15.zip krb5-5b6f17280ecc3d9d4557042a87aef3e8d4434a15.tar.gz krb5-5b6f17280ecc3d9d4557042a87aef3e8d4434a15.tar.bz2 |
need to read password if not provided
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@635 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/krb/in_tkt_pwd.c')
-rw-r--r-- | src/lib/krb5/krb/in_tkt_pwd.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/lib/krb5/krb/in_tkt_pwd.c b/src/lib/krb5/krb/in_tkt_pwd.c index 460455b..9b93701 100644 --- a/src/lib/krb5/krb/in_tkt_pwd.c +++ b/src/lib/krb5/krb/in_tkt_pwd.c @@ -20,12 +20,16 @@ static char rcsid_in_tkt_pwd_c[] = #include <krb5/krb5_err.h> #include <errno.h> #include <krb5/ext-proto.h> +#include <stdio.h> +#include <krb5/libos-proto.h> struct pwd_keyproc_arg { krb5_principal who; krb5_data password; }; +extern char *krb5_default_pwd_prompt1, *krb5_default_pwd_prompt2; + /* * key-producing procedure for use by krb5_get_in_tkt_with_password. */ @@ -40,14 +44,25 @@ OLDDECLARG(krb5_pointer, keyseed) { krb5_error_code retval; struct pwd_keyproc_arg *arg; + char pwdbuf[BUFSIZ]; + int pwsize = sizeof(pwdbuf); if (!valid_keytype(type)) return KRB5_PROG_KEYTYPE_NOSUPP; + + arg = (struct pwd_keyproc_arg *)keyseed; + if (!arg->password.length) { + if (retval = krb5_read_password(krb5_default_pwd_prompt1, + krb5_default_pwd_prompt2, + pwdbuf, &pwsize)) + return retval; + arg->password.length = pwsize; + arg->password.data = pwdbuf; + } *key = (krb5_keyblock *)malloc(sizeof(**key)); if (!*key) return ENOMEM; - arg = (struct pwd_keyproc_arg *)keyseed; if (retval = (*krb5_keytype_array[type]->system-> string_to_key)(type, *key, @@ -100,7 +115,10 @@ OLDDECLARG(krb5_creds *, creds) keyseed.password.data = (char *)password; - keyseed.password.length = strlen(password); + if (password) + keyseed.password.length = strlen(password); + else + keyseed.password.length = 0; keyseed.who = creds->client; retval = krb5_get_in_tkt(options, addrs, etype, keytype, pwd_keyproc, |