Skip to content

Commit

Permalink
Allow batch mode in kinit with password file
Browse files Browse the repository at this point in the history
  • Loading branch information
nicowilliams committed Aug 12, 2013
1 parent f32b34e commit fc728f2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions kuser/kinit.c
Expand Up @@ -363,12 +363,16 @@ get_new_tickets(krb5_context context,
krb5_ccache tempccache = NULL;
krb5_init_creds_context ctx = NULL;
krb5_get_init_creds_opt *opt = NULL;
krb5_prompter_fct prompter = krb5_prompter_posix;
#ifndef NO_NTLM
struct ntlm_buf ntlmkey;
memset(&ntlmkey, 0, sizeof(ntlmkey));
#endif
passwd[0] = '\0';

if (!interactive)
prompter = NULL;

if (password_file) {
FILE *f;

Expand Down Expand Up @@ -454,7 +458,7 @@ get_new_tickets(krb5_context context,
NULL,
pk_use_enckey ? 2 : 0 |
anonymous_flag ? 4 : 0,
krb5_prompter_posix,
prompter,
NULL,
passwd);
if (ret) {
Expand Down Expand Up @@ -509,7 +513,7 @@ get_new_tickets(krb5_context context,
etype_str.num_strings);
}

ret = krb5_init_creds_init(context, principal, krb5_prompter_posix, NULL, start_time, opt, &ctx);
ret = krb5_init_creds_init(context, principal, prompter, NULL, start_time, opt, &ctx);
if (ret) {
krb5_warn(context, ret, "krb5_init_creds_init");
goto out;
Expand Down Expand Up @@ -547,7 +551,7 @@ get_new_tickets(krb5_context context,
}
} else if (pk_user_id || ent_user_id || anonymous_flag) {

} else if (!interactive) {
} else if (!interactive && passwd[0] == '\0') {
static int already_warned = 0;

if (!already_warned)
Expand Down

0 comments on commit fc728f2

Please sign in to comment.