gc_via_tkt.c revision fe598cdcd847f8359013532d5c691bb6190378c0
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* Copyright 1990,1991 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*
* Given a tkt, and a target cred, get it.
* Assumes that the kdc_rep has been decrypted.
*/
#include "k5-int.h"
#include "int-proto.h"
#define IS_TGS_PRINC(c, p) \
((krb5_princ_size((c), (p)) == 2) && \
(krb5_princ_component((c), (p), 0)->length == \
KRB5_TGS_NAME_SIZE) && \
static krb5_error_code
krb5_kdcrep2creds(krb5_context context, krb5_kdc_rep *pkdcrep, krb5_address *const *address, krb5_data *psectkt, krb5_creds **ppcreds)
{
return ENOMEM;
}
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup_keyblock;
} else {
/* no addresses in the list means we got what we had */
goto cleanup_keyblock;
}
goto cleanup_keyblock;
return 0;
return retval;
}
static krb5_error_code
{
return KRB5_KDCREP_MODIFIED;
/* Reply is self-consistent. */
return 0;
/* Server in reply differs from what we requested. */
if (kdcoptions & KDC_OPT_CANONICALIZE) {
/* in_cred server differs from ticket returned, but ticket
returned is consistent and we requested canonicalization. */
#if 0
#ifdef DEBUG_REFERRALS
printf("gc_via_tkt: in_cred and encoding don't match but referrals requested\n");
#endif
#endif
return 0;
}
/* We didn't request canonicalization. */
/* Canonicalization not requested, and not a TGS referral. */
return KRB5_KDCREP_MODIFIED;
}
#if 0
/*
* Is this check needed? find_nxt_kdc() in gc_frm_kdc.c already
* effectively checks this.
*/
/* Attempted to rewrite local TGS. */
return KRB5_KDCREP_MODIFIED;
}
#endif
return 0;
}
{
krb5_enctype *enctypes = 0;
#ifdef DEBUG_REFERRALS
printf("krb5_get_cred_via_tkt starting; referral flag is %s\n", kdcoptions&KDC_OPT_CANONICALIZE?"on":"off");
#endif
/* tkt->client must be equal to in_cred->client */
return KRB5_PRINC_NOMATCH;
return KRB5_NO_TKT_SUPPLIED;
if ((kdcoptions & KDC_OPT_ENC_TKT_IN_SKEY) &&
return(KRB5_NO_2ND_TKT);
/* check if we have the right TGT */
/* tkt->server must be equal to */
/*
{
krb5_principal tempprinc;
if (retval = krb5_tgtname(context,
krb5_princ_realm(context, in_cred->server),
krb5_princ_realm(context, tkt->server), &tempprinc))
return(retval);
if (!krb5_principal_compare(context, tempprinc, tkt->server)) {
krb5_free_principal(context, tempprinc);
return (KRB5_PRINC_NOMATCH);
}
krb5_free_principal(context, tempprinc);
}
*/
if (!enctypes)
return ENOMEM;
enctypes[1] = 0;
}
0, /* no padata */
if (enctypes)
if (retval) {
#ifdef DEBUG_REFERRALS
printf("krb5_get_cred_via_tkt ending early after send_tgs with: %s\n",
#endif
return retval;
}
switch (tgsrep.message_type) {
case KRB5_TGS_REP:
break;
case KRB5_ERROR:
default:
else
if (retval) /* neither proper reply nor error! */
goto error_4;
goto error_4;
}
goto error_4;
goto error_3;
}
/* make sure the response hasn't been tampered with..... */
retval = 0;
if (retval == 0)
if ((kdcoptions & KDC_OPT_POSTDATED) &&
if ((kdcoptions & KDC_OPT_RENEWABLE) &&
if ((kdcoptions & KDC_OPT_RENEWABLE_OK) &&
if (retval != 0)
goto error_3;
tgsrep.request_time)) {
goto error_3;
}
error_3:;
error_4:;
#ifdef DEBUG_REFERRALS
#endif
return retval;
}