From fbdface758e576c2a250adec3f4aac5566f10900 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 19 Oct 1994 14:37:37 +0000 Subject: [PATCH] Makefile.in: "make check" depends on krb5_decode_test and krb5_encode_test being up to date. ktest_equal.c: Don't segfault if one of the arguments is NULL and the other is not in array_compare. krb5_decode_test.c: Use krb5_init_ets() instead of explicitly naming the error tables to initialize. utility.c: Remove unused routine, and return EINVAL instead of ASN1_PARSE_ERROR in krb5_data_hex_parse, since the ASN1 error codes aren't defined if the ISODE routines are being used. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4534 dc483132-0cff-0310-8789-dd5450dbe970 --- src/tests/asn.1/ChangeLog | 19 +++++++++++++++++++ src/tests/asn.1/Makefile.in | 2 +- src/tests/asn.1/krb5_decode_test.c | 4 ++-- src/tests/asn.1/ktest_equal.c | 5 +++-- src/tests/asn.1/utility.c | 10 +++++++++- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/tests/asn.1/ChangeLog b/src/tests/asn.1/ChangeLog index 1911b1608..80e105d73 100644 --- a/src/tests/asn.1/ChangeLog +++ b/src/tests/asn.1/ChangeLog @@ -1,3 +1,22 @@ +Wed Oct 19 00:11:43 1994 Theodore Y. Ts'o (tytso@maytag) + + * Makefile.in: "make check" depends on krb5_decode_test and + krb5_encode_test being up to date. + +Tue Oct 18 22:46:17 1994 Theodore Y. Ts'o (tytso@maytag) + + * ktest_equal.c (array_compare): Don't segfault if one of the + arguments is NULL and the other is not. + + * krb5_decode_test.c (main): Use krb5_init_ets() instead of + explicitly naming the error tables to initialize. + + * utility.c (asn1buf_print): Remove unneeded routine. + + * utility.c (krb5_data_hex_parse): Return EINVAL instead of + ASN1_PARSE_ERROR if KRB5_USE_ISODE is defined, since the + ASN1 error codes aren't defined in that case. + Fri Oct 14 15:00:41 1994 Theodore Y. Ts'o (tytso@dcl) * Makefile.in: Clean up the test.out file. diff --git a/src/tests/asn.1/Makefile.in b/src/tests/asn.1/Makefile.in index 7bb79cc7f..e76e67674 100644 --- a/src/tests/asn.1/Makefile.in +++ b/src/tests/asn.1/Makefile.in @@ -22,7 +22,7 @@ DECOBJS = krb5_decode_test.o ktest.o ktest_equal.o utility.o krb5_decode_test: $(DECOBJS) $(DEPKLIB) $(CC) $(CFLAGS) -o krb5_decode_test $(DECOBJS) $(LIBS) $(KLIB) -check:: +check:: krb5_decode_test krb5_encode_test ./krb5_decode_test $(RM) test.out ./krb5_encode_test > test.out diff --git a/src/tests/asn.1/krb5_decode_test.c b/src/tests/asn.1/krb5_decode_test.c index d49a302d2..af3369366 100644 --- a/src/tests/asn.1/krb5_decode_test.c +++ b/src/tests/asn.1/krb5_decode_test.c @@ -4,6 +4,7 @@ #include "utility.h" #include "ktest_equal.h" +#include #include "debug.h" #include @@ -15,8 +16,7 @@ void main() krb5_data code; krb5_error_code retval; - initialize_asn1_error_table(); - initialize_krb5_error_table(); + krb5_init_ets(); #define setup(type,typestring,constructor)\ type ref, *var;\ diff --git a/src/tests/asn.1/ktest_equal.c b/src/tests/asn.1/ktest_equal.c index 93ed4447b..10a076440 100644 --- a/src/tests/asn.1/ktest_equal.c +++ b/src/tests/asn.1/ktest_equal.c @@ -568,8 +568,9 @@ int ktest_equal_array_of_enctype(DECLARG(const int , length), #define array_compare(comparator)\ int i,p=TRUE;\ if(ref==var) return TRUE;\ -if(ref==NULL || ref[0]==NULL)\ - if(var==NULL || var[0]==NULL) return TRUE;\ +if(!ref || !ref[0])\ + return (!var || !var[0]);\ +if(!var || !var[0]) return FALSE;\ for(i=0; ref[i] != NULL && var[i] != NULL; i++)\ p = p && comparator(ref[i],var[i]);\ if(ref[i] == NULL && var[i] == NULL) return p;\ diff --git a/src/tests/asn.1/utility.c b/src/tests/asn.1/utility.c index 17ed2243c..b8b3af4fe 100644 --- a/src/tests/asn.1/utility.c +++ b/src/tests/asn.1/utility.c @@ -74,12 +74,19 @@ krb5_error_code krb5_data_hex_parse(DECLARG(krb5_data *, d), if(d->data == NULL) return ENOMEM; d->length = (strlen(s)+1)/3; for(i=0,pos=(char*)s; ilength; i++,pos+=3){ - if(!sscanf(pos,"%x",&digit)) return ASN1_PARSE_ERROR; + if(!sscanf(pos,"%x",&digit)) { +#ifdef KRB5_USE_ISODE + return EINVAL; +#else + return ASN1_PARSE_ERROR; +#endif + } d->data[i] = (char)digit; } return 0; } +#if 0 void asn1buf_print(DECLARG(const asn1buf *, buf)) OLDDECLARG(const asn1buf *, buf) { @@ -104,3 +111,4 @@ void asn1buf_print(DECLARG(const asn1buf *, buf)) printf("%s\n",s); free(s); } +#endif -- 2.26.2