krb5_encode.c (encode_krb5_padata_sequence): New function which encodes a
authorTheodore Tso <tytso@mit.edu>
Sat, 26 Aug 1995 01:46:44 +0000 (01:46 +0000)
committerTheodore Tso <tytso@mit.edu>
Sat, 26 Aug 1995 01:46:44 +0000 (01:46 +0000)
sequence of pa_data elements

krb5_decode.c (decode_krb5_padata_sequence): New function which decodes a
 sequence of pa_data elements.

asn1_k_encode.c (asn1_encode_sequence_of_pa_data): Make it possible to encode
sequence of zero pa_data elements.

asn1_k_decode.c (decode_array_body): Make it possible to decode SEQUENCE OF
encodinges of zero items (which is legal according to ASN.1)

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6593 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/asn.1/ChangeLog
src/lib/krb5/asn.1/asn1_k_decode.c
src/lib/krb5/asn.1/asn1_k_encode.c
src/lib/krb5/asn.1/krb5_decode.c
src/lib/krb5/asn.1/krb5_encode.c

index 07e82b5a6614f094fe7cd5d5a27eed6e9b9d2b9e..a558cf428f30c360b08420f78bddb34d55c49161 100644 (file)
@@ -1,3 +1,18 @@
+Fri Aug 25 21:43:42 1995  Theodore Y. Ts'o  <tytso@dcl>
+
+       * krb5_encode.c (encode_krb5_padata_sequence): New function which
+               encodes a sequence of pa_data elements
+
+       * krb5_decode.c (decode_krb5_padata_sequence): New function which
+               decodes a sequence of pa_data elements.
+
+       * asn1_k_encode.c (asn1_encode_sequence_of_pa_data): Make it
+               possible to encode sequence of zero pa_data elements.
+
+       * asn1_k_decode.c (decode_array_body): Make it possible to decode
+               SEQUENCE OF encodinges of zero items (which is legal
+               according to ASN.1)
+
 Sat Jun 17 00:00:33 1995  Theodore Y. Ts'o  (tytso@dcl)
 
        * asn1_get.c (asn1_get_tag): Added change to allow for 
index 159667923d4d9a99c0565f306dc5892b78b1a1de..da748c4e816dfdb87b2bbee2f1c1be5d4984fdd6 100644 (file)
@@ -514,6 +514,8 @@ if(*(array) == NULL) return ENOMEM;\
       get_element(elt,decoder);\
       array_append(val,size,elt,type);\
     }\
+    if (*val == NULL)\
+       *val = (type **)malloc(sizeof(type*));\
     (*val)[size] = NULL;\
     end_sequence_of(buf);\
   }\
index 731083a99125466afd2992a71ea95937a27fa0c8..98c4fc4c9a1ec9fd0c9198862a3d5dfeb5ff36a4 100644 (file)
@@ -571,7 +571,7 @@ asn1_error_code asn1_encode_sequence_of_pa_data(buf, val, retlen)
   asn1_setup();
   int i;
 
-  if(val == NULL || val[0] == NULL) return ASN1_MISSING_FIELD;
+  if (val == NULL) return ASN1_MISSING_FIELD;
 
   for(i=0; val[i] != NULL; i++);
   for(i--; i>=0; i--){
index fd716f4b414d71d95ab56242eebd5c62f5f17adb..7fdd8d7774a2073d11c4cb3c01c5e0b3586edb4b 100644 (file)
@@ -603,3 +603,15 @@ krb5_error_code decode_krb5_pwd_data(code, rep)
     end_structure (); }
   cleanup();
 }
+
+krb5_error_code decode_krb5_padata_sequence(code, rep)
+     const krb5_data * code;
+     krb5_pa_data ***rep;
+{
+  setup_buf_only();
+  *rep = 0;
+  retval = asn1_decode_sequence_of_pa_data(&buf,rep);
+  if(retval) return (krb5_error_code)retval;
+  cleanup();
+}
+
index aa7ad61d169f7506c0cfbab904ff165c37da1207..8928f56b84f65c2f48cfa29ce744f428d976f0a1 100644 (file)
@@ -719,3 +719,17 @@ krb5_error_code encode_krb5_pwd_data(rep, code)
   krb5_makeseq();
   krb5_cleanup();
 }
+
+krb5_error_code encode_krb5_padata_sequence(rep, code)
+     const krb5_pa_data ** rep;
+     krb5_data ** code;
+{
+  krb5_setup();
+
+  retval = asn1_encode_sequence_of_pa_data(buf,rep,&length);
+  if(retval) return retval;
+  sum += length;
+
+  krb5_cleanup();
+}
+