diff options
author | Ezra Peisach <epeisach@mit.edu> | 2000-03-16 14:57:59 +0000 |
---|---|---|
committer | Ezra Peisach <epeisach@mit.edu> | 2000-03-16 14:57:59 +0000 |
commit | 817567e5e8b551c5f98aab35827f5317c3b552fd (patch) | |
tree | ebfabd8ce4e496d01c1592b7c879709799cfd5c2 /src | |
parent | d88c5a0fb51d749d64a8e7ddfd36b049c4f0ae5f (diff) | |
download | krb5-817567e5e8b551c5f98aab35827f5317c3b552fd.tar.gz krb5-817567e5e8b551c5f98aab35827f5317c3b552fd.tar.xz krb5-817567e5e8b551c5f98aab35827f5317c3b552fd.zip |
* kinit.c (k4_kinit): Fix the code that was broken with
krb5_get_prompt_types code changes. Also - cleanup unused
variables when krb4 not compiled in.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12122 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r-- | src/clients/kinit/ChangeLog | 8 | ||||
-rw-r--r-- | src/clients/kinit/kinit.c | 23 |
2 files changed, 25 insertions, 6 deletions
diff --git a/src/clients/kinit/ChangeLog b/src/clients/kinit/ChangeLog index b4a79a0029..8939718916 100644 --- a/src/clients/kinit/ChangeLog +++ b/src/clients/kinit/ChangeLog @@ -1,4 +1,10 @@ -2000-03-15 Danilo Almeida <dalmeida@mit.edu> +2000-03-16 Ezra Peisach <epeisach@mit.edu> + + * kinit.c (k4_kinit): Fix the code that was broken with + krb5_get_prompt_types code changes. Also - cleanup unused + variables when krb4 not compiled in. + +2000-03-15 Danilo Almeida <dalmeida@mit.edu > * kinit.c: Add support for krb5_get_prompt_types. diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c index a78be21bb7..f9245a86cd 100644 --- a/src/clients/kinit/kinit.c +++ b/src/clients/kinit/kinit.c @@ -94,8 +94,10 @@ char * get_name_from_os() static char *progname; static char* progname_v5 = 0; +#ifdef KRB5_KRB4_COMPAT static char* progname_v4 = 0; static char* progname_v524 = 0; +#endif static int got_k5 = 0; static int got_k4 = 0; @@ -273,8 +275,6 @@ parse_options(argc, argv, opts) int errflg = 0; int use_k4 = 0; int use_k5 = 0; - int have_k4 = got_k4; - int have_k5 = got_k5; int i; while ((i = GETOPT(argc, argv, "r:fpFP54AVl:s:c:kt:RS:v")) @@ -591,8 +591,10 @@ k4_begin(opts, k4) struct k_opts* opts; struct k4_data* k4; { +#ifdef KRB5_KRB4_COMPAT char* progname = progname_v4; int k_errno = 0; +#endif if (!got_k4) return 0; @@ -679,8 +681,10 @@ k4_end(k4) memset(k4, 0, sizeof(*k4)); } +#ifdef KRB5_KRB4_COMPAT static char stash_password[1024]; static int got_password = 0; +#endif /* KRB5_KRB4_COMPAT */ krb5_error_code KRB5_CALLCONV @@ -702,9 +706,11 @@ kinit_prompter( if ((types[i] == KRB5_PROMPT_TYPE_PASSWORD) || (types[i] == KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN)) { +#ifdef KRB5_KRB4_COMPAT strncpy(stash_password, prompts[i].reply->data, sizeof(stash_password)); got_password = 1; +#endif } return rc; } @@ -857,8 +863,10 @@ k4_kinit(opts, k4, ctx) struct k4_data* k4; krb5_context ctx; { +#ifdef KRB5_KRB4_COMPAT char* progname = progname_v4; int k_errno = 0; +#endif if (!got_k4) return 0; @@ -884,9 +892,10 @@ k4_kinit(opts, k4, ctx) if (!got_password) { int pwsize = sizeof(stash_password); krb5_error_code code; + char prompt[1024]; - sprintf(prompt, "Password for %s: ", opts.principal_name); - password[0] = 0; + sprintf(prompt, "Password for %s: ", opts->principal_name); + stash_password[0] = 0; /* Note: krb5_read_password does not actually look at the context, so we're ok even if we don't have a context. If @@ -897,7 +906,7 @@ k4_kinit(opts, k4, ctx) if (code || pwsize == 0) { fprintf(stderr, "Error while reading password for '%s'\n", - opts.principal_name); + opts->principal_name); memset(stash_password, 0, sizeof(stash_password)); return 0; } @@ -1046,8 +1055,10 @@ main(argc, argv) progname = GET_PROGNAME(argv[0]); progname_v5 = getvprogname("5"); +#ifdef KRB5_KRB4_COMPAT progname_v4 = getvprogname("4"); progname_v524 = getvprogname("524"); +#endif /* Ensure we can be driven from a pipe */ if(!isatty(fileno(stdin))) @@ -1084,7 +1095,9 @@ main(argc, argv) #endif if (!authed_k4) authed_k4 = k4_kinit(&opts, &k4, k5.ctx); +#ifdef KRB5_KRB4_COMPATH memset(stash_password, 0, sizeof(stash_password)); +#endif if (authed_k5 && opts.verbose) fprintf(stderr, "Authenticated to Kerberos v5\n"); |