try to use the new initial-ticket API

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2709 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-08-05 20:59:19 +00:00
parent 3f3dcd9176
commit cb931c2ab6

View File

@@ -110,15 +110,17 @@ main (int argc, char **argv)
char pwbuf[128];
krb5_kdc_rep kdc_rep;
union {
krb5_flags i;
KDCOptions f;
}options;
#if 0
krb5_kdc_flags options;
#endif
int optind = 0;
krb5_get_init_creds_opt opt;
set_progname (argv[0]);
memset(&cred, 0, sizeof(cred));
#if 0
options.i = 0;
#endif
if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &optind))
usage();
@@ -131,12 +133,32 @@ main (int argc, char **argv)
exit(0);
}
options.f.forwardable = forwardable;
krb5_get_init_creds_opt_init (&opt);
if (forwardable)
krb5_get_init_creds_opt_set_forwardable (&opt, forwardable);
if (renewable)
krb5_get_init_creds_opt_set_renew_life (&opt, 1 << 30);
if (preauth)
krb5_get_init_creds_opt_set_preauth_list (&opt,
pre_auth_types,
1);
if (lifetime) {
int tmp = parse_time (lifetime, NULL);
if (tmp < 0)
errx (1, "unparsable time: %s", lifetime);
krb5_get_init_creds_opt_set_tkt_life (&opt, tmp);
}
#if 0
options.b.forwardable = forwardable;
if(renewable){
options.f.renewable = 1;
options.b.renewable = 1;
cred.times.renew_till = 1 << 30;
}
#endif
argc -= optind;
argv += optind;
@@ -148,6 +170,30 @@ main (int argc, char **argv)
if (ret)
errx (1, "krb5_cc_default: %s", krb5_get_err_text(context, ret));
if (argv[0]) {
ret = krb5_parse_name (context, argv[0], &principal);
if (ret)
errx (1, "krb5_parse_name: %s", krb5_get_err_text(context, ret));
} else
principal = NULL;
ret = krb5_get_init_creds_password (context,
&cred,
principal,
NULL,
krb5_prompter_posix,
NULL,
0,
NULL,
&opt);
if (ret)
errx (1, "krb5_get_init_creds: %s", krb5_get_err_text(context, ret));
ret = krb5_cc_store_cred (context, ccache, &cred);
if (ret)
errx (1, "krb5_cc_store_cred: %s", krb5_get_err_text(context, ret));
krb5_free_creds (context, &cred);
#if 0
ret = krb5_get_default_realm (context, &realm);
if (ret)
errx (1, "krb5_get_default_realm: %s",
@@ -233,6 +279,7 @@ main (int argc, char **argv)
krb5_free_kdc_rep (context, &kdc_rep);
krb5_free_principal (context, principal);
krb5_free_principal (context, server);
#endif
krb5_free_ccache (context, ccache);
krb5_free_context (context);
return 0;