summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1996-11-15 02:21:23 +0000
committerTheodore Tso <tytso@mit.edu>1996-11-15 02:21:23 +0000
commitc3b7a18e411431c18505b3c03d931a11392d1054 (patch)
treea6b7a7422d57b591847a43a0d286c80fc183c679 /src/lib
parent8853cd13e45237b4a3cdc8ac0764543a9d2a9a30 (diff)
downloadkrb5-c3b7a18e411431c18505b3c03d931a11392d1054.tar.gz
krb5-c3b7a18e411431c18505b3c03d931a11392d1054.tar.xz
krb5-c3b7a18e411431c18505b3c03d931a11392d1054.zip
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. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9418 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/krb5/asn.1/ChangeLog13
-rw-r--r--src/lib/krb5/asn.1/asn1_k_encode.c31
2 files changed, 35 insertions, 9 deletions
diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog
index fe9fe37095..8aa3684e2d 100644
--- a/src/lib/krb5/asn.1/ChangeLog
+++ b/src/lib/krb5/asn.1/ChangeLog
@@ -1,3 +1,16 @@
+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.
diff --git a/src/lib/krb5/asn.1/asn1_k_encode.c b/src/lib/krb5/asn.1/asn1_k_encode.c
index 75223294a0..a3f375d1f4 100644
--- a/src/lib/krb5/asn.1/asn1_k_encode.c
+++ b/src/lib/krb5/asn.1/asn1_k_encode.c
@@ -134,7 +134,9 @@ asn1_error_code asn1_encode_realm(buf, val, retlen)
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);
}
@@ -147,10 +149,12 @@ asn1_error_code asn1_encode_principal_name(buf, val, 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,
@@ -186,7 +190,7 @@ asn1_error_code asn1_encode_host_address(buf, val, retlen)
{
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);
@@ -223,7 +227,9 @@ asn1_error_code asn1_encode_encrypted_data(buf, val, retlen)
{
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)
@@ -314,7 +320,9 @@ asn1_error_code asn1_encode_krb5_authdata_elt(buf, val, retlen)
{
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);
@@ -482,7 +490,9 @@ asn1_error_code asn1_encode_encryption_key(buf, val, retlen)
{
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);
@@ -498,7 +508,9 @@ asn1_error_code asn1_encode_checksum(buf, val, retlen)
{
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);
@@ -702,7 +714,8 @@ asn1_error_code asn1_encode_krb_safe_body(buf, val, retlen)
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)
;