diff options
author | Greg Hudson <ghudson@mit.edu> | 2012-02-12 05:25:22 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2012-02-12 05:25:22 +0000 |
commit | 0d975e2701abe3fbcd1bec213fdadc4e09b2b636 (patch) | |
tree | 5aae7453648c6c15dd49284c92d8ce7731541483 /src/tests/asn.1/krb5_decode_test.c | |
parent | 9f23e1a8133c11bff4ef5f41cb44d28041320a76 (diff) | |
download | krb5-0d975e2701abe3fbcd1bec213fdadc4e09b2b636.tar.gz krb5-0d975e2701abe3fbcd1bec213fdadc4e09b2b636.tar.xz krb5-0d975e2701abe3fbcd1bec213fdadc4e09b2b636.zip |
Convert utility functions to new decoder
Create a special type to plug authdata types from authdata and make
krb5int_get_authdata_containee_types use it. Add a test case for it
as well. Move krb5_decode_ticket (a trivial wrapper) into
asn1_k_encode.c so that krb5_decode.c is empty.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25694 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/tests/asn.1/krb5_decode_test.c')
-rw-r--r-- | src/tests/asn.1/krb5_decode_test.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/tests/asn.1/krb5_decode_test.c b/src/tests/asn.1/krb5_decode_test.c index eb0fc8dbb..7e1f6feae 100644 --- a/src/tests/asn.1/krb5_decode_test.c +++ b/src/tests/asn.1/krb5_decode_test.c @@ -728,9 +728,11 @@ int main(argc, argv) } /****************************************************************/ - /* decode_krb5_authdata */ + /* decode_krb5_authdata and krb5int_get_authdata_containee_types */ { - krb5_authdata **ref, **var; + krb5_authdata **ref, **var, tmp; + unsigned int count; + krb5_authdatatype *types = NULL; ktest_make_sample_authorization_data(&ref); retval = krb5_data_hex_parse(&code,"30 22 30 0F A0 03 02 01 01 A1 08 04 06 66 6F 6F 62 61 72 30 0F A0 03 02 01 01 A1 08 04 06 66 6F 6F 62 61 72"); if (retval) { @@ -739,8 +741,16 @@ int main(argc, argv) } retval = decode_krb5_authdata(&code,&var); if (retval) com_err("decoding authorization_data",retval,""); - test(ktest_equal_authorization_data(ref,var),"authorization_data\n") - krb5_free_data_contents(test_context, &code); + test(ktest_equal_authorization_data(ref,var),"authorization_data\n"); + tmp.length = code.length; + tmp.contents = (krb5_octet *)code.data; + retval = krb5int_get_authdata_containee_types(test_context, &tmp, + &count, &types); + if (retval) com_err("reading authdata types",retval,""); + test(count == 2 && types[0] == 1 && types[1] == 1, + "authorization_data(types only)\n"); + free(types); + krb5_free_data_contents(test_context, &code); krb5_free_authdata(test_context, var); ktest_destroy_authorization_data(&ref); } |