From: Greg Hudson Date: Sat, 11 Feb 2012 23:24:58 +0000 (+0000) Subject: Add ASN.1 decoder test for krb5_pa_pac_req X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9f9201c7563be17aeec15a25da8662e1abef2de7;p=krb5.git 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. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25685 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/tests/asn.1/krb5_decode_test.c b/src/tests/asn.1/krb5_decode_test.c index c85c77a8c..811f230c6 100644 --- a/src/tests/asn.1/krb5_decode_test.c +++ b/src/tests/asn.1/krb5_decode_test.c @@ -533,6 +533,7 @@ int main(argc, argv) retval = decode_krb5_ap_rep_enc_part(&code, &var); if (retval != ASN1_OVERRUN) { printf("ERROR: "); + error_count++; } else { printf("OK: "); } @@ -900,6 +901,35 @@ int main(argc, argv) ktest_empty_pa_s4u_x509_user(&ref); } + /****************************************************************/ + /* 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 */ {