+Fri Aug 25 21:50:37 1995 Theodore Y. Ts'o <tytso@dcl>
+
+ * krb5_encode_test.c (main): Add tests for
+ encode_krb5_padata_sequence().
+
+ * krb5_decode_test.c (main): Add tests for
+ decode_krb5_padata_sequence().
+
+ * ktest.c (ktest_make_sample_empty_pa_data_array): New function
+ which creates an empty pa_data array.
+
+ * trval.c: Various -Wall cleanups.
+
+ * Makefile.in (trval): Add rule to build the standalone trval
+ program.
Thu Jul 27 15:29:10 EDT 1995 Paul Park (pjpark@mit.edu)
* krb5_{en,de}code_test.c - Use k5-int instead of krb5 and asn1.h.
COMERRLIB=$(TOPLIBD)/libcom_err.a
-all:: krb5_encode_test krb5_decode_test
+all:: krb5_encode_test krb5_decode_test trval
LOCALINCLUDES = -I$(srcdir)/../../lib/krb5/asn.1
krb5_decode_test: $(DECOBJS) $(DEPLIBS)
$(LD) $(LDFLAGS) $(LDARGS) -o krb5_decode_test $(DECOBJS) $(LIBS)
+trval: $(srcdir)/trval.c
+ $(CC) -o trval $(CFLAGS) -DSTANDALONE $(srcdir)/trval.c
+
check:: krb5_decode_test krb5_encode_test
LD_LIBRARY_PATH=$(TOPLIBD) ./krb5_decode_test
$(RM) test.out
decode_run("PasswdData","","30 3D A0 03 02 01 02 A1 36 30 34 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61",decode_krb5_pwd_data,ktest_equal_krb5_pwd_data);
}
+ /****************************************************************/
+ /* decode_krb5_padata_sequence */
+ {
+ krb5_pa_data **ref, **var;
+ retval = ktest_make_sample_pa_data_array(&ref);
+ if(retval){
+ com_err("making sample pa_data array",retval,"");
+ exit(1);
+ }
+ retval = krb5_data_hex_parse(&code,"30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61");
+ if(retval){
+ com_err("parsing padata_sequence",retval,"");
+ exit(1);
+ }
+ retval = decode_krb5_padata_sequence(&code,&var);
+ if(retval) com_err("decoding padata_sequence",retval,"");
+ assert(ktest_equal_sequence_of_pa_data(ref,var),"pa_data\n")
+ }
+
+ /****************************************************************/
+ /* decode_krb5_padata_sequence (empty) */
+ {
+ krb5_pa_data **ref, **var;
+ retval = ktest_make_sample_empty_pa_data_array(&ref);
+ if(retval){
+ com_err("making sample empty pa_data array",retval,"");
+ exit(1);
+ }
+ retval = krb5_data_hex_parse(&code,"30 00");
+ if(retval){
+ com_err("parsing padata_sequence (empty)",retval,"");
+ exit(1);
+ }
+ retval = decode_krb5_padata_sequence(&code,&var);
+ if(retval) com_err("decoding padata_sequence (empty)",retval,"");
+ assert(ktest_equal_sequence_of_pa_data(ref,var),"pa_data (empty)\n")
+ }
+
exit(error_count);
}
encode_run(pd,krb5_pwd_data,"pwd_data","",encode_krb5_pwd_data);
}
+ /****************************************************************/
+ /* encode_padata_sequence */
+ {
+ krb5_pa_data **pa;
+
+ setup(pa,krb5_pa_data,"PreauthData",ktest_make_sample_pa_data_array);
+ retval = encode_krb5_padata_sequence((const krb5_pa_data**)pa,&(code));
+ if(retval) com_err("encoding padata_sequence",retval,"");
+ encoder_print_results(code, "padata_sequence", "");
+ }
+
+ /****************************************************************/
+ /* encode_padata_sequence (empty) */
+ {
+ krb5_pa_data **pa;
+
+ setup(pa,krb5_pa_data,"EmptyPreauthData",ktest_make_sample_empty_pa_data_array);
+ retval = encode_krb5_padata_sequence((const krb5_pa_data**)pa,&(code));
+ if(retval) com_err("encoding padata_sequence(empty)",retval,"");
+ encoder_print_results(code, "padata_sequence(empty)", "");
+ }
+
exit(error_count);
}
return 0;
}
+krb5_error_code ktest_make_sample_empty_pa_data_array(pad)
+ krb5_pa_data *** pad;
+{
+ *pad = (krb5_pa_data**)calloc(1,sizeof(krb5_pa_data*));
+ if(*pad == NULL) return ENOMEM;
+
+ (*pad)[0] = NULL;
+
+ return 0;
+}
+
krb5_error_code ktest_make_sample_pa_data(pad)
krb5_pa_data * pad;
{
KRB5_PROTOTYPE((krb5_kdc_rep *kdcr));
krb5_error_code ktest_make_sample_pa_data_array
KRB5_PROTOTYPE((krb5_pa_data ***pad));
+ krb5_error_code ktest_make_sample_empty_pa_data_array
+ KRB5_PROTOTYPE((krb5_pa_data ***pad));
krb5_error_code ktest_make_sample_pa_data
KRB5_PROTOTYPE((krb5_pa_data *pad));
krb5_error_code ktest_make_sample_ap_req
encode_krb5_authorization_data: 30 22 30 0F A0 03 02 01 01 A1 08 04 06 66 6F 6F 62 61 72 30 0F A0 03 02 01 01 A1 08 04 06 66 6F 6F 62 61 72
encode_krb5_pwd_sequence: 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61
encode_krb5_pwd_data: 30 3D A0 03 02 01 02 A1 36 30 34 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61
+encode_krb5_padata_sequence: 30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61
+encode_krb5_padata_sequence(empty): 30 00
* trval.c.c
*****************************************************************************/
+#include <unistd.h>
+#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
int print_skip_krb5_tagnum = 0;
#endif
+void print_tag_type();
+int trval(), trval2(), decode_len(), do_cons(), do_prim();
/****************************************************************************/
char **argv;
{
int optflg = 1;
- int options = 0;
FILE *fp;
int r;
continue;
}
r = trval(fp, stdout);
- close(fp);
+ fclose(fp);
}
}
if (optflg) r = trval(stdin, stdout);
}
}
if ((j = (n % WIDTH)) != 0) {
- fprintf(fp, " ", j);
+ fprintf(fp, " ");
for (i=0; i<WIDTH-j; i++) fprintf(fp, " ");
for (i=n-j; i<n; i++)
if (isprint(enc[i])) fprintf(fp, "%c", enc[i]);
int r;
int rlen2;
int rlent;
- int l;
for (n = 0, rlent = 0; n < len; n+=rlen2, rlent+=rlen2) {
r = trval2(fp, enc+n, len-n, lev, &rlen2);
return(r);
}
-print_tag_type(fp, eid, lev)
+void print_tag_type(fp, eid, lev)
FILE *fp;
int eid;
int lev;
. . . [1] [Octet String] <8>
6b 72 62 35 64 61 74 61 krb5data
+encode_krb5_padata_sequence:
+
+[Sequence/Sequence Of]
+. [Sequence/Sequence Of]
+. . [1] [Integer] <1>
+ 0d .
+. . [2] [Octet String] <7>
+ 70 61 2d 64 61 74 61 pa-data
+. [Sequence/Sequence Of]
+. . [1] [Integer] <1>
+ 0d .
+. . [2] [Octet String] <7>
+ 70 61 2d 64 61 74 61 pa-data
+
+encode_krb5_padata_sequence(empty):
+
+[Sequence/Sequence Of]
+