svn rev #25685: trunk/src/tests/asn.1/

ghudson@MIT.EDU ghudson at MIT.EDU
Sat Feb 11 18:24:58 EST 2012


http://src.mit.edu/fisheye/changelog/krb5/?cs=25685
Commit By: ghudson
Log Message:
Add ASN.1 decoder test for krb5_pa_pac_req

Also, if decode_krb5_ap_rep_enc_part doesn't return the expected error
code in krb5_decode_test, exit with nonzero status.


Changed Files:
U   trunk/src/tests/asn.1/krb5_decode_test.c
Modified: trunk/src/tests/asn.1/krb5_decode_test.c
===================================================================
--- trunk/src/tests/asn.1/krb5_decode_test.c	2012-02-11 23:24:52 UTC (rev 25684)
+++ trunk/src/tests/asn.1/krb5_decode_test.c	2012-02-11 23:24:58 UTC (rev 25685)
@@ -533,6 +533,7 @@
         retval = decode_krb5_ap_rep_enc_part(&code, &var);
         if (retval != ASN1_OVERRUN) {
             printf("ERROR: ");
+            error_count++;
         } else {
             printf("OK: ");
         }
@@ -901,6 +902,35 @@
     }
 
     /****************************************************************/
+    /* decode_pa_pac_req */
+    {
+        /* This type has no encoder and is very simple.  Test two
+         * hand-generated encodings. */
+        krb5_pa_pac_req *req1 = NULL, *req2 = NULL;
+        code = make_data("\x30\x05\xA0\x03\x01\x01\x00", 7);
+        retval = decode_krb5_pa_pac_req(&code, &req1);
+        if (retval) {
+            com_err(argv[0], retval, "while decoding PA-PAC-REQ");
+            exit(1);
+        }
+        code = make_data("\x30\x05\xA0\x03\x01\x01\xFF", 7);
+        retval = decode_krb5_pa_pac_req(&code, &req2);
+        if (retval) {
+            com_err(argv[0], retval, "while decoding PA-PAC-REQ");
+            exit(1);
+        }
+        if (req1->include_pac != 0 || req2->include_pac != 1) {
+            printf("ERROR: ");
+            error_count++;
+        } else {
+            printf("OK: ");
+        }
+        printf("pa_pac_rec\n");
+        free(req1);
+        free(req2);
+    }
+
+    /****************************************************************/
     /* decode_ad_kdcissued */
     {
         setup(krb5_ad_kdcissued,ktest_make_sample_ad_kdcissued);



More information about the cvs-krb5 mailing list