+Thu Nov 14 20:57:55 1996 Theodore Y. Ts'o <tytso@mit.edu>
+
+ * asn1_k_encode.c (asn1_encode_principal_name): Be liberal about
+ accepting a principal with a zero-length component where
+ the data pointer is NULL. After all,
+ asn1_decode_principal_name generates them that way! [PR#188]
+ (asn1_encode_encrypted_data):
+ (asn1_encode_krb5_authdata_elt):
+ (asn1_encode_encryption_key):
+ (asn1_encode_checksum):
+ (asn1_encode_realm): If the length is zero, allow the data
+ field to be NULL.
+
Thu Jun 27 10:31:34 1996 Ezra Peisach <epeisach@kangaroo.mit.edu>
* asn1buf.c (asn12krb5_buf): Initialize magic fields of structure.
const krb5_principal val;
int * retlen;
{
- if(val == NULL || val->realm.data == NULL) return ASN1_MISSING_FIELD;
+ if (val == NULL ||
+ (val->realm.length && val->realm.data == NULL))
+ return ASN1_MISSING_FIELD;
return asn1_encode_generalstring(buf,val->realm.length,val->realm.data,
retlen);
}
asn1_setup();
int n;
- if(val == NULL || val->data == NULL) return ASN1_MISSING_FIELD;
+ if (val == NULL || val->data == NULL) return ASN1_MISSING_FIELD;
for(n = (int) ((val->length)-1); n >= 0; n--){
- if(val->data[n].data == NULL) return ASN1_MISSING_FIELD;
+ if (val->data[n].length &&
+ val->data[n].data == NULL)
+ return ASN1_MISSING_FIELD;
retval = asn1_encode_generalstring(buf,
(val->data)[n].length,
(val->data)[n].data,
{
asn1_setup();
- if(val == NULL || val->contents == NULL) return ASN1_MISSING_FIELD;
+ if (val == NULL || val->contents == NULL) return ASN1_MISSING_FIELD;
asn1_addlenfield(val->length,val->contents,1,asn1_encode_octetstring);
asn1_addfield(val->addrtype,0,asn1_encode_integer);
{
asn1_setup();
- if(val == NULL || val->ciphertext.data == NULL) return ASN1_MISSING_FIELD;
+ if(val == NULL ||
+ (val->ciphertext.length && val->ciphertext.data == NULL))
+ return ASN1_MISSING_FIELD;
asn1_addlenfield(val->ciphertext.length,val->ciphertext.data,2,asn1_encode_charstring);
if(val->kvno)
{
asn1_setup();
- if(val == NULL || val->contents == NULL) return ASN1_MISSING_FIELD;
+ if (val == NULL ||
+ (val->length && val->contents == NULL))
+ return ASN1_MISSING_FIELD;
/* ad-data[1] OCTET STRING */
asn1_addlenfield(val->length,val->contents,1,asn1_encode_octetstring);
{
asn1_setup();
- if(val == NULL || val->contents == NULL) return ASN1_MISSING_FIELD;
+ if (val == NULL ||
+ (val->length && val->contents == NULL))
+ return ASN1_MISSING_FIELD;
asn1_addlenfield(val->length,val->contents,1,asn1_encode_octetstring);
asn1_addfield(val->enctype,0,asn1_encode_integer);
{
asn1_setup();
- if(val == NULL || val->contents == NULL) return ASN1_MISSING_FIELD;
+ if (val == NULL ||
+ (val->length && val->contents == NULL))
+ return ASN1_MISSING_FIELD;
asn1_addlenfield(val->length,val->contents,1,asn1_encode_octetstring);
asn1_addfield(val->checksum_type,0,asn1_encode_integer);
asn1_addfield(val->usec,2,asn1_encode_integer);
asn1_addfield(val->timestamp,1,asn1_encode_kerberos_time);
}
- if(val->user_data.data == NULL) return ASN1_MISSING_FIELD;
+ if (val->user_data.length && val->user_data.data == NULL)
+ return ASN1_MISSING_FIELD;
asn1_addlenfield(val->user_data.length,val->user_data.data,0,asn1_encode_charstring)
;