* ktest.c (ktest_make_sample_etype_info): Use KRB5_ETYPE_NO_SALT
authorEzra Peisach <epeisach@mit.edu>
Tue, 17 Oct 2000 23:05:24 +0000 (23:05 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 17 Oct 2000 23:05:24 +0000 (23:05 +0000)
        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

src/tests/asn.1/ChangeLog
src/tests/asn.1/ktest.c
src/tests/asn.1/ktest_equal.c
src/tests/asn.1/ktest_equal.h
src/tests/asn.1/trval.c
src/tests/asn.1/utility.c

index be4f33196ee3e49c99ddf0b81dc2581d43e44d63..08f8a9b5756f3253c7bdf2908c9ce979080b54fe 100644 (file)
@@ -1,3 +1,23 @@
+2000-10-17  Ezra Peisach  <epeisach@mit.edu>
+
+       * 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  <epeisach@mit.edu>
 
        * krb5_decode_test.c (decode_run): If the ASN1 decoder returns an
index 9e4a4521c7cdea0ca12cc86f1fb713a070128014..af02d1ad7331d94135f3f7e953f816c19868bb0e 100644 (file)
@@ -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;
index af03c84ff985ecc4125a262edf2cccec0b9212fd..7f2fa44b1ea09975b0a413543bc216eee08bac3a 100644 (file)
@@ -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;
 {
index 5ffa30925c3bad6572a5551d8d241172d0a691c3..aa150f2316556a41c1b46322f91482d9b299a91d 100644 (file)
@@ -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));
 
index 6c1608c45cac7700391e63336409d830c613d214..bb7d2701b9460c930e4402f2a29e249fb7926982 100644 (file)
@@ -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;
index 0831a0864e41052369b71e50509a70ee0a9cf300..f2dda9e2d46a7344fa3f0e4c14e82af2b0f8fbdf 100644 (file)
@@ -15,7 +15,7 @@ asn1_error_code asn1_krb5_data_unparse(code, s)
     *s = (char*)calloc(strlen("<NULL>")+1, sizeof(char));
     if(*s == NULL) return ENOMEM;
     strcpy(*s,"<NULL>");
-  }else if(code->data == NULL || code->length <= 0){
+  }else if(code->data == NULL || ((int) code->length) <= 0){
     *s = (char*)calloc(strlen("<EMPTY>")+1, sizeof(char));
     if(*s==NULL) return ENOMEM;
     strcpy(*s,"<EMPTY>");