From: John Kohl Date: Tue, 1 May 1990 14:16:59 +0000 (+0000) Subject: need to read password if not provided X-Git-Tag: krb5-1.0-alpha2~761 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5b6f17280ecc3d9d4557042a87aef3e8d4434a15;p=krb5.git need to read password if not provided git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@635 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/in_tkt_pwd.c b/src/lib/krb5/krb/in_tkt_pwd.c index 460455b58..9b9370180 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 #include #include +#include +#include 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,