From: Ezra Peisach Date: Tue, 17 Oct 2000 23:05:24 +0000 (+0000) Subject: * ktest.c (ktest_make_sample_etype_info): Use KRB5_ETYPE_NO_SALT X-Git-Tag: krb5-1.3-alpha1~1814 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=115ca6e4cf0dd922795325f97bc391277deccd2c;p=krb5.git * ktest.c (ktest_make_sample_etype_info): Use KRB5_ETYPE_NO_SALT instead of -1. * ktest_equal.c (ktest_equal_krb5_etype_info_entry): Test for KRB5_ETYPE_NO_SALT. ktest_equal_array_of_octet() and ktest_equal_array_of_char take unsigned int lengths. * ktest_equal.h: Add len_unsigned_array macro for a prototype of a function taking an unsigned int count. ktest_equal_array_of_octet() is one of these. ktest_equal_array_of_char() takes an unsigned int as length. * trval.c (trval): Unsigned/signed int fix. * utility.c (asn1_krb5_data_unparse): Better test for krb5_data length being less than zero. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12789 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/tests/asn.1/ChangeLog b/src/tests/asn.1/ChangeLog index be4f33196..08f8a9b57 100644 --- a/src/tests/asn.1/ChangeLog +++ b/src/tests/asn.1/ChangeLog @@ -1,3 +1,23 @@ +2000-10-17 Ezra Peisach + + * ktest.c (ktest_make_sample_etype_info): Use KRB5_ETYPE_NO_SALT + instead of -1. + + * ktest_equal.c (ktest_equal_krb5_etype_info_entry): Test for + KRB5_ETYPE_NO_SALT. ktest_equal_array_of_octet() and + ktest_equal_array_of_char take unsigned int lengths. + + * ktest_equal.h: Add len_unsigned_array macro for a prototype of a + function taking an unsigned int + count. ktest_equal_array_of_octet() is one of + these. ktest_equal_array_of_char() takes an unsigned int as + length. + + * trval.c (trval): Unsigned/signed int fix. + + * utility.c (asn1_krb5_data_unparse): Better test for krb5_data + length being less than zero. + 2000-09-26 Ezra Peisach * krb5_decode_test.c (decode_run): If the ASN1 decoder returns an diff --git a/src/tests/asn.1/ktest.c b/src/tests/asn.1/ktest.c index 9e4a4521c..af02d1ad7 100644 --- a/src/tests/asn.1/ktest.c +++ b/src/tests/asn.1/ktest.c @@ -659,7 +659,7 @@ krb5_error_code ktest_make_sample_etype_info(p) info[i]->magic = KV5M_ETYPE_INFO_ENTRY; } free(info[1]->salt); - info[1]->length = -1; + info[1]->length = KRB5_ETYPE_NO_SALT; info[1]->salt = 0; *p = info; return 0; diff --git a/src/tests/asn.1/ktest_equal.c b/src/tests/asn.1/ktest_equal.c index af03c84ff..7f2fa44b1 100644 --- a/src/tests/asn.1/ktest_equal.c +++ b/src/tests/asn.1/ktest_equal.c @@ -486,7 +486,7 @@ int ktest_equal_krb5_etype_info_entry(ref, var) return FALSE; if (ref->length != var->length) return FALSE; - if (ref->length > 0) + if (ref->length > 0 && ref->length != KRB5_ETYPE_NO_SALT) if (memcmp(ref->salt, var->salt, ref->length) != 0) return FALSE; return TRUE; @@ -560,7 +560,7 @@ int ktest_equal_array_of_data(length, ref, var) } int ktest_equal_array_of_octet(length, ref, var) - const int length; + const unsigned int length; krb5_octet * ref; krb5_octet * var; { @@ -574,7 +574,7 @@ int ktest_equal_array_of_octet(length, ref, var) } int ktest_equal_array_of_char(length, ref, var) - const int length; + const unsigned int length; char * ref; char * var; { diff --git a/src/tests/asn.1/ktest_equal.h b/src/tests/asn.1/ktest_equal.h index 5ffa30925..aa150f231 100644 --- a/src/tests/asn.1/ktest_equal.h +++ b/src/tests/asn.1/ktest_equal.h @@ -14,6 +14,8 @@ int funcname KRB5_PROTOTYPE((type *ref, type *var)) #define len_array(funcname,type)\ int funcname KRB5_PROTOTYPE((const int length, type *ref, type *var)) +#define len_unsigned_array(funcname,type)\ +int funcname KRB5_PROTOTYPE((const unsigned int length, type *ref, type *var)) generic(ktest_equal_authenticator,krb5_authenticator); generic(ktest_equal_principal_data,krb5_principal_data); @@ -69,7 +71,7 @@ int ktest_equal_sequence_of_cred_info len_array(ktest_equal_array_of_enctype,krb5_enctype); len_array(ktest_equal_array_of_data,krb5_data); -len_array(ktest_equal_array_of_octet,krb5_octet); +len_unsigned_array(ktest_equal_array_of_octet,krb5_octet); int ktest_equal_array_of_passwd_phrase_element KRB5_PROTOTYPE((passwd_phrase_element **ref, passwd_phrase_element **var)); @@ -78,13 +80,13 @@ int ktest_equal_authorization_data int ktest_equal_addresses KRB5_PROTOTYPE((krb5_address **ref, krb5_address **var)); int ktest_equal_array_of_char - KRB5_PROTOTYPE((const int length, char *ref, char *var)); + KRB5_PROTOTYPE((const unsigned int length, char *ref, char *var)); int ktest_equal_etype_info KRB5_PROTOTYPE((krb5_etype_info_entry ** ref, krb5_etype_info_entry ** var)); -int ktest_equal_etype_info_entry +int ktest_equal_krb5_etype_info_entry KRB5_PROTOTYPE((krb5_etype_info_entry * ref, krb5_etype_info_entry * var)); diff --git a/src/tests/asn.1/trval.c b/src/tests/asn.1/trval.c index 6c1608c45..bb7d2701b 100644 --- a/src/tests/asn.1/trval.c +++ b/src/tests/asn.1/trval.c @@ -212,7 +212,7 @@ int trval(fin, fout) FILE *fout; { unsigned char *p; - int maxlen; + unsigned int maxlen; int len; int cc, cc2, n1, n2; int r; diff --git a/src/tests/asn.1/utility.c b/src/tests/asn.1/utility.c index 0831a0864..f2dda9e2d 100644 --- a/src/tests/asn.1/utility.c +++ b/src/tests/asn.1/utility.c @@ -15,7 +15,7 @@ asn1_error_code asn1_krb5_data_unparse(code, s) *s = (char*)calloc(strlen("")+1, sizeof(char)); if(*s == NULL) return ENOMEM; strcpy(*s,""); - }else if(code->data == NULL || code->length <= 0){ + }else if(code->data == NULL || ((int) code->length) <= 0){ *s = (char*)calloc(strlen("")+1, sizeof(char)); if(*s==NULL) return ENOMEM; strcpy(*s,"");