-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.
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;
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"))
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;
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
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;
}
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;
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
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;
}
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)))
#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");