From 0cacff7c083c86eaffc6976c86a7c15768bc82c3 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 17 Aug 1994 22:28:33 +0000 Subject: [PATCH] Make krb5_encode_kdc_rep pass in the correct msg_type to the ASN.1 encoding routines. Not that value is being used now, but it might be in the future, and we should make sure the high level routines are doing the right thing. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4176 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/ChangeLog | 9 +++++++++ src/lib/krb5/krb/encode_kdc.c | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index 1c09ec591..2fd74813a 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,12 @@ +Wed Aug 17 17:58:22 1994 Theodore Y. Ts'o (tytso at tsx-11) + + * encode_kdc.c (krb5_encode_kdc_rep): Pass in to + encode_krb5_enc_kdc_rep_part the msg_type which should be used. + Old versions of Kerberos always assume TGS_REP; this merely allows + the right msg_type to be passed down to the encoding routines. + For now, the encoding routines will ignore this value and do + things the old way, for compatibility's sake. + Mon Aug 8 22:38:16 1994 Theodore Y. Ts'o (tytso at tsx-11) * preauth.c: Renamed preauthentication mechanism names to match diff --git a/src/lib/krb5/krb/encode_kdc.c b/src/lib/krb5/krb/encode_kdc.c index cdcfe624d..4de4e4a6d 100644 --- a/src/lib/krb5/krb/encode_kdc.c +++ b/src/lib/krb5/krb/encode_kdc.c @@ -64,6 +64,7 @@ OLDDECLARG(krb5_data **, enc_rep) krb5_data *scratch; krb5_encrypt_block eblock; krb5_error_code retval; + krb5_enc_kdc_rep_part tmp_encpart; if (!valid_etype(dec_rep->enc_part.etype)) return KRB5_PROG_ETYPE_NOSUPP; @@ -76,10 +77,26 @@ OLDDECLARG(krb5_data **, enc_rep) return KRB5_BADMSGTYPE; } - retval = encode_krb5_enc_kdc_rep_part(encpart, &scratch); + /* + * We don't want to modify encpart, but we need to be able to pass + * in the message type to the encoder, so it can set the ASN.1 + * type correct. + * + * Although note that it may be doing nothing with the message + * type, to be compatible with old versions of Kerberos that ways + * encode this as a TGS_REP regardly of what it really should be; + * also note that the reason why we are passing it in a structure + * instead of as an argument to encode_krb5_enc_kdc_rep_part (the + * way we should) is for compatibility with the ISODE version of + * this fuction. Ah, compatibility.... + */ + tmp_encpart = *encpart; + tmp_encpart.msg_type = type; + retval = encode_krb5_enc_kdc_rep_part(&tmp_encpart, &scratch); if (retval) { return retval; } + memset(&tmp_encpart, 0, sizeof(tmp_encpart)); #define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); \ krb5_free_data(scratch); } -- 2.26.2