From 533024be44861c8d2c8ba3232738c7d2dbbe2e4f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 27 Mar 2010 11:55:22 +1100 Subject: s4:heimdal: import lorikeet-heimdal-201003262338 (commit f4e0dc17709829235f057e0e100d34802d3929ff) --- source4/heimdal/kuser/kinit.c | 112 ++---------------------------------------- 1 file changed, 5 insertions(+), 107 deletions(-) (limited to 'source4/heimdal/kuser') diff --git a/source4/heimdal/kuser/kinit.c b/source4/heimdal/kuser/kinit.c index 4e9e6ac3d7..e6201fbbc0 100644 --- a/source4/heimdal/kuser/kinit.c +++ b/source4/heimdal/kuser/kinit.c @@ -39,10 +39,6 @@ #include #endif -#ifndef HEIMDAL_SMALLER -#include "krb5-v4compat.h" -#endif - struct krb5_dh_moduli; struct AlgorithmIdentifier; struct _krb5_krb_auth_data; @@ -74,11 +70,6 @@ struct getarg_strings etype_str; int use_keytab = 0; char *keytab_str = NULL; int do_afslog = -1; -#ifndef HEIMDAL_SMALLER -int get_v4_tgt = -1; -int convert_524 = 0; -static char *krb4_cc_name; -#endif int fcache_version; char *password_file = NULL; char *pk_user_id = NULL; @@ -105,14 +96,11 @@ static struct getargs args[] = { * P: ~p * C: v4 cache name? * 5: + * + * old flags + * 4: + * 9: */ -#ifndef HEIMDAL_SMALLER - { "524init", '4', arg_flag, &get_v4_tgt, - NP_("obtain version 4 TGT", "") }, - - { "524convert", '9', arg_flag, &convert_524, - NP_("only convert ticket to version 4", "") }, -#endif { "afslog", 0 , arg_flag, &do_afslog, NP_("obtain afs tokens", "") }, @@ -239,58 +227,6 @@ get_server(krb5_context context, KRB5_TGS_NAME, realm, NULL); } -#ifndef HEIMDAL_SMALLER - -static krb5_error_code -do_524init(krb5_context context, krb5_ccache ccache, - krb5_creds *creds, const char *server) -{ - krb5_error_code ret; - - struct credentials c; - krb5_creds in_creds, *real_creds; - - if(creds != NULL) - real_creds = creds; - else { - krb5_principal client; - ret = krb5_cc_get_principal(context, ccache, &client); - if (ret) { - krb5_warn(context, ret, "524init: can't get client principal"); - return ret; - } - memset(&in_creds, 0, sizeof(in_creds)); - ret = get_server(context, client, server, &in_creds.server); - if(ret) { - krb5_warn(context, ret, "524init: can't get server principal"); - krb5_free_principal(context, client); - return ret; - } - in_creds.client = client; - ret = krb5_get_credentials(context, 0, ccache, &in_creds, &real_creds); - krb5_free_principal(context, client); - krb5_free_principal(context, in_creds.server); - if(ret) - return ret; - } - ret = krb524_convert_creds_kdc_ccache(context, ccache, real_creds, &c); - if(ret) - krb5_warn(context, ret, "converting creds"); - else { - krb5_error_code tret = _krb5_krb_tf_setup(context, &c, NULL, 0); - if(tret) - krb5_warn(context, tret, "saving v4 creds"); - } - - if(creds == NULL) - krb5_free_creds(context, real_creds); - memset(&c, 0, sizeof(c)); - - return ret; -} - -#endif - static int renew_validate(krb5_context context, int renew, @@ -370,10 +306,6 @@ renew_validate(krb5_context context, if(ret == 0 && server == NULL) { /* only do this if it's a general renew-my-tgt request */ -#ifndef HEIMDAL_SMALLER - if(get_v4_tgt) - do_524init(context, cache, out, NULL); -#endif #ifndef NO_AFS if(do_afslog && k_hasafs()) krb5_afslog(context, cache, NULL, NULL); @@ -782,10 +714,6 @@ renew_func(void *ptr) get_new_tickets(ctx->context, ctx->principal, ctx->ccache, ctx->ticket_life, 0); -#ifndef HEIMDAL_SMALLER - if(get_v4_tgt || convert_524) - do_524init(ctx->context, ctx->ccache, NULL, server_str); -#endif #ifndef NO_AFS if(do_afslog && k_hasafs()) krb5_afslog(ctx->context, ctx->ccache, NULL, NULL); @@ -875,12 +803,6 @@ main (int argc, char **argv) krb5_appdefault_boolean(context, "kinit", krb5_principal_get_realm(context, principal), "renewable", FALSE, &renewable_flag); -#ifndef HEIMDAL_SMALLER - if(get_v4_tgt == -1) - krb5_appdefault_boolean(context, "kinit", - krb5_principal_get_realm(context, principal), - "krb4_get_tickets", FALSE, &get_v4_tgt); -#endif if(do_afslog == -1) krb5_appdefault_boolean(context, "kinit", krb5_principal_get_realm(context, principal), @@ -898,20 +820,6 @@ main (int argc, char **argv) krb5_cc_get_type(context, ccache), krb5_cc_get_name(context, ccache)); setenv("KRB5CCNAME", s, 1); -#ifndef HEIMDAL_SMALLER - if (get_v4_tgt) { - int fd; - if (asprintf(&krb4_cc_name, "%s_XXXXXX", TKT_ROOT) < 0) - krb5_errx(context, 1, "out of memory"); - if((fd = mkstemp(krb4_cc_name)) >= 0) { - close(fd); - setenv("KRBTKFILE", krb4_cc_name, 1); - } else { - free(krb4_cc_name); - krb4_cc_name = NULL; - } - } -#endif } else { ret = krb5_cc_cache_match(context, principal, &ccache); if (ret) { @@ -974,15 +882,8 @@ main (int argc, char **argv) exit(ret != 0); } -#ifndef HEIMDAL_SMALLER - if(!convert_524) -#endif - get_new_tickets(context, principal, ccache, ticket_life, 1); + get_new_tickets(context, principal, ccache, ticket_life, 1); -#ifndef HEIMDAL_SMALLER - if(get_v4_tgt || convert_524) - do_524init(context, ccache, NULL, server_str); -#endif #ifndef NO_AFS if(do_afslog && k_hasafs()) krb5_afslog(context, ccache, NULL, NULL); @@ -1008,9 +909,6 @@ main (int argc, char **argv) krb5_warnx(context, N_("command not found: %s", ""), argv[1]); krb5_cc_destroy(context, ccache); -#ifndef HEIMDAL_SMALLER - _krb5_krb_dest_tkt(context, krb4_cc_name); -#endif #ifndef NO_AFS if(k_hasafs()) k_unlog(); -- cgit