From e8d6f2d6df42a036824d1c93c98a0d6bbbb8d8c7 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Thu, 9 Nov 1995 01:03:32 +0000 Subject: [PATCH] * asn1_k_decode.c (asn1_decode_etype_info_entry): If the optional salt element is not present, set etype.length to -1. * asn1_k_encode.c (asn1_encode_etype_info_entry): When encoding the etype_info_entry structure, use length == -1 to mean that the optional salt structure should not be sent. (It used to be if length == -1.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7067 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/asn.1/ChangeLog | 10 ++++++++++ src/lib/krb5/asn.1/asn1_k_decode.c | 2 +- src/lib/krb5/asn.1/asn1_k_encode.c | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog index 8ddcdbe17..09d37294f 100644 --- a/src/lib/krb5/asn.1/ChangeLog +++ b/src/lib/krb5/asn.1/ChangeLog @@ -1,3 +1,13 @@ +Wed Nov 8 20:00:13 1995 Theodore Y. Ts'o + + * asn1_k_decode.c (asn1_decode_etype_info_entry): If the optional + salt element is not present, set etype.length to -1. + + * asn1_k_encode.c (asn1_encode_etype_info_entry): When encoding + the etype_info_entry structure, use length == -1 to mean + that the optional salt structure should not be sent. (It + used to be if length == -1.) + Tue Oct 31 20:06:49 1995 Theodore Y. Ts'o * krb5_decode.c (decode_krb5_pa_enc_ts, decode_krb5_enc_data): diff --git a/src/lib/krb5/asn.1/asn1_k_decode.c b/src/lib/krb5/asn.1/asn1_k_decode.c index 93db3055e..ff985fbf5 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode.c +++ b/src/lib/krb5/asn.1/asn1_k_decode.c @@ -665,7 +665,7 @@ asn1_error_code asn1_decode_etype_info_entry(buf, val) if (tagnum == 1) { get_lenfield(val->length,val->salt,1,asn1_decode_octetstring); } else { - val->length = 0; + val->length = -1; val->salt = 0; } end_structure(); diff --git a/src/lib/krb5/asn.1/asn1_k_encode.c b/src/lib/krb5/asn.1/asn1_k_encode.c index c2b928327..9702f5e3d 100644 --- a/src/lib/krb5/asn.1/asn1_k_encode.c +++ b/src/lib/krb5/asn.1/asn1_k_encode.c @@ -774,10 +774,10 @@ asn1_error_code asn1_encode_etype_info_entry(buf, val, retlen) { asn1_setup(); - if(val == NULL || (val->length != 0 && val->salt == NULL)) + if(val == NULL || (val->length >= 0 && val->salt == NULL)) return ASN1_MISSING_FIELD; - if (val->length) + if (val->length >= 0) asn1_addlenfield((int) val->length,val->salt,1, asn1_encode_octetstring); asn1_addfield(val->etype,0,asn1_encode_integer); -- 2.26.2