From: Russ Allbery Date: Fri, 4 Jun 2010 02:50:14 +0000 (-0700) Subject: Fix aklog warnings when building with Heimdal X-Git-Tag: openafs-devel-1_5_75~114 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=6dc50767f88795858783fe9dbbdf90901f1fd684 Fix aklog warnings when building with Heimdal Fix various warnings in the aklog and klog code when building with Heimdal. Use krb5_get_init_creds_opt_alloc if it's available rather than allocating the struct off the stack, since the _opt_init function is deprecated. Change-Id: Ieff986121de9078e9402b0a51a8855655330caba Reviewed-on: http://gerrit.openafs.org/2082 Tested-by: Russ Allbery Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/configure.in b/configure.in index e48e5e6..b7545ff 100644 --- a/configure.in +++ b/configure.in @@ -56,6 +56,7 @@ AS_IF([test x"$KRB5_LIBS" != x], krb5_c_encrypt \ krb5_decode_ticket \ krb5_enctype_enable \ + krb5_get_init_creds_opt_alloc \ krb5_get_prompt_types \ krb5_princ_size \ krb5_principal_get_comp_string]) diff --git a/src/aklog/aklog.c b/src/aklog/aklog.c index 0064d40..2408547 100644 --- a/src/aklog/aklog.c +++ b/src/aklog/aklog.c @@ -1800,8 +1800,8 @@ get_credv5_akimpersonate(krb5_context context, krb5_ticket ticket_reply[1]; krb5_enc_tkt_part enc_tkt_reply[1]; krb5_address address[30], *faddr[30]; -#endif krb5_data * temp; +#endif int i; static int any_enctype[] = {0}; *out_creds = 0; @@ -2082,7 +2082,6 @@ cleanup: krb5_kt_close(context, kt); if (creds) krb5_free_creds(context, creds); krb5_free_keyblock_contents(context, session_key); -out: return code; #else return -1; diff --git a/src/aklog/klog.c b/src/aklog/klog.c index 8c7606a..0d13578 100644 --- a/src/aklog/klog.c +++ b/src/aklog/klog.c @@ -355,7 +355,11 @@ CommandProc(struct cmd_syndesc *as, void *arock) char service_temp[MAXKTCREALMLEN + 20]; krb5_creds incred[1], mcred[1], *outcred = 0, *afscred; krb5_ccache cc = 0; +#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC + krb5_get_init_creds_opt *gic_opts; +#else krb5_get_init_creds_opt gic_opts[1]; +#endif char *tofree = NULL, *outname; int code; char *what; @@ -572,7 +576,15 @@ CommandProc(struct cmd_syndesc *as, void *arock) klog_arg->pstore = passwd; klog_arg->allocated = sizeof(passwd); /* XXX should allow k5 to prompt in most cases -- what about expired pw?*/ +#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC + code = krb5_get_init_creds_opt_alloc(k5context, &gic_opts); + if (code) { + afs_com_err(rn, code, "Can't allocate get_init_creds options"); + KLOGEXIT(code); + } +#else krb5_get_init_creds_opt_init(gic_opts); +#endif for (;;) { code = krb5_get_init_creds_password(k5context, incred, @@ -691,7 +703,7 @@ CommandProc(struct cmd_syndesc *as, void *arock) size_t elen = enc_part->length; atoken->kvno = RXKAD_TKT_TYPE_KERBEROS_V5_ENCPART_ONLY; if (afs_krb5_skip_ticket_wrapper(afscred->ticket.data, - afscred->ticket.length, &enc_part->data, + afscred->ticket.length, (char **) &enc_part->data, &elen)) { afs_com_err(rn, 0, "Can't unwrap %s AFS credential", cellconfig->name);