diff options
-rw-r--r-- | src/tests/asn.1/krb5_decode_test.c | 1554 | ||||
-rw-r--r-- | src/tests/asn.1/krb5_encode_test.c | 1134 | ||||
-rw-r--r-- | src/tests/asn.1/ktest.c | 1578 | ||||
-rw-r--r-- | src/tests/asn.1/ktest_equal.c | 874 | ||||
-rw-r--r-- | src/tests/asn.1/t_trval.c | 100 | ||||
-rw-r--r-- | src/tests/asn.1/trval.c | 1018 | ||||
-rw-r--r-- | src/tests/asn.1/utility.c | 116 |
7 files changed, 3187 insertions, 3187 deletions
diff --git a/src/tests/asn.1/krb5_decode_test.c b/src/tests/asn.1/krb5_decode_test.c index bd42508654..a84ac59833 100644 --- a/src/tests/asn.1/krb5_decode_test.c +++ b/src/tests/asn.1/krb5_decode_test.c @@ -16,237 +16,237 @@ void krb5_ktest_free_pwd_sequence(krb5_context context, void krb5_ktest_free_enc_data(krb5_context context, krb5_enc_data *val); int main(argc, argv) - int argc; - char **argv; + int argc; + char **argv; { - krb5_data code; - krb5_error_code retval; - - retval = krb5_init_context(&test_context); - if (retval) { - com_err(argv[0], retval, "while initializing krb5"); - exit(1); - } - - -#define setup(type,typestring,constructor)\ - type ref, *var;\ - retval = constructor(&ref);\ - if(retval){\ - com_err("krb5_decode_test", retval, "while making sample %s", typestring);\ - exit(1);\ - } - -#define decode_run(typestring,description,encoding,decoder,comparator,cleanup)\ - retval = krb5_data_hex_parse(&code,encoding);\ - if(retval){\ - com_err("krb5_decode_test", retval, "while parsing %s", typestring);\ - exit(1);\ - }\ - retval = decoder(&code,&var);\ - if(retval){\ - com_err("krb5_decode_test", retval, "while decoding %s", typestring);\ - error_count++;\ - }\ - test(comparator(&ref,var),typestring);\ - printf("%s\n",description);\ - krb5_free_data_contents(test_context, &code);\ + krb5_data code; + krb5_error_code retval; + + retval = krb5_init_context(&test_context); + if (retval) { + com_err(argv[0], retval, "while initializing krb5"); + exit(1); + } + + +#define setup(type,typestring,constructor) \ + type ref, *var; \ + retval = constructor(&ref); \ + if (retval) { \ + com_err("krb5_decode_test", retval, "while making sample %s", typestring); \ + exit(1); \ + } + +#define decode_run(typestring,description,encoding,decoder,comparator,cleanup) \ + retval = krb5_data_hex_parse(&code,encoding); \ + if (retval) { \ + com_err("krb5_decode_test", retval, "while parsing %s", typestring); \ + exit(1); \ + } \ + retval = decoder(&code,&var); \ + if (retval) { \ + com_err("krb5_decode_test", retval, "while decoding %s", typestring); \ + error_count++; \ + } \ + test(comparator(&ref,var),typestring); \ + printf("%s\n",description); \ + krb5_free_data_contents(test_context, &code); \ cleanup(test_context, var); - /****************************************************************/ - /* decode_krb5_authenticator */ - { - setup(krb5_authenticator,"krb5_authenticator",ktest_make_sample_authenticator); - - decode_run("authenticator","","62 81 A1 30 81 9E A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34 A4 05 02 03 01 E2 40 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A7 03 02 01 11 A8 24 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",decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); - - ref.seq_number = 0xffffff80; - decode_run("authenticator","(80 -> seq-number 0xffffff80)", - "62 81 A1 30 81 9E" - " A0 03 02 01 05" - " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" - " A2 1A 30 18" - " A0 03 02 01 01" - " A1 11 30 0F" - " 1B 06 68 66 74 73 61 69" - " 1B 05 65 78 74 72 61" - " A3 0F 30 0D" - " A0 03 02 01 01" - " A1 06 04 04 31 32 33 34" - " A4 05 02 03 01 E2 40" - " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" - " A6 13 30 11" - " A0 03 02 01 01" - " A1 0A 04 08 31 32 33 34 35 36 37 38" - " A7 03 02 01 80" - " A8 24 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" - ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); - - ref.seq_number = 0xffffffff; - decode_run("authenticator","(FF -> seq-number 0xffffffff)", - "62 81 A1 30 81 9E" - " A0 03 02 01 05" - " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" - " A2 1A 30 18" - " A0 03 02 01 01" - " A1 11 30 0F" - " 1B 06 68 66 74 73 61 69" - " 1B 05 65 78 74 72 61" - " A3 0F 30 0D" - " A0 03 02 01 01" - " A1 06 04 04 31 32 33 34" - " A4 05 02 03 01 E2 40" - " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" - " A6 13 30 11" - " A0 03 02 01 01" - " A1 0A 04 08 31 32 33 34 35 36 37 38" - " A7 03 02 01 FF" - " A8 24 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" - ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); - - ref.seq_number = 0xff; - decode_run("authenticator","(00FF -> seq-number 0xff)", - "62 81 A2 30 81 9F" - " A0 03 02 01 05" - " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" - " A2 1A 30 18" - " A0 03 02 01 01" - " A1 11 30 0F" - " 1B 06 68 66 74 73 61 69" - " 1B 05 65 78 74 72 61" - " A3 0F 30 0D" - " A0 03 02 01 01" - " A1 06 04 04 31 32 33 34" - " A4 05 02 03 01 E2 40" - " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" - " A6 13 30 11" - " A0 03 02 01 01" - " A1 0A 04 08 31 32 33 34 35 36 37 38" - " A7 04 02 02 00 FF" - " A8 24 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" - ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); - - ref.seq_number = 0xffffffff; - decode_run("authenticator","(00FFFFFFFF -> seq-number 0xffffffff)", - "62 81 A5 30 81 A2" - " A0 03 02 01 05" - " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" - " A2 1A 30 18" - " A0 03 02 01 01" - " A1 11 30 0F" - " 1B 06 68 66 74 73 61 69" - " 1B 05 65 78 74 72 61" - " A3 0F 30 0D" - " A0 03 02 01 01" - " A1 06 04 04 31 32 33 34" - " A4 05 02 03 01 E2 40" - " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" - " A6 13 30 11" - " A0 03 02 01 01" - " A1 0A 04 08 31 32 33 34 35 36 37 38" - " A7 07 02 05 00 FF FF FF FF" - " A8 24 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" - ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); - - ref.seq_number = 0x7fffffff; - decode_run("authenticator","(7FFFFFFF -> seq-number 0x7fffffff)", - "62 81 A4 30 81 A1" - " A0 03 02 01 05" - " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" - " A2 1A 30 18" - " A0 03 02 01 01" - " A1 11 30 0F" - " 1B 06 68 66 74 73 61 69" - " 1B 05 65 78 74 72 61" - " A3 0F 30 0D" - " A0 03 02 01 01" - " A1 06 04 04 31 32 33 34" - " A4 05 02 03 01 E2 40" - " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" - " A6 13 30 11" - " A0 03 02 01 01" - " A1 0A 04 08 31 32 33 34 35 36 37 38" - " A7 06 02 04 7F FF FF FF" - " A8 24 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" - ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); - - ref.seq_number = 0xffffffff; - decode_run("authenticator","(FFFFFFFF -> seq-number 0xffffffff)", - "62 81 A4 30 81 A1" - " A0 03 02 01 05" - " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" - " A2 1A 30 18" - " A0 03 02 01 01" - " A1 11 30 0F" - " 1B 06 68 66 74 73 61 69" - " 1B 05 65 78 74 72 61" - " A3 0F 30 0D" - " A0 03 02 01 01" - " A1 06 04 04 31 32 33 34" - " A4 05 02 03 01 E2 40" - " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" - " A6 13 30 11" - " A0 03 02 01 01" - " A1 0A 04 08 31 32 33 34 35 36 37 38" - " A7 06 02 04 FF FF FF FF" - " A8 24 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" - ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); - - ktest_destroy_checksum(&(ref.checksum)); - ktest_destroy_keyblock(&(ref.subkey)); - ref.seq_number = 0; - ktest_empty_authorization_data(ref.authorization_data); - decode_run("authenticator","(optionals empty)","62 4F 30 4D A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 05 02 03 01 E2 40 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); - - ktest_destroy_authorization_data(&(ref.authorization_data)); + /****************************************************************/ + /* decode_krb5_authenticator */ + { + setup(krb5_authenticator,"krb5_authenticator",ktest_make_sample_authenticator); + + decode_run("authenticator","","62 81 A1 30 81 9E A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34 A4 05 02 03 01 E2 40 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A7 03 02 01 11 A8 24 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",decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); + + ref.seq_number = 0xffffff80; + decode_run("authenticator","(80 -> seq-number 0xffffff80)", + "62 81 A1 30 81 9E" + " A0 03 02 01 05" + " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" + " A2 1A 30 18" + " A0 03 02 01 01" + " A1 11 30 0F" + " 1B 06 68 66 74 73 61 69" + " 1B 05 65 78 74 72 61" + " A3 0F 30 0D" + " A0 03 02 01 01" + " A1 06 04 04 31 32 33 34" + " A4 05 02 03 01 E2 40" + " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" + " A6 13 30 11" + " A0 03 02 01 01" + " A1 0A 04 08 31 32 33 34 35 36 37 38" + " A7 03 02 01 80" + " A8 24 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" + ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); + + ref.seq_number = 0xffffffff; + decode_run("authenticator","(FF -> seq-number 0xffffffff)", + "62 81 A1 30 81 9E" + " A0 03 02 01 05" + " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" + " A2 1A 30 18" + " A0 03 02 01 01" + " A1 11 30 0F" + " 1B 06 68 66 74 73 61 69" + " 1B 05 65 78 74 72 61" + " A3 0F 30 0D" + " A0 03 02 01 01" + " A1 06 04 04 31 32 33 34" + " A4 05 02 03 01 E2 40" + " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" + " A6 13 30 11" + " A0 03 02 01 01" + " A1 0A 04 08 31 32 33 34 35 36 37 38" + " A7 03 02 01 FF" + " A8 24 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" + ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); + + ref.seq_number = 0xff; + decode_run("authenticator","(00FF -> seq-number 0xff)", + "62 81 A2 30 81 9F" + " A0 03 02 01 05" + " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" + " A2 1A 30 18" + " A0 03 02 01 01" + " A1 11 30 0F" + " 1B 06 68 66 74 73 61 69" + " 1B 05 65 78 74 72 61" + " A3 0F 30 0D" + " A0 03 02 01 01" + " A1 06 04 04 31 32 33 34" + " A4 05 02 03 01 E2 40" + " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" + " A6 13 30 11" + " A0 03 02 01 01" + " A1 0A 04 08 31 32 33 34 35 36 37 38" + " A7 04 02 02 00 FF" + " A8 24 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" + ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); + + ref.seq_number = 0xffffffff; + decode_run("authenticator","(00FFFFFFFF -> seq-number 0xffffffff)", + "62 81 A5 30 81 A2" + " A0 03 02 01 05" + " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" + " A2 1A 30 18" + " A0 03 02 01 01" + " A1 11 30 0F" + " 1B 06 68 66 74 73 61 69" + " 1B 05 65 78 74 72 61" + " A3 0F 30 0D" + " A0 03 02 01 01" + " A1 06 04 04 31 32 33 34" + " A4 05 02 03 01 E2 40" + " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" + " A6 13 30 11" + " A0 03 02 01 01" + " A1 0A 04 08 31 32 33 34 35 36 37 38" + " A7 07 02 05 00 FF FF FF FF" + " A8 24 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" + ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); + + ref.seq_number = 0x7fffffff; + decode_run("authenticator","(7FFFFFFF -> seq-number 0x7fffffff)", + "62 81 A4 30 81 A1" + " A0 03 02 01 05" + " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" + " A2 1A 30 18" + " A0 03 02 01 01" + " A1 11 30 0F" + " 1B 06 68 66 74 73 61 69" + " 1B 05 65 78 74 72 61" + " A3 0F 30 0D" + " A0 03 02 01 01" + " A1 06 04 04 31 32 33 34" + " A4 05 02 03 01 E2 40" + " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" + " A6 13 30 11" + " A0 03 02 01 01" + " A1 0A 04 08 31 32 33 34 35 36 37 38" + " A7 06 02 04 7F FF FF FF" + " A8 24 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" + ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); + + ref.seq_number = 0xffffffff; + decode_run("authenticator","(FFFFFFFF -> seq-number 0xffffffff)", + "62 81 A4 30 81 A1" + " A0 03 02 01 05" + " A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55" + " A2 1A 30 18" + " A0 03 02 01 01" + " A1 11 30 0F" + " 1B 06 68 66 74 73 61 69" + " 1B 05 65 78 74 72 61" + " A3 0F 30 0D" + " A0 03 02 01 01" + " A1 06 04 04 31 32 33 34" + " A4 05 02 03 01 E2 40" + " A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A" + " A6 13 30 11" + " A0 03 02 01 01" + " A1 0A 04 08 31 32 33 34 35 36 37 38" + " A7 06 02 04 FF FF FF FF" + " A8 24 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" + ,decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); + + ktest_destroy_checksum(&(ref.checksum)); + ktest_destroy_keyblock(&(ref.subkey)); + ref.seq_number = 0; + ktest_empty_authorization_data(ref.authorization_data); + decode_run("authenticator","(optionals empty)","62 4F 30 4D A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 05 02 03 01 E2 40 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); + + ktest_destroy_authorization_data(&(ref.authorization_data)); - decode_run("authenticator","(optionals NULL)","62 4F 30 4D A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 05 02 03 01 E2 40 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); + decode_run("authenticator","(optionals NULL)","62 4F 30 4D A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 05 02 03 01 E2 40 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_authenticator,ktest_equal_authenticator,krb5_free_authenticator); - ktest_empty_authenticator(&ref); - } + ktest_empty_authenticator(&ref); + } - /****************************************************************/ - /* decode_krb5_ticket */ - { - setup(krb5_ticket,"krb5_ticket",ktest_make_sample_ticket); - decode_run("ticket","","61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_ticket,ktest_equal_ticket,krb5_free_ticket); - decode_run("ticket","(+ trailing [4] INTEGER","61 61 30 5F A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A4 03 02 01 01",decode_krb5_ticket,ktest_equal_ticket,krb5_free_ticket); + /****************************************************************/ + /* decode_krb5_ticket */ + { + setup(krb5_ticket,"krb5_ticket",ktest_make_sample_ticket); + decode_run("ticket","","61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_ticket,ktest_equal_ticket,krb5_free_ticket); + decode_run("ticket","(+ trailing [4] INTEGER","61 61 30 5F A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A4 03 02 01 01",decode_krb5_ticket,ktest_equal_ticket,krb5_free_ticket); /* "61 80 30 80 " @@ -267,7 +267,7 @@ int main(argc, argv) " 00 00 00 00" "00 00 00 00" */ - decode_run("ticket","(indefinite lengths)", "61 80 30 80 A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 80 30 80 A0 03 02 01 01 A1 80 30 80 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 00 00 00 00 00 00 00 00 A3 80 30 80 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 00 00 00 00 00 00 00 00" ,decode_krb5_ticket,ktest_equal_ticket,krb5_free_ticket); + decode_run("ticket","(indefinite lengths)", "61 80 30 80 A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 80 30 80 A0 03 02 01 01 A1 80 30 80 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 00 00 00 00 00 00 00 00 A3 80 30 80 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 00 00 00 00 00 00 00 00" ,decode_krb5_ticket,ktest_equal_ticket,krb5_free_ticket); /* "61 80 30 80 " " A0 03 02 01 05 " @@ -288,617 +288,617 @@ int main(argc, argv) " A4 03 02 01 01 " "00 00 00 00" */ - decode_run("ticket","(indefinite lengths + trailing [4] INTEGER)", "61 80 30 80 A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 80 30 80 A0 03 02 01 01 A1 80 30 80 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 00 00 00 00 00 00 00 00 A3 80 30 80 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 00 00 00 00 A4 03 02 01 01 00 00 00 00",decode_krb5_ticket,ktest_equal_ticket,krb5_free_ticket); - - ktest_empty_ticket(&ref); - - } - - /****************************************************************/ - /* decode_krb5_encryption_key */ - { - setup(krb5_keyblock,"krb5_keyblock",ktest_make_sample_keyblock); - - decode_run("encryption_key","","30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - - decode_run("encryption_key","(+ trailing [2] INTEGER)","30 16 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 03 02 01 01",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - decode_run("encryption_key","(+ trailing [2] SEQUENCE {[0] INTEGER})","30 1A A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 07 30 05 A0 03 02 01 01",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - decode_run("encryption_key","(indefinite lengths)","30 80 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 00 00",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - decode_run("encryption_key","(indefinite lengths + trailing [2] INTEGER)","30 80 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 03 02 01 01 00 00",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - decode_run("encryption_key","(indefinite lengths + trailing [2] SEQUENCE {[0] INTEGER})","30 80 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 80 30 80 A0 03 02 01 01 00 00 00 00 00 00",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - decode_run("encryption_key","(indefinite lengths + trailing SEQUENCE {[0] INTEGER})","30 80 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 30 80 A0 03 02 01 01 00 00 00 00",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - ref.enctype = -1; - decode_run("encryption_key","(enctype = -1)","30 11 A0 03 02 01 FF A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - ref.enctype = -255; - decode_run("encryption_key","(enctype = -255)","30 12 A0 04 02 02 FF 01 A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - ref.enctype = 255; - decode_run("encryption_key","(enctype = 255)","30 12 A0 04 02 02 00 FF A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - ref.enctype = -2147483648U; - decode_run("encryption_key","(enctype = -2147483648)","30 14 A0 06 02 04 80 00 00 00 A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - ref.enctype = 2147483647; - decode_run("encryption_key","(enctype = 2147483647)","30 14 A0 06 02 04 7F FF FF FF A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); - - ktest_empty_keyblock(&ref); - } - - /****************************************************************/ - /* decode_krb5_enc_tkt_part */ - { - setup(krb5_enc_tkt_part,"krb5_enc_tkt_part",ktest_make_sample_enc_tkt_part); - decode_run("enc_tkt_part","","63 82 01 14 30 82 01 10 A0 07 03 05 00 FE DC BA 98 A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A9 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 AA 24 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",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part,krb5_free_enc_tkt_part); - - /* ref.times.starttime = 0; */ - ref.times.starttime = ref.times.authtime; - ref.times.renew_till = 0; - ktest_destroy_address(&(ref.caddrs[1])); - ktest_destroy_address(&(ref.caddrs[0])); - ktest_destroy_authdata(&(ref.authorization_data[1])); - ktest_destroy_authdata(&(ref.authorization_data[0])); - /* ISODE version fails on the empty caddrs field */ - ktest_destroy_addresses(&(ref.caddrs)); - ktest_destroy_authorization_data(&(ref.authorization_data)); - - decode_run("enc_tkt_part","(optionals NULL)","63 81 A5 30 81 A2 A0 07 03 05 00 FE DC BA 98 A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part, krb5_free_enc_tkt_part); - - decode_run("enc_tkt_part","(optionals NULL + bitstring enlarged to 38 bits)","63 81 A6 30 81 A3 A0 08 03 06 02 FE DC BA 98 DC A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part,krb5_free_enc_tkt_part); - - decode_run("enc_tkt_part","(optionals NULL + bitstring enlarged to 40 bits)","63 81 A6 30 81 A3 A0 08 03 06 00 FE DC BA 98 DE A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part,krb5_free_enc_tkt_part); - - decode_run("enc_tkt_part","(optionals NULL + bitstring reduced to 29 bits)","63 81 A5 30 81 A2 A0 07 03 05 03 FE DC BA 98 A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part,krb5_free_enc_tkt_part); + decode_run("ticket","(indefinite lengths + trailing [4] INTEGER)", "61 80 30 80 A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 80 30 80 A0 03 02 01 01 A1 80 30 80 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 00 00 00 00 00 00 00 00 A3 80 30 80 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 00 00 00 00 A4 03 02 01 01 00 00 00 00",decode_krb5_ticket,ktest_equal_ticket,krb5_free_ticket); - ref.flags &= 0xFFFFFF00; + ktest_empty_ticket(&ref); - decode_run("enc_tkt_part","(optionals NULL + bitstring reduced to 24 bits)","63 81 A4 30 81 A1 A0 06 03 04 00 FE DC BA A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part,krb5_free_enc_tkt_part); + } - ktest_empty_enc_tkt_part(&ref); - } - - /****************************************************************/ - /* decode_krb5_enc_kdc_rep_part */ - { - setup(krb5_enc_kdc_rep_part,"krb5_enc_kdc_rep_part",ktest_make_sample_enc_kdc_rep_part); + /****************************************************************/ + /* decode_krb5_encryption_key */ + { + setup(krb5_keyblock,"krb5_keyblock",ktest_make_sample_keyblock); + + decode_run("encryption_key","","30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + + decode_run("encryption_key","(+ trailing [2] INTEGER)","30 16 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 03 02 01 01",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + decode_run("encryption_key","(+ trailing [2] SEQUENCE {[0] INTEGER})","30 1A A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 07 30 05 A0 03 02 01 01",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + decode_run("encryption_key","(indefinite lengths)","30 80 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 00 00",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + decode_run("encryption_key","(indefinite lengths + trailing [2] INTEGER)","30 80 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 03 02 01 01 00 00",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + decode_run("encryption_key","(indefinite lengths + trailing [2] SEQUENCE {[0] INTEGER})","30 80 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 80 30 80 A0 03 02 01 01 00 00 00 00 00 00",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + decode_run("encryption_key","(indefinite lengths + trailing SEQUENCE {[0] INTEGER})","30 80 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 30 80 A0 03 02 01 01 00 00 00 00",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + ref.enctype = -1; + decode_run("encryption_key","(enctype = -1)","30 11 A0 03 02 01 FF A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + ref.enctype = -255; + decode_run("encryption_key","(enctype = -255)","30 12 A0 04 02 02 FF 01 A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + ref.enctype = 255; + decode_run("encryption_key","(enctype = 255)","30 12 A0 04 02 02 00 FF A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + ref.enctype = -2147483648U; + decode_run("encryption_key","(enctype = -2147483648)","30 14 A0 06 02 04 80 00 00 00 A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + ref.enctype = 2147483647; + decode_run("encryption_key","(enctype = 2147483647)","30 14 A0 06 02 04 7F FF FF FF A1 0A 04 08 31 32 33 34 35 36 37 38",decode_krb5_encryption_key,ktest_equal_encryption_key,krb5_free_keyblock); + + ktest_empty_keyblock(&ref); + } + + /****************************************************************/ + /* decode_krb5_enc_tkt_part */ + { + setup(krb5_enc_tkt_part,"krb5_enc_tkt_part",ktest_make_sample_enc_tkt_part); + decode_run("enc_tkt_part","","63 82 01 14 30 82 01 10 A0 07 03 05 00 FE DC BA 98 A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A9 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 AA 24 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",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part,krb5_free_enc_tkt_part); + + /* ref.times.starttime = 0; */ + ref.times.starttime = ref.times.authtime; + ref.times.renew_till = 0; + ktest_destroy_address(&(ref.caddrs[1])); + ktest_destroy_address(&(ref.caddrs[0])); + ktest_destroy_authdata(&(ref.authorization_data[1])); + ktest_destroy_authdata(&(ref.authorization_data[0])); + /* ISODE version fails on the empty caddrs field */ + ktest_destroy_addresses(&(ref.caddrs)); + ktest_destroy_authorization_data(&(ref.authorization_data)); + + decode_run("enc_tkt_part","(optionals NULL)","63 81 A5 30 81 A2 A0 07 03 05 00 FE DC BA 98 A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part, krb5_free_enc_tkt_part); + + decode_run("enc_tkt_part","(optionals NULL + bitstring enlarged to 38 bits)","63 81 A6 30 81 A3 A0 08 03 06 02 FE DC BA 98 DC A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part,krb5_free_enc_tkt_part); + + decode_run("enc_tkt_part","(optionals NULL + bitstring enlarged to 40 bits)","63 81 A6 30 81 A3 A0 08 03 06 00 FE DC BA 98 DE A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part,krb5_free_enc_tkt_part); + + decode_run("enc_tkt_part","(optionals NULL + bitstring reduced to 29 bits)","63 81 A5 30 81 A2 A0 07 03 05 03 FE DC BA 98 A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part,krb5_free_enc_tkt_part); + + ref.flags &= 0xFFFFFF00; + + decode_run("enc_tkt_part","(optionals NULL + bitstring reduced to 24 bits)","63 81 A4 30 81 A1 A0 06 03 04 00 FE DC BA A1 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 2E 30 2C A0 03 02 01 01 A1 25 04 23 45 44 55 2C 4D 49 54 2E 2C 41 54 48 45 4E 41 2E 2C 57 41 53 48 49 4E 47 54 4F 4E 2E 45 44 55 2C 43 53 2E A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_enc_tkt_part,ktest_equal_enc_tkt_part,krb5_free_enc_tkt_part); + + ktest_empty_enc_tkt_part(&ref); + } + + /****************************************************************/ + /* decode_krb5_enc_kdc_rep_part */ + { + setup(krb5_enc_kdc_rep_part,"krb5_enc_kdc_rep_part",ktest_make_sample_enc_kdc_rep_part); #ifdef KRB5_GENEROUS_LR_TYPE - decode_run("enc_kdc_rep_part","(compat_lr_type)","7A 82 01 10 30 82 01 0C A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 38 30 36 30 19 A0 04 02 02 00 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A 30 19 A0 04 02 02 00 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 03 02 01 2A A3 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A4 07 03 05 00 FE DC BA 98 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AB 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_kdc_rep_part,ktest_equal_enc_kdc_rep_part,krb5_free_enc_kdc_rep_part); + decode_run("enc_kdc_rep_part","(compat_lr_type)","7A 82 01 10 30 82 01 0C A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 38 30 36 30 19 A0 04 02 02 00 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A 30 19 A0 04 02 02 00 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 03 02 01 2A A3 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A4 07 03 05 00 FE DC BA 98 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AB 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_kdc_rep_part,ktest_equal_enc_kdc_rep_part,krb5_free_enc_kdc_rep_part); #endif - decode_run("enc_kdc_rep_part","","7A 82 01 0E 30 82 01 0A A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 36 30 34 30 18 A0 03 02 01 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A 30 18 A0 03 02 01 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 03 02 01 2A A3 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A4 07 03 05 00 FE DC BA 98 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AB 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_kdc_rep_part,ktest_equal_enc_kdc_rep_part,krb5_free_enc_kdc_rep_part); + decode_run("enc_kdc_rep_part","","7A 82 01 0E 30 82 01 0A A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 36 30 34 30 18 A0 03 02 01 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A 30 18 A0 03 02 01 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 03 02 01 2A A3 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A4 07 03 05 00 FE DC BA 98 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AB 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_kdc_rep_part,ktest_equal_enc_kdc_rep_part,krb5_free_enc_kdc_rep_part); - ref.key_exp = 0; - /* ref.times.starttime = 0;*/ - ref.times.starttime = ref.times.authtime; - ref.times.renew_till = 0; - ref.flags &= ~TKT_FLG_RENEWABLE; - ktest_destroy_addresses(&(ref.caddrs)); + ref.key_exp = 0; + /* ref.times.starttime = 0;*/ + ref.times.starttime = ref.times.authtime; + ref.times.renew_till = 0; + ref.flags &= ~TKT_FLG_RENEWABLE; + ktest_destroy_addresses(&(ref.caddrs)); #ifdef KRB5_GENEROUS_LR_TYPE - decode_run("enc_kdc_rep_part","(optionals NULL)(compat lr_type)","7A 81 B4 30 81 B1 A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 38 30 36 30 19 A0 04 02 02 00 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A 30 19 A0 04 02 02 00 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 03 02 01 2A A4 07 03 05 00 FE 5C BA 98 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61",decode_krb5_enc_kdc_rep_part,ktest_equal_enc_kdc_rep_part,krb5_free_enc_kdc_rep_part); + decode_run("enc_kdc_rep_part","(optionals NULL)(compat lr_type)","7A 81 B4 30 81 B1 A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 38 30 36 30 19 A0 04 02 02 00 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A 30 19 A0 04 02 02 00 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 03 02 01 2A A4 07 03 05 00 FE 5C BA 98 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61",decode_krb5_enc_kdc_rep_part,ktest_equal_enc_kdc_rep_part,krb5_free_enc_kdc_rep_part); #endif - decode_run("enc_kdc_rep_part","(optionals NULL)","7A 81 B2 30 81 AF A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 36 30 34 30 18 A0 03 02 01 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A 30 18 A0 03 02 01 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 03 02 01 2A A4 07 03 05 00 FE 5C BA 98 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61",decode_krb5_enc_kdc_rep_part,ktest_equal_enc_kdc_rep_part,krb5_free_enc_kdc_rep_part); + decode_run("enc_kdc_rep_part","(optionals NULL)","7A 81 B2 30 81 AF A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 36 30 34 30 18 A0 03 02 01 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A 30 18 A0 03 02 01 FB A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 03 02 01 2A A4 07 03 05 00 FE 5C BA 98 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61",decode_krb5_enc_kdc_rep_part,ktest_equal_enc_kdc_rep_part,krb5_free_enc_kdc_rep_part); - ktest_empty_enc_kdc_rep_part(&ref); - } + ktest_empty_enc_kdc_rep_part(&ref); + } - /****************************************************************/ - /* decode_krb5_as_rep */ - { - setup(krb5_kdc_rep,"krb5_kdc_rep",ktest_make_sample_kdc_rep); - ref.msg_type = KRB5_AS_REP; + /****************************************************************/ + /* decode_krb5_as_rep */ + { + setup(krb5_kdc_rep,"krb5_kdc_rep",ktest_make_sample_kdc_rep); + ref.msg_type = KRB5_AS_REP; - decode_run("as_rep","","6B 81 EA 30 81 E7 A0 03 02 01 05 A1 03 02 01 0B A2 26 30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A4 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 5E 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A6 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_as_rep,ktest_equal_as_rep,krb5_free_kdc_rep); + decode_run("as_rep","","6B 81 EA 30 81 E7 A0 03 02 01 05 A1 03 02 01 0B A2 26 30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A4 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 5E 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A6 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_as_rep,ktest_equal_as_rep,krb5_free_kdc_rep); /* 6B 80 30 80 - A0 03 02 01 05 - A1 03 02 01 0B - A2 80 30 80 - 30 80 - A1 03 02 01 0D - A2 09 04 07 70 61 2D 64 61 74 61 - 00 00 - 30 80 - A1 03 02 01 0D - A2 09 04 07 70 61 2D 64 61 74 61 - 00 00 - 00 00 00 00 - A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 - A4 80 30 80 - A0 03 02 01 01 - A1 80 30 80 - 1B 06 68 66 74 73 61 69 - 1B 05 65 78 74 72 61 - 00 00 00 00 - 00 00 00 00 - A5 80 61 80 30 80 - A0 03 02 01 05 - A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 - A2 80 30 80 - A0 03 02 01 01 - A1 80 30 80 - 1B 06 68 66 74 73 61 69 - 1B 05 65 78 74 72 61 - 00 00 00 00 - 00 00 00 00 - A3 80 30 80 - A0 03 02 01 00 - A1 03 02 01 05 - A2 17 04 15 6B 72 62 41 53 4E 2E 31 - 20 74 65 73 74 20 6D 65 - 73 73 61 67 65 - 00 00 00 00 - 00 00 00 00 00 00 - A6 80 30 80 - A0 03 02 01 00 - A1 03 02 01 05 - A2 17 04 15 6B 72 62 41 53 4E 2E 31 - 20 74 65 73 74 20 6D 65 - 73 73 61 67 65 - 00 00 00 00 + A0 03 02 01 05 + A1 03 02 01 0B + A2 80 30 80 + 30 80 + A1 03 02 01 0D + A2 09 04 07 70 61 2D 64 61 74 61 + 00 00 + 30 80 + A1 03 02 01 0D + A2 09 04 07 70 61 2D 64 61 74 61 + 00 00 + 00 00 00 00 + A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 + A4 80 30 80 + A0 03 02 01 01 + A1 80 30 80 + 1B 06 68 66 74 73 61 69 + 1B 05 65 78 74 72 61 + 00 00 00 00 + 00 00 00 00 + A5 80 61 80 30 80 + A0 03 02 01 05 + A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 + A2 80 30 80 + A0 03 02 01 01 + A1 80 30 80 + 1B 06 68 66 74 73 61 69 + 1B 05 65 78 74 72 61 + 00 00 00 00 + 00 00 00 00 + A3 80 30 80 + A0 03 02 01 00 + A1 03 02 01 05 + A2 17 04 15 6B 72 62 41 53 4E 2E 31 + 20 74 65 73 74 20 6D 65 + 73 73 61 67 65 + 00 00 00 00 + 00 00 00 00 00 00 + A6 80 30 80 + A0 03 02 01 00 + A1 03 02 01 05 + A2 17 04 15 6B 72 62 41 53 4E 2E 31 + 20 74 65 73 74 20 6D 65 + 73 73 61 67 65 + 00 00 00 00 00 00 00 00 */ - decode_run("as_rep","(indefinite lengths)","6B 80 30 80 A0 03 02 01 05 A1 03 02 01 0B A2 80 30 80 30 80 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 00 00 30 80 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 00 00 00 00 00 00 A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A4 80 30 80 A0 03 02 01 01 A1 80 30 80 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 00 00 00 00 00 00 00 00 A5 80 61 80 30 80 A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 80 30 80 A0 03 02 01 01 A1 80 30 80 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 00 00 00 00 00 00 00 00 A3 80 30 80 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 00 00 00 00 00 00 00 00 00 00 A6 80 30 80 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 00 00 00 00 00 00 00 00",decode_krb5_as_rep,ktest_equal_as_rep,krb5_free_kdc_rep); - ktest_destroy_pa_data_array(&(ref.padata)); - decode_run("as_rep","(optionals NULL)","6B 81 C2 30 81 BF A0 03 02 01 05 A1 03 02 01 0B A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A4 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 5E 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A6 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_as_rep,ktest_equal_as_rep,krb5_free_kdc_rep); - - ktest_empty_kdc_rep(&ref); - } - - /****************************************************************/ - /* decode_krb5_tgs_rep */ - { - setup(krb5_kdc_rep,"krb5_kdc_rep",ktest_make_sample_kdc_rep); - ref.msg_type = KRB5_TGS_REP; - - decode_run("tgs_rep","","6D 81 EA 30 81 E7 A0 03 02 01 05 A1 03 02 01 0D A2 26 30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A4 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 5E 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A6 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_tgs_rep,ktest_equal_tgs_rep,krb5_free_kdc_rep); - - ktest_destroy_pa_data_array(&(ref.padata)); - decode_run("tgs_rep","(optionals NULL)","6D 81 C2 30 81 BF A0 03 02 01 05 A1 03 02 01 0D A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A4 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 5E 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A6 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_tgs_rep,ktest_equal_tgs_rep,krb5_free_kdc_rep); - - ktest_empty_kdc_rep(&ref); - } - - /****************************************************************/ - /* decode_krb5_ap_req */ - { - setup(krb5_ap_req,"krb5_ap_req",ktest_make_sample_ap_req); - decode_run("ap_req","","6E 81 9D 30 81 9A A0 03 02 01 05 A1 03 02 01 0E A2 07 03 05 00 FE DC BA 98 A3 5E 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A4 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_ap_req,ktest_equal_ap_req,krb5_free_ap_req); - ktest_empty_ap_req(&ref); - - } - - /****************************************************************/ - /* decode_krb5_ap_rep */ - { - setup(krb5_ap_rep,"krb5_ap_rep",ktest_make_sample_ap_rep); - decode_run("ap_rep","","6F 33 30 31 A0 03 02 01 05 A1 03 02 01 0F A2 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_ap_rep,ktest_equal_ap_rep,krb5_free_ap_rep); - ktest_empty_ap_rep(&ref); - } - - /****************************************************************/ - /* decode_krb5_ap_rep_enc_part */ - { - setup(krb5_ap_rep_enc_part,"krb5_ap_rep_enc_part",ktest_make_sample_ap_rep_enc_part); - - decode_run("ap_rep_enc_part","","7B 36 30 34 A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A1 05 02 03 01 E2 40 A2 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A3 03 02 01 11",decode_krb5_ap_rep_enc_part,ktest_equal_ap_rep_enc_part,krb5_free_ap_rep_enc_part); - - ktest_destroy_keyblock(&(ref.subkey)); - ref.seq_number = 0; - decode_run("ap_rep_enc_part","(optionals NULL)","7B 1C 30 1A A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A1 05 02 03 01 E2 40",decode_krb5_ap_rep_enc_part,ktest_equal_ap_rep_enc_part,krb5_free_ap_rep_enc_part); - ktest_empty_ap_rep_enc_part(&ref); - } - - /****************************************************************/ - /* decode_krb5_as_req */ - { - setup(krb5_kdc_req,"krb5_kdc_req",ktest_make_sample_kdc_req); - ref.msg_type = KRB5_AS_REQ; - - ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - decode_run("as_req","","6A 82 01 E4 30 82 01 E0 A1 03 02 01 05 A2 03 02 01 0A A3 26 30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 A4 82 01 AA 30 82 01 A6 A0 07 03 05 00 FE DC BA 90 A1 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 A9 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 AA 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_as_req,ktest_equal_as_req,krb5_free_kdc_req); - - ktest_destroy_pa_data_array(&(ref.padata)); - ktest_destroy_principal(&(ref.client)); + decode_run("as_rep","(indefinite lengths)","6B 80 30 80 A0 03 02 01 05 A1 03 02 01 0B A2 80 30 80 30 80 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 00 00 30 80 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 00 00 00 00 00 00 A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A4 80 30 80 A0 03 02 01 01 A1 80 30 80 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 00 00 00 00 00 00 00 00 A5 80 61 80 30 80 A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 80 30 80 A0 03 02 01 01 A1 80 30 80 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 00 00 00 00 00 00 00 00 A3 80 30 80 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 00 00 00 00 00 00 00 00 00 00 A6 80 30 80 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 00 00 00 00 00 00 00 00",decode_krb5_as_rep,ktest_equal_as_rep,krb5_free_kdc_rep); + ktest_destroy_pa_data_array(&(ref.padata)); + decode_run("as_rep","(optionals NULL)","6B 81 C2 30 81 BF A0 03 02 01 05 A1 03 02 01 0B A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A4 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 5E 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A6 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_as_rep,ktest_equal_as_rep,krb5_free_kdc_rep); + + ktest_empty_kdc_rep(&ref); + } + + /****************************************************************/ + /* decode_krb5_tgs_rep */ + { + setup(krb5_kdc_rep,"krb5_kdc_rep",ktest_make_sample_kdc_rep); + ref.msg_type = KRB5_TGS_REP; + + decode_run("tgs_rep","","6D 81 EA 30 81 E7 A0 03 02 01 05 A1 03 02 01 0D A2 26 30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A4 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 5E 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A6 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_tgs_rep,ktest_equal_tgs_rep,krb5_free_kdc_rep); + + ktest_destroy_pa_data_array(&(ref.padata)); + decode_run("tgs_rep","(optionals NULL)","6D 81 C2 30 81 BF A0 03 02 01 05 A1 03 02 01 0D A3 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A4 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 5E 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A6 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_tgs_rep,ktest_equal_tgs_rep,krb5_free_kdc_rep); + + ktest_empty_kdc_rep(&ref); + } + + /****************************************************************/ + /* decode_krb5_ap_req */ + { + setup(krb5_ap_req,"krb5_ap_req",ktest_make_sample_ap_req); + decode_run("ap_req","","6E 81 9D 30 81 9A A0 03 02 01 05 A1 03 02 01 0E A2 07 03 05 00 FE DC BA 98 A3 5E 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A4 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_ap_req,ktest_equal_ap_req,krb5_free_ap_req); + ktest_empty_ap_req(&ref); + + } + + /****************************************************************/ + /* decode_krb5_ap_rep */ + { + setup(krb5_ap_rep,"krb5_ap_rep",ktest_make_sample_ap_rep); + decode_run("ap_rep","","6F 33 30 31 A0 03 02 01 05 A1 03 02 01 0F A2 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_ap_rep,ktest_equal_ap_rep,krb5_free_ap_rep); + ktest_empty_ap_rep(&ref); + } + + /****************************************************************/ + /* decode_krb5_ap_rep_enc_part */ + { + setup(krb5_ap_rep_enc_part,"krb5_ap_rep_enc_part",ktest_make_sample_ap_rep_enc_part); + + decode_run("ap_rep_enc_part","","7B 36 30 34 A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A1 05 02 03 01 E2 40 A2 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A3 03 02 01 11",decode_krb5_ap_rep_enc_part,ktest_equal_ap_rep_enc_part,krb5_free_ap_rep_enc_part); + + ktest_destroy_keyblock(&(ref.subkey)); + ref.seq_number = 0; + decode_run("ap_rep_enc_part","(optionals NULL)","7B 1C 30 1A A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A1 05 02 03 01 E2 40",decode_krb5_ap_rep_enc_part,ktest_equal_ap_rep_enc_part,krb5_free_ap_rep_enc_part); + ktest_empty_ap_rep_enc_part(&ref); + } + + /****************************************************************/ + /* decode_krb5_as_req */ + { + setup(krb5_kdc_req,"krb5_kdc_req",ktest_make_sample_kdc_req); + ref.msg_type = KRB5_AS_REQ; + + ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + decode_run("as_req","","6A 82 01 E4 30 82 01 E0 A1 03 02 01 05 A2 03 02 01 0A A3 26 30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 A4 82 01 AA 30 82 01 A6 A0 07 03 05 00 FE DC BA 90 A1 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 A9 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 AA 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_as_req,ktest_equal_as_req,krb5_free_kdc_req); + + ktest_destroy_pa_data_array(&(ref.padata)); + ktest_destroy_principal(&(ref.client)); #ifndef ISODE_SUCKS - ktest_destroy_principal(&(ref.server)); + ktest_destroy_principal(&(ref.server)); #endif - ref.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; - ref.from = 0; - ref.rtime = 0; - ktest_destroy_addresses(&(ref.addresses)); - ktest_destroy_enc_data(&(ref.authorization_data)); - decode_run("as_req","(optionals NULL except second_ticket)","6A 82 01 14 30 82 01 10 A1 03 02 01 05 A2 03 02 01 0A A4 82 01 02 30 81 FF A0 07 03 05 00 FE DC BA 98 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_as_req,ktest_equal_as_req,krb5_free_kdc_req); - ktest_destroy_sequence_of_ticket(&(ref.second_ticket)); + ref.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; + ref.from = 0; + ref.rtime = 0; + ktest_destroy_addresses(&(ref.addresses)); + ktest_destroy_enc_data(&(ref.authorization_data)); + decode_run("as_req","(optionals NULL except second_ticket)","6A 82 01 14 30 82 01 10 A1 03 02 01 05 A2 03 02 01 0A A4 82 01 02 30 81 FF A0 07 03 05 00 FE DC BA 98 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_as_req,ktest_equal_as_req,krb5_free_kdc_req); + ktest_destroy_sequence_of_ticket(&(ref.second_ticket)); #ifndef ISODE_SUCKS - ktest_make_sample_principal(&(ref.server)); + ktest_make_sample_principal(&(ref.server)); #endif - ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - decode_run("as_req","(optionals NULL except server)","6A 69 30 67 A1 03 02 01 05 A2 03 02 01 0A A4 5B 30 59 A0 07 03 05 00 FE DC BA 90 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01",decode_krb5_as_req,ktest_equal_as_req,krb5_free_kdc_req); + ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + decode_run("as_req","(optionals NULL except server)","6A 69 30 67 A1 03 02 01 05 A2 03 02 01 0A A4 5B 30 59 A0 07 03 05 00 FE DC BA 90 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01",decode_krb5_as_req,ktest_equal_as_req,krb5_free_kdc_req); - ktest_empty_kdc_req(&ref); + ktest_empty_kdc_req(&ref); - } + } - /****************************************************************/ - /* decode_krb5_tgs_req */ - { - setup(krb5_kdc_req,"krb5_kdc_req",ktest_make_sample_kdc_req); - ref.msg_type = KRB5_TGS_REQ; + /****************************************************************/ + /* decode_krb5_tgs_req */ + { + setup(krb5_kdc_req,"krb5_kdc_req",ktest_make_sample_kdc_req); + ref.msg_type = KRB5_TGS_REQ; - ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - decode_run("tgs_req","","6C 82 01 E4 30 82 01 E0 A1 03 02 01 05 A2 03 02 01 0C A3 26 30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 A4 82 01 AA 30 82 01 A6 A0 07 03 05 00 FE DC BA 90 A1 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 A9 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 AA 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_tgs_req,ktest_equal_tgs_req,krb5_free_kdc_req); + ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + decode_run("tgs_req","","6C 82 01 E4 30 82 01 E0 A1 03 02 01 05 A2 03 02 01 0C A3 26 30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 A4 82 01 AA 30 82 01 A6 A0 07 03 05 00 FE DC BA 90 A1 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 A9 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 AA 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_tgs_req,ktest_equal_tgs_req,krb5_free_kdc_req); - ktest_destroy_pa_data_array(&(ref.padata)); - ktest_destroy_principal(&(ref.client)); + ktest_destroy_pa_data_array(&(ref.padata)); + ktest_destroy_principal(&(ref.client)); #ifndef ISODE_SUCKS - ktest_destroy_principal(&(ref.server)); + ktest_destroy_principal(&(ref.server)); #endif - ref.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; - ref.from = 0; - ref.rtime = 0; - ktest_destroy_addresses(&(ref.addresses)); - ktest_destroy_enc_data(&(ref.authorization_data)); - decode_run("tgs_req","(optionals NULL except second_ticket)","6C 82 01 14 30 82 01 10 A1 03 02 01 05 A2 03 02 01 0C A4 82 01 02 30 81 FF A0 07 03 05 00 FE DC BA 98 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_tgs_req,ktest_equal_tgs_req,krb5_free_kdc_req); - - ktest_destroy_sequence_of_ticket(&(ref.second_ticket)); + ref.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; + ref.from = 0; + ref.rtime = 0; + ktest_destroy_addresses(&(ref.addresses)); + ktest_destroy_enc_data(&(ref.authorization_data)); + decode_run("tgs_req","(optionals NULL except second_ticket)","6C 82 01 14 30 82 01 10 A1 03 02 01 05 A2 03 02 01 0C A4 82 01 02 30 81 FF A0 07 03 05 00 FE DC BA 98 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_tgs_req,ktest_equal_tgs_req,krb5_free_kdc_req); + + ktest_destroy_sequence_of_ticket(&(ref.second_ticket)); #ifndef ISODE_SUCKS - ktest_make_sample_principal(&(ref.server)); + ktest_make_sample_principal(&(ref.server)); #endif - ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - decode_run("tgs_req","(optionals NULL except server)","6C 69 30 67 A1 03 02 01 05 A2 03 02 01 0C A4 5B 30 59 A0 07 03 05 00 FE DC BA 90 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01",decode_krb5_tgs_req,ktest_equal_tgs_req,krb5_free_kdc_req); - - ktest_empty_kdc_req(&ref); - } - - /****************************************************************/ - /* decode_krb5_kdc_req_body */ - { - krb5_kdc_req ref, *var; - memset(&ref, 0, sizeof(krb5_kdc_req)); - retval = ktest_make_sample_kdc_req_body(&ref); - if(retval){ - com_err("making sample kdc_req_body",retval,""); - exit(1); - } - ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - decode_run("kdc_req_body","","30 82 01 A6 A0 07 03 05 00 FE DC BA 90 A1 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 A9 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 AA 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_kdc_req_body,ktest_equal_kdc_req_body,krb5_free_kdc_req); + ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + decode_run("tgs_req","(optionals NULL except server)","6C 69 30 67 A1 03 02 01 05 A2 03 02 01 0C A4 5B 30 59 A0 07 03 05 00 FE DC BA 90 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01",decode_krb5_tgs_req,ktest_equal_tgs_req,krb5_free_kdc_req); - ktest_destroy_principal(&(ref.client)); + ktest_empty_kdc_req(&ref); + } + + /****************************************************************/ + /* decode_krb5_kdc_req_body */ + { + krb5_kdc_req ref, *var; + memset(&ref, 0, sizeof(krb5_kdc_req)); + retval = ktest_make_sample_kdc_req_body(&ref); + if (retval) { + com_err("making sample kdc_req_body",retval,""); + exit(1); + } + ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + decode_run("kdc_req_body","","30 82 01 A6 A0 07 03 05 00 FE DC BA 90 A1 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 A9 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 AA 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_kdc_req_body,ktest_equal_kdc_req_body,krb5_free_kdc_req); + + ktest_destroy_principal(&(ref.client)); #ifndef ISODE_SUCKS - ktest_destroy_principal(&(ref.server)); + ktest_destroy_principal(&(ref.server)); #endif - ref.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; - ref.from = 0; - ref.rtime = 0; - ktest_destroy_addresses(&(ref.addresses)); - ktest_destroy_enc_data(&(ref.authorization_data)); - decode_run("kdc_req_body","(optionals NULL except second_ticket)","30 81 FF A0 07 03 05 00 FE DC BA 98 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_kdc_req_body,ktest_equal_kdc_req_body,krb5_free_kdc_req); - - ktest_destroy_sequence_of_ticket(&(ref.second_ticket)); + ref.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; + ref.from = 0; + ref.rtime = 0; + ktest_destroy_addresses(&(ref.addresses)); + ktest_destroy_enc_data(&(ref.authorization_data)); + decode_run("kdc_req_body","(optionals NULL except second_ticket)","30 81 FF A0 07 03 05 00 FE DC BA 98 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01 AB 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_kdc_req_body,ktest_equal_kdc_req_body,krb5_free_kdc_req); + + ktest_destroy_sequence_of_ticket(&(ref.second_ticket)); #ifndef ISODE_SUCKS - ktest_make_sample_principal(&(ref.server)); + ktest_make_sample_principal(&(ref.server)); #endif - ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - decode_run("kdc_req_body","(optionals NULL except server)","30 59 A0 07 03 05 00 FE DC BA 90 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01",decode_krb5_kdc_req_body,ktest_equal_kdc_req_body,krb5_free_kdc_req); - ref.nktypes = 0; - free(ref.ktype); - ref.ktype = NULL; - decode_run("kdc_req_body","(optionals NULL except server; zero-length etypes)","30 53 A0 07 03 05 00 FE DC BA 90 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 02 30 00",decode_krb5_kdc_req_body,ktest_equal_kdc_req_body,krb5_free_kdc_req); - - ktest_empty_kdc_req(&ref); - } - - - /****************************************************************/ - /* decode_krb5_safe */ - { - setup(krb5_safe,"krb5_safe",ktest_make_sample_safe); - decode_run("safe","","74 6E 30 6C A0 03 02 01 05 A1 03 02 01 14 A2 4F 30 4D A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 05 02 03 01 E2 40 A3 03 02 01 11 A4 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A5 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A3 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34",decode_krb5_safe,ktest_equal_safe,krb5_free_safe); - - ref.timestamp = 0; - ref.usec = 0; - ref.seq_number = 0; - ktest_destroy_address(&(ref.r_address)); - decode_run("safe","(optionals NULL)","74 3E 30 3C A0 03 02 01 05 A1 03 02 01 14 A2 1F 30 1D A0 0A 04 08 6B 72 62 35 64 61 74 61 A4 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A3 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34",decode_krb5_safe,ktest_equal_safe,krb5_free_safe); - - ktest_empty_safe(&ref); - } - - /****************************************************************/ - /* decode_krb5_priv */ - { - setup(krb5_priv,"krb5_priv",ktest_make_sample_priv); - decode_run("priv","","75 33 30 31 A0 03 02 01 05 A1 03 02 01 15 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_priv,ktest_equal_priv,krb5_free_priv); - ktest_empty_priv(&ref); - } - - /****************************************************************/ - /* decode_krb5_enc_priv_part */ - { - setup(krb5_priv_enc_part,"krb5_priv_enc_part",ktest_make_sample_priv_enc_part); - decode_run("enc_priv_part","","7C 4F 30 4D A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 05 02 03 01 E2 40 A3 03 02 01 11 A4 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A5 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_priv_part,ktest_equal_enc_priv_part,krb5_free_priv_enc_part); - - ref.timestamp = 0; - ref.usec = 0; - ref.seq_number = 0; - ktest_destroy_address(&(ref.r_address)); - decode_run("enc_priv_part","(optionals NULL)","7C 1F 30 1D A0 0A 04 08 6B 72 62 35 64 61 74 61 A4 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_priv_part,ktest_equal_enc_priv_part,krb5_free_priv_enc_part); - ktest_empty_priv_enc_part(&ref); - } - - /****************************************************************/ - /* decode_krb5_cred */ - { - setup(krb5_cred,"krb5_cred",ktest_make_sample_cred); - decode_run("cred","","76 81 F6 30 81 F3 A0 03 02 01 05 A1 03 02 01 16 A2 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_cred,ktest_equal_cred,krb5_free_cred); - ktest_empty_cred(&ref); - } - - /****************************************************************/ - /* decode_krb5_enc_cred_part */ - { - setup(krb5_cred_enc_part,"krb5_cred_enc_part",ktest_make_sample_cred_enc_part); - decode_run("enc_cred_part","","7D 82 02 23 30 82 02 1F A0 82 01 DA 30 82 01 D6 30 81 E8 A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 07 03 05 00 FE DC BA 98 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A9 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AA 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 81 E8 A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 07 03 05 00 FE DC BA 98 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A9 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AA 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A1 03 02 01 2A A2 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A3 05 02 03 01 E2 40 A4 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A5 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_cred_part,ktest_equal_enc_cred_part,krb5_free_cred_enc_part); - /* free_cred_enc_part does not free the pointer */ - krb5_xfree(var); - ktest_destroy_principal(&(ref.ticket_info[0]->client)); - ktest_destroy_principal(&(ref.ticket_info[0]->server)); - ref.ticket_info[0]->flags = 0; - ref.ticket_info[0]->times.authtime = 0; - ref.ticket_info[0]->times.starttime = 0; - ref.ticket_info[0]->times.endtime = 0; - ref.ticket_info[0]->times.renew_till = 0; - ktest_destroy_addresses(&(ref.ticket_info[0]->caddrs)); - ref.nonce = 0; - ref.timestamp = 0; - ref.usec = 0; - ktest_destroy_address(&(ref.s_address)); - ktest_destroy_address(&(ref.r_address)); - decode_run("enc_cred_part","(optionals NULL)","7D 82 01 0E 30 82 01 0A A0 82 01 06 30 82 01 02 30 15 A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 30 81 E8 A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 07 03 05 00 FE DC BA 98 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A9 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AA 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_cred_part,ktest_equal_enc_cred_part,krb5_free_cred_enc_part); - /* free_cred_enc_part does not free the pointer */ - krb5_xfree(var); - - ktest_empty_cred_enc_part(&ref); - } - - /****************************************************************/ - /* decode_krb5_error */ - { - setup(krb5_error,"krb5_error",ktest_make_sample_error); - decode_run("error","","7E 81 BA 30 81 B7 A0 03 02 01 05 A1 03 02 01 1E A2 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A3 05 02 03 01 E2 40 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 05 02 03 01 E2 40 A6 03 02 01 3C A7 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A8 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AB 0A 1B 08 6B 72 62 35 64 61 74 61 AC 0A 04 08 6B 72 62 35 64 61 74 61",decode_krb5_error,ktest_equal_error,krb5_free_error); - - ref.ctime = 0; - ktest_destroy_principal(&(ref.client)); - ktest_empty_data(&(ref.text)); - ktest_empty_data(&(ref.e_data)); - decode_run("error","(optionals NULL)","7E 60 30 5E A0 03 02 01 05 A1 03 02 01 1E A3 05 02 03 01 E2 40 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 05 02 03 01 E2 40 A6 03 02 01 3C A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61",decode_krb5_error,ktest_equal_error,krb5_free_error); - - ktest_empty_error(&ref); - } - - /****************************************************************/ - /* decode_krb5_authdata */ - { - krb5_authdata **ref, **var; - retval = ktest_make_sample_authorization_data(&ref); - if(retval){ - com_err("making sample authorization_data",retval,""); - exit(1); + ref.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + decode_run("kdc_req_body","(optionals NULL except server)","30 59 A0 07 03 05 00 FE DC BA 90 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 08 30 06 02 01 00 02 01 01",decode_krb5_kdc_req_body,ktest_equal_kdc_req_body,krb5_free_kdc_req); + ref.nktypes = 0; + free(ref.ktype); + ref.ktype = NULL; + decode_run("kdc_req_body","(optionals NULL except server; zero-length etypes)","30 53 A0 07 03 05 00 FE DC BA 90 A2 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A3 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 03 02 01 2A A8 02 30 00",decode_krb5_kdc_req_body,ktest_equal_kdc_req_body,krb5_free_kdc_req); + + ktest_empty_kdc_req(&ref); + } + + + /****************************************************************/ + /* decode_krb5_safe */ + { + setup(krb5_safe,"krb5_safe",ktest_make_sample_safe); + decode_run("safe","","74 6E 30 6C A0 03 02 01 05 A1 03 02 01 14 A2 4F 30 4D A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 05 02 03 01 E2 40 A3 03 02 01 11 A4 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A5 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A3 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34",decode_krb5_safe,ktest_equal_safe,krb5_free_safe); + + ref.timestamp = 0; + ref.usec = 0; + ref.seq_number = 0; + ktest_destroy_address(&(ref.r_address)); + decode_run("safe","(optionals NULL)","74 3E 30 3C A0 03 02 01 05 A1 03 02 01 14 A2 1F 30 1D A0 0A 04 08 6B 72 62 35 64 61 74 61 A4 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A3 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34",decode_krb5_safe,ktest_equal_safe,krb5_free_safe); + + ktest_empty_safe(&ref); + } + + /****************************************************************/ + /* decode_krb5_priv */ + { + setup(krb5_priv,"krb5_priv",ktest_make_sample_priv); + decode_run("priv","","75 33 30 31 A0 03 02 01 05 A1 03 02 01 15 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_priv,ktest_equal_priv,krb5_free_priv); + ktest_empty_priv(&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){ - com_err("parsing authorization_data",retval,""); - exit(1); + + /****************************************************************/ + /* decode_krb5_enc_priv_part */ + { + setup(krb5_priv_enc_part,"krb5_priv_enc_part",ktest_make_sample_priv_enc_part); + decode_run("enc_priv_part","","7C 4F 30 4D A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A2 05 02 03 01 E2 40 A3 03 02 01 11 A4 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A5 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_priv_part,ktest_equal_enc_priv_part,krb5_free_priv_enc_part); + + ref.timestamp = 0; + ref.usec = 0; + ref.seq_number = 0; + ktest_destroy_address(&(ref.r_address)); + decode_run("enc_priv_part","(optionals NULL)","7C 1F 30 1D A0 0A 04 08 6B 72 62 35 64 61 74 61 A4 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_priv_part,ktest_equal_enc_priv_part,krb5_free_priv_enc_part); + ktest_empty_priv_enc_part(&ref); + } + + /****************************************************************/ + /* decode_krb5_cred */ + { + setup(krb5_cred,"krb5_cred",ktest_make_sample_cred); + decode_run("cred","","76 81 F6 30 81 F3 A0 03 02 01 05 A1 03 02 01 16 A2 81 BF 30 81 BC 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 61 5C 30 5A A0 03 02 01 05 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65 A3 25 30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_cred,ktest_equal_cred,krb5_free_cred); + ktest_empty_cred(&ref); + } + + /****************************************************************/ + /* decode_krb5_enc_cred_part */ + { + setup(krb5_cred_enc_part,"krb5_cred_enc_part",ktest_make_sample_cred_enc_part); + decode_run("enc_cred_part","","7D 82 02 23 30 82 02 1F A0 82 01 DA 30 82 01 D6 30 81 E8 A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 07 03 05 00 FE DC BA 98 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A9 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AA 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 81 E8 A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 07 03 05 00 FE DC BA 98 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A9 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AA 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A1 03 02 01 2A A2 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A3 05 02 03 01 E2 40 A4 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 A5 0F 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_cred_part,ktest_equal_enc_cred_part,krb5_free_cred_enc_part); + /* free_cred_enc_part does not free the pointer */ + krb5_xfree(var); + ktest_destroy_principal(&(ref.ticket_info[0]->client)); + ktest_destroy_principal(&(ref.ticket_info[0]->server)); + ref.ticket_info[0]->flags = 0; + ref.ticket_info[0]->times.authtime = 0; + ref.ticket_info[0]->times.starttime = 0; + ref.ticket_info[0]->times.endtime = 0; + ref.ticket_info[0]->times.renew_till = 0; + ktest_destroy_addresses(&(ref.ticket_info[0]->caddrs)); + ref.nonce = 0; + ref.timestamp = 0; + ref.usec = 0; + ktest_destroy_address(&(ref.s_address)); + ktest_destroy_address(&(ref.r_address)); + decode_run("enc_cred_part","(optionals NULL)","7D 82 01 0E 30 82 01 0A A0 82 01 06 30 82 01 02 30 15 A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 30 81 E8 A0 13 30 11 A0 03 02 01 01 A1 0A 04 08 31 32 33 34 35 36 37 38 A1 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A2 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A3 07 03 05 00 FE DC BA 98 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A7 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A8 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A9 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AA 20 30 1E 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23 30 0D A0 03 02 01 02 A1 06 04 04 12 D0 00 23",decode_krb5_enc_cred_part,ktest_equal_enc_cred_part,krb5_free_cred_enc_part); + /* free_cred_enc_part does not free the pointer */ + krb5_xfree(var); + + ktest_empty_cred_enc_part(&ref); } - 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); - krb5_free_authdata(test_context, var); - ktest_destroy_authorization_data(&ref); - } - - /****************************************************************/ - /* decode_pwd_sequence */ - { - setup(passwd_phrase_element,"passwd_phrase_element",ktest_make_sample_passwd_phrase_element); - decode_run("PasswdSequence","","30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61",decode_krb5_pwd_sequence,ktest_equal_passwd_phrase_element,krb5_ktest_free_pwd_sequence); - ktest_empty_passwd_phrase_element(&ref); - } - - /****************************************************************/ - /* decode_passwd_data */ - { - setup(krb5_pwd_data,"krb5_pwd_data",ktest_make_sample_krb5_pwd_data); - decode_run("PasswdData","","30 3D A0 03 02 01 02 A1 36 30 34 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61",decode_krb5_pwd_data,ktest_equal_krb5_pwd_data,krb5_free_pwd_data); - ktest_empty_pwd_data(&ref); - } - - /****************************************************************/ - /* decode_krb5_padata_sequence */ - { - krb5_pa_data **ref, **var; - retval = ktest_make_sample_pa_data_array(&ref); - if(retval){ - com_err("making sample pa_data array",retval,""); - exit(1); + + /****************************************************************/ + /* decode_krb5_error */ + { + setup(krb5_error,"krb5_error",ktest_make_sample_error); + decode_run("error","","7E 81 BA 30 81 B7 A0 03 02 01 05 A1 03 02 01 1E A2 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A3 05 02 03 01 E2 40 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 05 02 03 01 E2 40 A6 03 02 01 3C A7 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A8 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AB 0A 1B 08 6B 72 62 35 64 61 74 61 AC 0A 04 08 6B 72 62 35 64 61 74 61",decode_krb5_error,ktest_equal_error,krb5_free_error); + + ref.ctime = 0; + ktest_destroy_principal(&(ref.client)); + ktest_empty_data(&(ref.text)); + ktest_empty_data(&(ref.e_data)); + decode_run("error","(optionals NULL)","7E 60 30 5E A0 03 02 01 05 A1 03 02 01 1E A3 05 02 03 01 E2 40 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 05 02 03 01 E2 40 A6 03 02 01 3C A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61",decode_krb5_error,ktest_equal_error,krb5_free_error); + + ktest_empty_error(&ref); + } + + /****************************************************************/ + /* decode_krb5_authdata */ + { + krb5_authdata **ref, **var; + retval = ktest_make_sample_authorization_data(&ref); + if (retval) { + com_err("making sample authorization_data",retval,""); + exit(1); + } + 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) { + com_err("parsing authorization_data",retval,""); + exit(1); + } + 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); + krb5_free_authdata(test_context, var); + ktest_destroy_authorization_data(&ref); + } + + /****************************************************************/ + /* decode_pwd_sequence */ + { + setup(passwd_phrase_element,"passwd_phrase_element",ktest_make_sample_passwd_phrase_element); + decode_run("PasswdSequence","","30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61",decode_krb5_pwd_sequence,ktest_equal_passwd_phrase_element,krb5_ktest_free_pwd_sequence); + ktest_empty_passwd_phrase_element(&ref); + } + + /****************************************************************/ + /* decode_passwd_data */ + { + setup(krb5_pwd_data,"krb5_pwd_data",ktest_make_sample_krb5_pwd_data); + decode_run("PasswdData","","30 3D A0 03 02 01 02 A1 36 30 34 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61",decode_krb5_pwd_data,ktest_equal_krb5_pwd_data,krb5_free_pwd_data); + ktest_empty_pwd_data(&ref); } - retval = krb5_data_hex_parse(&code,"30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61"); - if(retval){ - com_err("parsing padata_sequence",retval,""); - exit(1); + + /****************************************************************/ + /* decode_krb5_padata_sequence */ + { + krb5_pa_data **ref, **var; + retval = ktest_make_sample_pa_data_array(&ref); + if (retval) { + com_err("making sample pa_data array",retval,""); + exit(1); + } + retval = krb5_data_hex_parse(&code,"30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61"); + if (retval) { + com_err("parsing padata_sequence",retval,""); + exit(1); + } + retval = decode_krb5_padata_sequence(&code,&var); + if (retval) com_err("decoding padata_sequence",retval,""); + test(ktest_equal_sequence_of_pa_data(ref,var),"pa_data\n"); + krb5_free_pa_data(test_context, var); + krb5_free_data_contents(test_context, &code); + ktest_destroy_pa_data_array(&ref); } - retval = decode_krb5_padata_sequence(&code,&var); - if(retval) com_err("decoding padata_sequence",retval,""); - test(ktest_equal_sequence_of_pa_data(ref,var),"pa_data\n"); - krb5_free_pa_data(test_context, var); - krb5_free_data_contents(test_context, &code); - ktest_destroy_pa_data_array(&ref); - } - - /****************************************************************/ - /* decode_krb5_padata_sequence (empty) */ - { - krb5_pa_data **ref, **var; - retval = ktest_make_sample_empty_pa_data_array(&ref); - if(retval){ - com_err("making sample empty pa_data array",retval,""); - exit(1); + + /****************************************************************/ + /* decode_krb5_padata_sequence (empty) */ + { + krb5_pa_data **ref, **var; + retval = ktest_make_sample_empty_pa_data_array(&ref); + if (retval) { + com_err("making sample empty pa_data array",retval,""); + exit(1); + } + retval = krb5_data_hex_parse(&code,"30 00"); + if (retval) { + com_err("parsing padata_sequence (empty)",retval,""); + exit(1); + } + retval = decode_krb5_padata_sequence(&code,&var); + if (retval) com_err("decoding padata_sequence (empty)",retval,""); + test(ktest_equal_sequence_of_pa_data(ref,var),"pa_data (empty)\n"); + krb5_free_pa_data(test_context, var); + krb5_free_data_contents(test_context, &code); + ktest_destroy_pa_data_array(&ref); } - retval = krb5_data_hex_parse(&code,"30 00"); - if(retval){ - com_err("parsing padata_sequence (empty)",retval,""); - exit(1); + + /****************************************************************/ + /* decode_pwd_sequence */ + { + setup(krb5_alt_method,"krb5_alt_method",ktest_make_sample_alt_method); + decode_run("alt_method","","30 0F A0 03 02 01 2A A1 08 04 06 73 65 63 72 65 74",decode_krb5_alt_method,ktest_equal_krb5_alt_method,krb5_ktest_free_alt_method); + ref.length = 0; + decode_run("alt_method (no data)","","30 05 A0 03 02 01 2A",decode_krb5_alt_method,ktest_equal_krb5_alt_method,krb5_ktest_free_alt_method); + ktest_empty_alt_method(&ref); } - retval = decode_krb5_padata_sequence(&code,&var); - if(retval) com_err("decoding padata_sequence (empty)",retval,""); - test(ktest_equal_sequence_of_pa_data(ref,var),"pa_data (empty)\n"); - krb5_free_pa_data(test_context, var); - krb5_free_data_contents(test_context, &code); - ktest_destroy_pa_data_array(&ref); - } - - /****************************************************************/ - /* decode_pwd_sequence */ - { - setup(krb5_alt_method,"krb5_alt_method",ktest_make_sample_alt_method); - decode_run("alt_method","","30 0F A0 03 02 01 2A A1 08 04 06 73 65 63 72 65 74",decode_krb5_alt_method,ktest_equal_krb5_alt_method,krb5_ktest_free_alt_method); - ref.length = 0; - decode_run("alt_method (no data)","","30 05 A0 03 02 01 2A",decode_krb5_alt_method,ktest_equal_krb5_alt_method,krb5_ktest_free_alt_method); - ktest_empty_alt_method(&ref); - } - - /****************************************************************/ - /* decode_etype_info */ - { - krb5_etype_info ref, var; - - retval = ktest_make_sample_etype_info(&ref); - if (retval) { - com_err("krb5_decode_test", retval, - "while making sample etype info"); - exit(1); - } - retval = krb5_data_hex_parse(&code,"30 33 30 14 A0 03 02 01 00 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 30 30 05 A0 03 02 01 01 30 14 A0 03 02 01 02 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 32"); - if(retval){ - com_err("krb5_decode_test", retval, "while parsing etype_info"); - exit(1); - } - retval = decode_krb5_etype_info(&code,&var); - if(retval){ - com_err("krb5_decode_test", retval, "while decoding etype_info"); - } - test(ktest_equal_etype_info(ref,var),"etype_info\n"); - - ktest_destroy_etype_info(var); - ktest_destroy_etype_info_entry(ref[2]); ref[2] = 0; - ktest_destroy_etype_info_entry(ref[1]); ref[1] = 0; - krb5_free_data_contents(test_context, &code); + + /****************************************************************/ + /* decode_etype_info */ + { + krb5_etype_info ref, var; + + retval = ktest_make_sample_etype_info(&ref); + if (retval) { + com_err("krb5_decode_test", retval, + "while making sample etype info"); + exit(1); + } + retval = krb5_data_hex_parse(&code,"30 33 30 14 A0 03 02 01 00 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 30 30 05 A0 03 02 01 01 30 14 A0 03 02 01 02 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 32"); + if (retval) { + com_err("krb5_decode_test", retval, "while parsing etype_info"); + exit(1); + } + retval = decode_krb5_etype_info(&code,&var); + if (retval) { + com_err("krb5_decode_test", retval, "while decoding etype_info"); + } + test(ktest_equal_etype_info(ref,var),"etype_info\n"); + + ktest_destroy_etype_info(var); + ktest_destroy_etype_info_entry(ref[2]); ref[2] = 0; + ktest_destroy_etype_info_entry(ref[1]); ref[1] = 0; + krb5_free_data_contents(test_context, &code); - retval = krb5_data_hex_parse(&code,"30 16 30 14 A0 03 02 01 00 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 30"); - if(retval){ - com_err("krb5_decode_test", retval, - "while parsing etype_info (only one)"); - exit(1); - } - retval = decode_krb5_etype_info(&code,&var); - if(retval){ - com_err("krb5_decode_test", retval, - "while decoding etype_info (only one)"); - } - test(ktest_equal_etype_info(ref,var),"etype_info (only one)\n"); + retval = krb5_data_hex_parse(&code,"30 16 30 14 A0 03 02 01 00 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 30"); + if (retval) { + com_err("krb5_decode_test", retval, + "while parsing etype_info (only one)"); + exit(1); + } + retval = decode_krb5_etype_info(&code,&var); + if (retval) { + com_err("krb5_decode_test", retval, + "while decoding etype_info (only one)"); + } + test(ktest_equal_etype_info(ref,var),"etype_info (only one)\n"); - ktest_destroy_etype_info(var); - ktest_destroy_etype_info_entry(ref[0]); ref[0] = 0; - krb5_free_data_contents(test_context, &code); + ktest_destroy_etype_info(var); + ktest_destroy_etype_info_entry(ref[0]); ref[0] = 0; + krb5_free_data_contents(test_context, &code); - retval = krb5_data_hex_parse(&code,"30 00"); - if(retval){ - com_err("krb5_decode_test", retval, - "while parsing etype_info (no info)"); - exit(1); - } - retval = decode_krb5_etype_info(&code,&var); - if(retval){ - com_err("krb5_decode_test", retval, - "while decoding etype_info (no info)"); - } - test(ktest_equal_etype_info(ref,var),"etype_info (no info)\n"); - - krb5_free_data_contents(test_context, &code); - ktest_destroy_etype_info(var); - ktest_destroy_etype_info(ref); - } - - /****************************************************************/ - /* decode_pa_enc_ts */ - { - setup(krb5_pa_enc_ts,"krb5_pa_enc_ts",ktest_make_sample_pa_enc_ts); - decode_run("pa_enc_ts","","30 1A A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A1 05 02 03 01 E2 40",decode_krb5_pa_enc_ts,ktest_equal_krb5_pa_enc_ts,krb5_free_pa_enc_ts); - ref.pausec = 0; - decode_run("pa_enc_ts (no usec)","","30 13 A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_pa_enc_ts,ktest_equal_krb5_pa_enc_ts,krb5_free_pa_enc_ts); - } - - /****************************************************************/ - /* decode_enc_data */ - { - setup(krb5_enc_data,"krb5_enc_data",ktest_make_sample_enc_data); - decode_run("enc_data","","30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_enc_data,ktest_equal_enc_data,krb5_ktest_free_enc_data); - ktest_destroy_enc_data(&ref); - } - - /****************************************************************/ - /* decode_sam_challenge */ - { - setup(krb5_sam_challenge,"krb5_sam_challenge",ktest_make_sample_sam_challenge); - decode_run("sam_challenge","","30 78 A0 03 02 01 2A A1 07 03 05 00 80 00 00 00 A2 0B 04 09 74 79 70 65 20 6E 61 6D 65 A3 02 04 00 A4 11 04 0F 63 68 61 6C 6C 65 6E 67 65 20 6C 61 62 65 6C A5 10 04 0E 63 68 61 6C 6C 65 6E 67 65 20 69 70 73 65 A6 16 04 14 72 65 73 70 6F 6E 73 65 5F 70 72 6F 6D 70 74 20 69 70 73 65 A7 02 04 00 A8 05 02 03 54 32 10 A9 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34",decode_krb5_sam_challenge,ktest_equal_sam_challenge,krb5_free_sam_challenge); - ktest_empty_sam_challenge(&ref); - - } - - /****************************************************************/ - /* decode_sam_challenge */ - { - setup(krb5_sam_challenge,"krb5_sam_challenge - no optionals",ktest_make_sample_sam_challenge); - decode_run("sam_challenge","","30 70 A0 03 02 01 2A A1 07 03 05 00 80 00 00 00 A2 0B 04 09 74 79 70 65 20 6E 61 6D 65 A4 11 04 0F 63 68 61 6C 6C 65 6E 67 65 20 6C 61 62 65 6C A5 10 04 0E 63 68 61 6C 6C 65 6E 67 65 20 69 70 73 65 A6 16 04 14 72 65 73 70 6F 6E 73 65 5F 70 72 6F 6D 70 74 20 69 70 73 65 A8 05 02 03 54 32 10 A9 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34",decode_krb5_sam_challenge,ktest_equal_sam_challenge,krb5_free_sam_challenge); - ktest_empty_sam_challenge(&ref); - } - - /****************************************************************/ - /* decode_sam_response */ - { - setup(krb5_sam_response,"krb5_sam_response",ktest_make_sample_sam_response); - decode_run("sam_response","","30 6A A0 03 02 01 2A A1 07 03 05 00 80 00 00 00 A2 0C 04 0A 74 72 61 63 6B 20 64 61 74 61 A3 14 30 12 A0 03 02 01 01 A1 04 02 02 07 96 A2 05 04 03 6B 65 79 A4 1C 30 1A A0 03 02 01 01 A1 04 02 02 0D 36 A2 0D 04 0B 6E 6F 6E 63 65 20 6F 72 20 74 73 A5 05 02 03 54 32 10 A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_sam_response,ktest_equal_sam_response,krb5_free_sam_response); - - ktest_empty_sam_response(&ref); - } - - krb5_free_context(test_context); - exit(error_count); - return(error_count); + retval = krb5_data_hex_parse(&code,"30 00"); + if (retval) { + com_err("krb5_decode_test", retval, + "while parsing etype_info (no info)"); + exit(1); + } + retval = decode_krb5_etype_info(&code,&var); + if (retval) { + com_err("krb5_decode_test", retval, + "while decoding etype_info (no info)"); + } + test(ktest_equal_etype_info(ref,var),"etype_info (no info)\n"); + + krb5_free_data_contents(test_context, &code); + ktest_destroy_etype_info(var); + ktest_destroy_etype_info(ref); + } + + /****************************************************************/ + /* decode_pa_enc_ts */ + { + setup(krb5_pa_enc_ts,"krb5_pa_enc_ts",ktest_make_sample_pa_enc_ts); + decode_run("pa_enc_ts","","30 1A A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A1 05 02 03 01 E2 40",decode_krb5_pa_enc_ts,ktest_equal_krb5_pa_enc_ts,krb5_free_pa_enc_ts); + ref.pausec = 0; + decode_run("pa_enc_ts (no usec)","","30 13 A0 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_pa_enc_ts,ktest_equal_krb5_pa_enc_ts,krb5_free_pa_enc_ts); + } + + /****************************************************************/ + /* decode_enc_data */ + { + setup(krb5_enc_data,"krb5_enc_data",ktest_make_sample_enc_data); + decode_run("enc_data","","30 23 A0 03 02 01 00 A1 03 02 01 05 A2 17 04 15 6B 72 62 41 53 4E 2E 31 20 74 65 73 74 20 6D 65 73 73 61 67 65",decode_krb5_enc_data,ktest_equal_enc_data,krb5_ktest_free_enc_data); + ktest_destroy_enc_data(&ref); + } + + /****************************************************************/ + /* decode_sam_challenge */ + { + setup(krb5_sam_challenge,"krb5_sam_challenge",ktest_make_sample_sam_challenge); + decode_run("sam_challenge","","30 78 A0 03 02 01 2A A1 07 03 05 00 80 00 00 00 A2 0B 04 09 74 79 70 65 20 6E 61 6D 65 A3 02 04 00 A4 11 04 0F 63 68 61 6C 6C 65 6E 67 65 20 6C 61 62 65 6C A5 10 04 0E 63 68 61 6C 6C 65 6E 67 65 20 69 70 73 65 A6 16 04 14 72 65 73 70 6F 6E 73 65 5F 70 72 6F 6D 70 74 20 69 70 73 65 A7 02 04 00 A8 05 02 03 54 32 10 A9 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34",decode_krb5_sam_challenge,ktest_equal_sam_challenge,krb5_free_sam_challenge); + ktest_empty_sam_challenge(&ref); + + } + + /****************************************************************/ + /* decode_sam_challenge */ + { + setup(krb5_sam_challenge,"krb5_sam_challenge - no optionals",ktest_make_sample_sam_challenge); + decode_run("sam_challenge","","30 70 A0 03 02 01 2A A1 07 03 05 00 80 00 00 00 A2 0B 04 09 74 79 70 65 20 6E 61 6D 65 A4 11 04 0F 63 68 61 6C 6C 65 6E 67 65 20 6C 61 62 65 6C A5 10 04 0E 63 68 61 6C 6C 65 6E 67 65 20 69 70 73 65 A6 16 04 14 72 65 73 70 6F 6E 73 65 5F 70 72 6F 6D 70 74 20 69 70 73 65 A8 05 02 03 54 32 10 A9 0F 30 0D A0 03 02 01 01 A1 06 04 04 31 32 33 34",decode_krb5_sam_challenge,ktest_equal_sam_challenge,krb5_free_sam_challenge); + ktest_empty_sam_challenge(&ref); + } + + /****************************************************************/ + /* decode_sam_response */ + { + setup(krb5_sam_response,"krb5_sam_response",ktest_make_sample_sam_response); + decode_run("sam_response","","30 6A A0 03 02 01 2A A1 07 03 05 00 80 00 00 00 A2 0C 04 0A 74 72 61 63 6B 20 64 61 74 61 A3 14 30 12 A0 03 02 01 01 A1 04 02 02 07 96 A2 05 04 03 6B 65 79 A4 1C 30 1A A0 03 02 01 01 A1 04 02 02 0D 36 A2 0D 04 0B 6E 6F 6E 63 65 20 6F 72 20 74 73 A5 05 02 03 54 32 10 A6 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A",decode_krb5_sam_response,ktest_equal_sam_response,krb5_free_sam_response); + + ktest_empty_sam_response(&ref); + } + + krb5_free_context(test_context); + exit(error_count); + return(error_count); } void krb5_ktest_free_alt_method(krb5_context context, krb5_alt_method *val) { - if (val->data) - krb5_xfree(val->data); - krb5_xfree(val); + if (val->data) + krb5_xfree(val->data); + krb5_xfree(val); } void krb5_ktest_free_pwd_sequence(krb5_context context, passwd_phrase_element *val) { - krb5_free_data(context, val->passwd); - krb5_free_data(context, val->phrase); - krb5_xfree(val); + krb5_free_data(context, val->passwd); + krb5_free_data(context, val->phrase); + krb5_xfree(val); } void krb5_ktest_free_enc_data(krb5_context context, krb5_enc_data *val) { - if(val) { - krb5_free_data_contents(context, &(val->ciphertext)); - free(val); - } + if (val) { + krb5_free_data_contents(context, &(val->ciphertext)); + free(val); + } } diff --git a/src/tests/asn.1/krb5_encode_test.c b/src/tests/asn.1/krb5_encode_test.c index cbaddd8f93..2795a63835 100644 --- a/src/tests/asn.1/krb5_encode_test.c +++ b/src/tests/asn.1/krb5_encode_test.c @@ -16,666 +16,666 @@ int do_trval = 0; int trval2(); static void encoder_print_results(code, typestring, description) - krb5_data *code; - char *typestring; - char *description; + krb5_data *code; + char *typestring; + char *description; { - char *code_string = NULL; - krb5_error_code retval; - int r, rlen; - - if (do_trval) { - printf("encode_krb5_%s%s:\n", typestring, description); - r = trval2(stdout, code->data, code->length, 0, &rlen); - printf("\n\n"); - if (rlen < 0 || (unsigned int) rlen != code->length) { - printf("Error: length mismatch: was %d, parsed %d\n", - code->length, rlen); - exit(1); - } - if (r != 0) { - printf("Error: Return from trval2 is %d.\n", r); - exit(1); - } - current_appl_type = -1; /* Reset type */ - } else { - retval = asn1_krb5_data_unparse(code,&(code_string)); - if(retval) { - com_err("krb5_encode_test", retval , - "while unparsing %s", typestring); - exit(1); - } - printf("encode_krb5_%s%s: %s\n", typestring, description, - code_string); - free(code_string); + char *code_string = NULL; + krb5_error_code retval; + int r, rlen; + + if (do_trval) { + printf("encode_krb5_%s%s:\n", typestring, description); + r = trval2(stdout, code->data, code->length, 0, &rlen); + printf("\n\n"); + if (rlen < 0 || (unsigned int) rlen != code->length) { + printf("Error: length mismatch: was %d, parsed %d\n", + code->length, rlen); + exit(1); } - ktest_destroy_data(&code); + if (r != 0) { + printf("Error: Return from trval2 is %d.\n", r); + exit(1); + } + current_appl_type = -1; /* Reset type */ + } else { + retval = asn1_krb5_data_unparse(code,&(code_string)); + if (retval) { + com_err("krb5_encode_test", retval , + "while unparsing %s", typestring); + exit(1); + } + printf("encode_krb5_%s%s: %s\n", typestring, description, + code_string); + free(code_string); + } + ktest_destroy_data(&code); } static void PRS(argc, argv) - int argc; - char **argv; + int argc; + char **argv; { - extern char *optarg; - int optchar; - extern int print_types, print_krb5_types, print_id_and_len, - print_constructed_length, print_skip_context, - print_skip_tagnum, print_context_shortcut; - - while ((optchar = getopt(argc, argv, "tp:")) != -1) { - switch(optchar) { - case 't': - do_trval = 1; - break; - case 'p': - sample_principal_name = optarg; - break; - case '?': - default: - fprintf(stderr, "Usage: %s [-t] [-p principal]\n", - argv[0]); - exit(1); - } + extern char *optarg; + int optchar; + extern int print_types, print_krb5_types, print_id_and_len, + print_constructed_length, print_skip_context, + print_skip_tagnum, print_context_shortcut; + + while ((optchar = getopt(argc, argv, "tp:")) != -1) { + switch(optchar) { + case 't': + do_trval = 1; + break; + case 'p': + sample_principal_name = optarg; + break; + case '?': + default: + fprintf(stderr, "Usage: %s [-t] [-p principal]\n", + argv[0]); + exit(1); } - print_types = 1; - print_krb5_types = 1; - print_id_and_len = 0; - print_constructed_length = 0; - print_skip_context = 1; - print_skip_tagnum = 1; - print_context_shortcut = 1; + } + print_types = 1; + print_krb5_types = 1; + print_id_and_len = 0; + print_constructed_length = 0; + print_skip_context = 1; + print_skip_tagnum = 1; + print_context_shortcut = 1; } int main(argc, argv) - int argc; - char **argv; + int argc; + char **argv; { - krb5_data *code; - krb5_error_code retval; + krb5_data *code; + krb5_error_code retval; - PRS(argc, argv); + PRS(argc, argv); - retval = krb5_init_context(&test_context); - if (retval) { - com_err(argv[0], retval, "while initializing krb5"); - exit(1); - } + retval = krb5_init_context(&test_context); + if (retval) { + com_err(argv[0], retval, "while initializing krb5"); + exit(1); + } -#define setup(value,type,typestring,constructor)\ - retval = constructor(&(value));\ - if(retval){\ - com_err("krb5_encode_test", retval, "while making sample %s", typestring);\ - exit(1);\ - } +#define setup(value,type,typestring,constructor) \ + retval = constructor(&(value)); \ + if (retval) { \ + com_err("krb5_encode_test", retval, "while making sample %s", typestring); \ + exit(1); \ + } -#define encode_run(value,type,typestring,description,encoder)\ - retval = encoder(&(value),&(code));\ - if(retval){\ - com_err("krb5_encode_test", retval,"while encoding %s", typestring);\ - exit(1);\ - }\ - encoder_print_results(code, typestring, description); +#define encode_run(value,type,typestring,description,encoder) \ + retval = encoder(&(value),&(code)); \ + if (retval) { \ + com_err("krb5_encode_test", retval,"while encoding %s", typestring); \ + exit(1); \ + } \ + encoder_print_results(code, typestring, description); - /****************************************************************/ - /* encode_krb5_authenticator */ - { - krb5_authenticator authent; - setup(authent,authenticator,"authenticator",ktest_make_sample_authenticator); - - encode_run(authent,authenticator,"authenticator","",encode_krb5_authenticator); - - ktest_destroy_checksum(&(authent.checksum)); - ktest_destroy_keyblock(&(authent.subkey)); - authent.seq_number = 0; - ktest_empty_authorization_data(authent.authorization_data); - encode_run(authent,authenticator,"authenticator","(optionals empty)",encode_krb5_authenticator); - - ktest_destroy_authorization_data(&(authent.authorization_data)); - encode_run(authent,authenticator,"authenticator","(optionals NULL)",encode_krb5_authenticator); - ktest_empty_authenticator(&authent); - } + /****************************************************************/ + /* encode_krb5_authenticator */ + { + krb5_authenticator authent; + setup(authent,authenticator,"authenticator",ktest_make_sample_authenticator); + + encode_run(authent,authenticator,"authenticator","",encode_krb5_authenticator); + + ktest_destroy_checksum(&(authent.checksum)); + ktest_destroy_keyblock(&(authent.subkey)); + authent.seq_number = 0; + ktest_empty_authorization_data(authent.authorization_data); + encode_run(authent,authenticator,"authenticator","(optionals empty)",encode_krb5_authenticator); + + ktest_destroy_authorization_data(&(authent.authorization_data)); + encode_run(authent,authenticator,"authenticator","(optionals NULL)",encode_krb5_authenticator); + ktest_empty_authenticator(&authent); + } - /****************************************************************/ - /* encode_krb5_ticket */ - { - krb5_ticket tkt; - setup(tkt,ticket,"ticket",ktest_make_sample_ticket); - encode_run(tkt,ticket,"ticket","",encode_krb5_ticket); - ktest_empty_ticket(&tkt); - } - - /****************************************************************/ - /* encode_krb5_encryption_key */ - { - krb5_keyblock keyblk; - setup(keyblk,keyblock,"keyblock",ktest_make_sample_keyblock); - current_appl_type = 1005; - encode_run(keyblk,keyblock,"keyblock","",encode_krb5_encryption_key); - ktest_empty_keyblock(&keyblk); - } + /****************************************************************/ + /* encode_krb5_ticket */ + { + krb5_ticket tkt; + setup(tkt,ticket,"ticket",ktest_make_sample_ticket); + encode_run(tkt,ticket,"ticket","",encode_krb5_ticket); + ktest_empty_ticket(&tkt); + } + + /****************************************************************/ + /* encode_krb5_encryption_key */ + { + krb5_keyblock keyblk; + setup(keyblk,keyblock,"keyblock",ktest_make_sample_keyblock); + current_appl_type = 1005; + encode_run(keyblk,keyblock,"keyblock","",encode_krb5_encryption_key); + ktest_empty_keyblock(&keyblk); + } - /****************************************************************/ - /* encode_krb5_enc_tkt_part */ - { - krb5_ticket tkt; - memset(&tkt, 0, sizeof(krb5_ticket)); - tkt.enc_part2 = (krb5_enc_tkt_part*)calloc(1,sizeof(krb5_enc_tkt_part)); - if(tkt.enc_part2 == NULL) com_err("allocating enc_tkt_part",errno,""); - setup(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part",ktest_make_sample_enc_tkt_part); + /****************************************************************/ + /* encode_krb5_enc_tkt_part */ + { + krb5_ticket tkt; + memset(&tkt, 0, sizeof(krb5_ticket)); + tkt.enc_part2 = (krb5_enc_tkt_part*)calloc(1,sizeof(krb5_enc_tkt_part)); + if (tkt.enc_part2 == NULL) com_err("allocating enc_tkt_part",errno,""); + setup(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part",ktest_make_sample_enc_tkt_part); - encode_run(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part","",encode_krb5_enc_tkt_part); + encode_run(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part","",encode_krb5_enc_tkt_part); - tkt.enc_part2->times.starttime = 0; - tkt.enc_part2->times.renew_till = 0; - ktest_destroy_address(&(tkt.enc_part2->caddrs[1])); - ktest_destroy_address(&(tkt.enc_part2->caddrs[0])); - ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[1])); - ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[0])); + tkt.enc_part2->times.starttime = 0; + tkt.enc_part2->times.renew_till = 0; + ktest_destroy_address(&(tkt.enc_part2->caddrs[1])); + ktest_destroy_address(&(tkt.enc_part2->caddrs[0])); + ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[1])); + ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[0])); - /* ISODE version fails on the empty caddrs field */ - ktest_destroy_addresses(&(tkt.enc_part2->caddrs)); - ktest_destroy_authorization_data(&(tkt.enc_part2->authorization_data)); + /* ISODE version fails on the empty caddrs field */ + ktest_destroy_addresses(&(tkt.enc_part2->caddrs)); + ktest_destroy_authorization_data(&(tkt.enc_part2->authorization_data)); - encode_run(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part","(optionals NULL)",encode_krb5_enc_tkt_part); - ktest_empty_ticket(&tkt); - } + encode_run(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part","(optionals NULL)",encode_krb5_enc_tkt_part); + ktest_empty_ticket(&tkt); + } - /****************************************************************/ - /* encode_krb5_enc_kdc_rep_part */ - { - krb5_kdc_rep kdcr; + /****************************************************************/ + /* encode_krb5_enc_kdc_rep_part */ + { + krb5_kdc_rep kdcr; - memset(&kdcr, 0, sizeof(kdcr)); + memset(&kdcr, 0, sizeof(kdcr)); - kdcr.enc_part2 = (krb5_enc_kdc_rep_part*) - calloc(1,sizeof(krb5_enc_kdc_rep_part)); - if(kdcr.enc_part2 == NULL) com_err("allocating enc_kdc_rep_part",errno,""); - setup(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part",ktest_make_sample_enc_kdc_rep_part); + kdcr.enc_part2 = (krb5_enc_kdc_rep_part*) + calloc(1,sizeof(krb5_enc_kdc_rep_part)); + if (kdcr.enc_part2 == NULL) com_err("allocating enc_kdc_rep_part",errno,""); + setup(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part",ktest_make_sample_enc_kdc_rep_part); - encode_run(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part","",encode_krb5_enc_kdc_rep_part); + encode_run(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part","",encode_krb5_enc_kdc_rep_part); - kdcr.enc_part2->key_exp = 0; - kdcr.enc_part2->times.starttime = 0; - kdcr.enc_part2->flags &= ~TKT_FLG_RENEWABLE; - ktest_destroy_addresses(&(kdcr.enc_part2->caddrs)); + kdcr.enc_part2->key_exp = 0; + kdcr.enc_part2->times.starttime = 0; + kdcr.enc_part2->flags &= ~TKT_FLG_RENEWABLE; + ktest_destroy_addresses(&(kdcr.enc_part2->caddrs)); - encode_run(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part","(optionals NULL)",encode_krb5_enc_kdc_rep_part); + encode_run(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part","(optionals NULL)",encode_krb5_enc_kdc_rep_part); - ktest_empty_kdc_rep(&kdcr); - } + ktest_empty_kdc_rep(&kdcr); + } - /****************************************************************/ - /* encode_krb5_as_rep */ - { - krb5_kdc_rep kdcr; - setup(kdcr,kdc_rep,"kdc_rep",ktest_make_sample_kdc_rep); + /****************************************************************/ + /* encode_krb5_as_rep */ + { + krb5_kdc_rep kdcr; + setup(kdcr,kdc_rep,"kdc_rep",ktest_make_sample_kdc_rep); /* kdcr.msg_type = KRB5_TGS_REP; - test(encode_krb5_as_rep(&kdcr,&code) == KRB5_BADMSGTYPE, - "encode_krb5_as_rep type check\n"); - ktest_destroy_data(&code);*/ + test(encode_krb5_as_rep(&kdcr,&code) == KRB5_BADMSGTYPE, + "encode_krb5_as_rep type check\n"); + ktest_destroy_data(&code);*/ - kdcr.msg_type = KRB5_AS_REP; - encode_run(kdcr,as_rep,"as_rep","",encode_krb5_as_rep); + kdcr.msg_type = KRB5_AS_REP; + encode_run(kdcr,as_rep,"as_rep","",encode_krb5_as_rep); - ktest_destroy_pa_data_array(&(kdcr.padata)); - encode_run(kdcr,as_rep,"as_rep","(optionals NULL)",encode_krb5_as_rep); + ktest_destroy_pa_data_array(&(kdcr.padata)); + encode_run(kdcr,as_rep,"as_rep","(optionals NULL)",encode_krb5_as_rep); - ktest_empty_kdc_rep(&kdcr); + ktest_empty_kdc_rep(&kdcr); - } + } - /****************************************************************/ - /* encode_krb5_tgs_rep */ - { - krb5_kdc_rep kdcr; - setup(kdcr,kdc_rep,"kdc_rep",ktest_make_sample_kdc_rep); + /****************************************************************/ + /* encode_krb5_tgs_rep */ + { + krb5_kdc_rep kdcr; + setup(kdcr,kdc_rep,"kdc_rep",ktest_make_sample_kdc_rep); /* kdcr.msg_type = KRB5_AS_REP; - test(encode_krb5_tgs_rep(&kdcr,&code) == KRB5_BADMSGTYPE, - "encode_krb5_tgs_rep type check\n");*/ + test(encode_krb5_tgs_rep(&kdcr,&code) == KRB5_BADMSGTYPE, + "encode_krb5_tgs_rep type check\n");*/ - kdcr.msg_type = KRB5_TGS_REP; - encode_run(kdcr,tgs_rep,"tgs_rep","",encode_krb5_tgs_rep); + kdcr.msg_type = KRB5_TGS_REP; + encode_run(kdcr,tgs_rep,"tgs_rep","",encode_krb5_tgs_rep); - ktest_destroy_pa_data_array(&(kdcr.padata)); - encode_run(kdcr,tgs_rep,"tgs_rep","(optionals NULL)",encode_krb5_tgs_rep); + ktest_destroy_pa_data_array(&(kdcr.padata)); + encode_run(kdcr,tgs_rep,"tgs_rep","(optionals NULL)",encode_krb5_tgs_rep); - ktest_empty_kdc_rep(&kdcr); + ktest_empty_kdc_rep(&kdcr); - } + } - /****************************************************************/ - /* encode_krb5_ap_req */ - { - krb5_ap_req apreq; - setup(apreq,ap_req,"ap_req",ktest_make_sample_ap_req); - encode_run(apreq,ap_req,"ap_req","",encode_krb5_ap_req); - ktest_empty_ap_req(&apreq); - } - - /****************************************************************/ - /* encode_krb5_ap_rep */ - { - krb5_ap_rep aprep; - setup(aprep,ap_rep,"ap_rep",ktest_make_sample_ap_rep); - encode_run(aprep,ap_rep,"ap_rep","",encode_krb5_ap_rep); - ktest_empty_ap_rep(&aprep); - } - - /****************************************************************/ - /* encode_krb5_ap_rep_enc_part */ - { - krb5_ap_rep_enc_part apenc; - setup(apenc,ap_rep_enc_part,"ap_rep_enc_part",ktest_make_sample_ap_rep_enc_part); - encode_run(apenc,ap_rep_enc_part,"ap_rep_enc_part","",encode_krb5_ap_rep_enc_part); + /****************************************************************/ + /* encode_krb5_ap_req */ + { + krb5_ap_req apreq; + setup(apreq,ap_req,"ap_req",ktest_make_sample_ap_req); + encode_run(apreq,ap_req,"ap_req","",encode_krb5_ap_req); + ktest_empty_ap_req(&apreq); + } + + /****************************************************************/ + /* encode_krb5_ap_rep */ + { + krb5_ap_rep aprep; + setup(aprep,ap_rep,"ap_rep",ktest_make_sample_ap_rep); + encode_run(aprep,ap_rep,"ap_rep","",encode_krb5_ap_rep); + ktest_empty_ap_rep(&aprep); + } + + /****************************************************************/ + /* encode_krb5_ap_rep_enc_part */ + { + krb5_ap_rep_enc_part apenc; + setup(apenc,ap_rep_enc_part,"ap_rep_enc_part",ktest_make_sample_ap_rep_enc_part); + encode_run(apenc,ap_rep_enc_part,"ap_rep_enc_part","",encode_krb5_ap_rep_enc_part); - ktest_destroy_keyblock(&(apenc.subkey)); - apenc.seq_number = 0; - encode_run(apenc,ap_rep_enc_part,"ap_rep_enc_part","(optionals NULL)",encode_krb5_ap_rep_enc_part); - ktest_empty_ap_rep_enc_part(&apenc); - } + ktest_destroy_keyblock(&(apenc.subkey)); + apenc.seq_number = 0; + encode_run(apenc,ap_rep_enc_part,"ap_rep_enc_part","(optionals NULL)",encode_krb5_ap_rep_enc_part); + ktest_empty_ap_rep_enc_part(&apenc); + } - /****************************************************************/ - /* encode_krb5_as_req */ - { - krb5_kdc_req asreq; - setup(asreq,kdc_req,"kdc_req",ktest_make_sample_kdc_req); - asreq.msg_type = KRB5_AS_REQ; - asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - encode_run(asreq,as_req,"as_req","",encode_krb5_as_req); - - ktest_destroy_pa_data_array(&(asreq.padata)); - ktest_destroy_principal(&(asreq.client)); + /****************************************************************/ + /* encode_krb5_as_req */ + { + krb5_kdc_req asreq; + setup(asreq,kdc_req,"kdc_req",ktest_make_sample_kdc_req); + asreq.msg_type = KRB5_AS_REQ; + asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + encode_run(asreq,as_req,"as_req","",encode_krb5_as_req); + + ktest_destroy_pa_data_array(&(asreq.padata)); + ktest_destroy_principal(&(asreq.client)); #ifndef ISODE_SUCKS - ktest_destroy_principal(&(asreq.server)); + ktest_destroy_principal(&(asreq.server)); #endif - asreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; - asreq.from = 0; - asreq.rtime = 0; - ktest_destroy_addresses(&(asreq.addresses)); - ktest_destroy_enc_data(&(asreq.authorization_data)); - encode_run(asreq,as_req,"as_req","(optionals NULL except second_ticket)",encode_krb5_as_req); - ktest_destroy_sequence_of_ticket(&(asreq.second_ticket)); + asreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; + asreq.from = 0; + asreq.rtime = 0; + ktest_destroy_addresses(&(asreq.addresses)); + ktest_destroy_enc_data(&(asreq.authorization_data)); + encode_run(asreq,as_req,"as_req","(optionals NULL except second_ticket)",encode_krb5_as_req); + ktest_destroy_sequence_of_ticket(&(asreq.second_ticket)); #ifndef ISODE_SUCKS - ktest_make_sample_principal(&(asreq.server)); + ktest_make_sample_principal(&(asreq.server)); #endif - asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - encode_run(asreq,as_req,"as_req","(optionals NULL except server)",encode_krb5_as_req); - ktest_empty_kdc_req(&asreq); - } + asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + encode_run(asreq,as_req,"as_req","(optionals NULL except server)",encode_krb5_as_req); + ktest_empty_kdc_req(&asreq); + } - /****************************************************************/ - /* encode_krb5_tgs_req */ - { - krb5_kdc_req tgsreq; - setup(tgsreq,kdc_req,"kdc_req",ktest_make_sample_kdc_req); - tgsreq.msg_type = KRB5_TGS_REQ; - tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - encode_run(tgsreq,tgs_req,"tgs_req","",encode_krb5_tgs_req); - - ktest_destroy_pa_data_array(&(tgsreq.padata)); - ktest_destroy_principal(&(tgsreq.client)); + /****************************************************************/ + /* encode_krb5_tgs_req */ + { + krb5_kdc_req tgsreq; + setup(tgsreq,kdc_req,"kdc_req",ktest_make_sample_kdc_req); + tgsreq.msg_type = KRB5_TGS_REQ; + tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + encode_run(tgsreq,tgs_req,"tgs_req","",encode_krb5_tgs_req); + + ktest_destroy_pa_data_array(&(tgsreq.padata)); + ktest_destroy_principal(&(tgsreq.client)); #ifndef ISODE_SUCKS - ktest_destroy_principal(&(tgsreq.server)); + ktest_destroy_principal(&(tgsreq.server)); #endif - tgsreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; - tgsreq.from = 0; - tgsreq.rtime = 0; - ktest_destroy_addresses(&(tgsreq.addresses)); - ktest_destroy_enc_data(&(tgsreq.authorization_data)); - encode_run(tgsreq,tgs_req,"tgs_req","(optionals NULL except second_ticket)",encode_krb5_tgs_req); - - ktest_destroy_sequence_of_ticket(&(tgsreq.second_ticket)); + tgsreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; + tgsreq.from = 0; + tgsreq.rtime = 0; + ktest_destroy_addresses(&(tgsreq.addresses)); + ktest_destroy_enc_data(&(tgsreq.authorization_data)); + encode_run(tgsreq,tgs_req,"tgs_req","(optionals NULL except second_ticket)",encode_krb5_tgs_req); + + ktest_destroy_sequence_of_ticket(&(tgsreq.second_ticket)); #ifndef ISODE_SUCKS - ktest_make_sample_principal(&(tgsreq.server)); + ktest_make_sample_principal(&(tgsreq.server)); #endif - tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - encode_run(tgsreq,tgs_req,"tgs_req","(optionals NULL except server)",encode_krb5_tgs_req); + tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + encode_run(tgsreq,tgs_req,"tgs_req","(optionals NULL except server)",encode_krb5_tgs_req); - ktest_empty_kdc_req(&tgsreq); - } + ktest_empty_kdc_req(&tgsreq); + } - /****************************************************************/ - /* encode_krb5_kdc_req_body */ - { - krb5_kdc_req kdcrb; - memset(&kdcrb, 0, sizeof(kdcrb)); - setup(kdcrb,kdc_req_body,"kdc_req_body",ktest_make_sample_kdc_req_body); - kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - current_appl_type = 1007; /* Force interpretation as kdc-req-body */ - encode_run(kdcrb,kdc_req_body,"kdc_req_body","",encode_krb5_kdc_req_body); - - ktest_destroy_principal(&(kdcrb.client)); + /****************************************************************/ + /* encode_krb5_kdc_req_body */ + { + krb5_kdc_req kdcrb; + memset(&kdcrb, 0, sizeof(kdcrb)); + setup(kdcrb,kdc_req_body,"kdc_req_body",ktest_make_sample_kdc_req_body); + kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + current_appl_type = 1007; /* Force interpretation as kdc-req-body */ + encode_run(kdcrb,kdc_req_body,"kdc_req_body","",encode_krb5_kdc_req_body); + + ktest_destroy_principal(&(kdcrb.client)); #ifndef ISODE_SUCKS - ktest_destroy_principal(&(kdcrb.server)); + ktest_destroy_principal(&(kdcrb.server)); #endif - kdcrb.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; - kdcrb.from = 0; - kdcrb.rtime = 0; - ktest_destroy_addresses(&(kdcrb.addresses)); - ktest_destroy_enc_data(&(kdcrb.authorization_data)); - current_appl_type = 1007; /* Force interpretation as kdc-req-body */ - encode_run(kdcrb,kdc_req_body,"kdc_req_body","(optionals NULL except second_ticket)",encode_krb5_kdc_req_body); - - ktest_destroy_sequence_of_ticket(&(kdcrb.second_ticket)); + kdcrb.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY; + kdcrb.from = 0; + kdcrb.rtime = 0; + ktest_destroy_addresses(&(kdcrb.addresses)); + ktest_destroy_enc_data(&(kdcrb.authorization_data)); + current_appl_type = 1007; /* Force interpretation as kdc-req-body */ + encode_run(kdcrb,kdc_req_body,"kdc_req_body","(optionals NULL except second_ticket)",encode_krb5_kdc_req_body); + + ktest_destroy_sequence_of_ticket(&(kdcrb.second_ticket)); #ifndef ISODE_SUCKS - ktest_make_sample_principal(&(kdcrb.server)); + ktest_make_sample_principal(&(kdcrb.server)); #endif - kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; - current_appl_type = 1007; /* Force interpretation as kdc-req-body */ - encode_run(kdcrb,kdc_req_body,"kdc_req_body","(optionals NULL except server)",encode_krb5_kdc_req_body); + kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY; + current_appl_type = 1007; /* Force interpretation as kdc-req-body */ + encode_run(kdcrb,kdc_req_body,"kdc_req_body","(optionals NULL except server)",encode_krb5_kdc_req_body); - ktest_empty_kdc_req(&kdcrb); - } - - /****************************************************************/ - /* encode_krb5_safe */ - { - krb5_safe s; - setup(s,safe,"safe",ktest_make_sample_safe); - encode_run(s,safe,"safe","",encode_krb5_safe); - - s.timestamp = 0; - /* s.usec should be opted out by the timestamp */ - s.seq_number = 0; - ktest_destroy_address(&(s.r_address)); - encode_run(s,safe,"safe","(optionals NULL)",encode_krb5_safe); - - ktest_empty_safe(&s); - } + ktest_empty_kdc_req(&kdcrb); + } - /****************************************************************/ - /* encode_krb5_priv */ - { - krb5_priv p; - setup(p,priv,"priv",ktest_make_sample_priv); - encode_run(p,priv,"priv","",encode_krb5_priv); - ktest_empty_priv(&p); - } + /****************************************************************/ + /* encode_krb5_safe */ + { + krb5_safe s; + setup(s,safe,"safe",ktest_make_sample_safe); + encode_run(s,safe,"safe","",encode_krb5_safe); + + s.timestamp = 0; + /* s.usec should be opted out by the timestamp */ + s.seq_number = 0; + ktest_destroy_address(&(s.r_address)); + encode_run(s,safe,"safe","(optionals NULL)",encode_krb5_safe); + + ktest_empty_safe(&s); + } - /****************************************************************/ - /* encode_krb5_enc_priv_part */ - { - krb5_priv_enc_part ep; - setup(ep,priv_enc_part,"priv_enc_part",ktest_make_sample_priv_enc_part); - encode_run(ep,enc_priv_part,"enc_priv_part","",encode_krb5_enc_priv_part); - - ep.timestamp = 0; - /* ep.usec should be opted out along with timestamp */ - ep.seq_number = 0; - ktest_destroy_address(&(ep.r_address)); - encode_run(ep,enc_priv_part,"enc_priv_part","(optionals NULL)",encode_krb5_enc_priv_part); - - ktest_empty_priv_enc_part(&ep); - } + /****************************************************************/ + /* encode_krb5_priv */ + { + krb5_priv p; + setup(p,priv,"priv",ktest_make_sample_priv); + encode_run(p,priv,"priv","",encode_krb5_priv); + ktest_empty_priv(&p); + } - /****************************************************************/ - /* encode_krb5_cred */ - { - krb5_cred c; - setup(c,cred,"cred",ktest_make_sample_cred); - encode_run(c,cred,"cred","",encode_krb5_cred); - ktest_empty_cred(&c); - } + /****************************************************************/ + /* encode_krb5_enc_priv_part */ + { + krb5_priv_enc_part ep; + setup(ep,priv_enc_part,"priv_enc_part",ktest_make_sample_priv_enc_part); + encode_run(ep,enc_priv_part,"enc_priv_part","",encode_krb5_enc_priv_part); + + ep.timestamp = 0; + /* ep.usec should be opted out along with timestamp */ + ep.seq_number = 0; + ktest_destroy_address(&(ep.r_address)); + encode_run(ep,enc_priv_part,"enc_priv_part","(optionals NULL)",encode_krb5_enc_priv_part); + + ktest_empty_priv_enc_part(&ep); + } - /****************************************************************/ - /* encode_krb5_enc_cred_part */ - { - krb5_cred_enc_part cep; - setup(cep,cred_enc_part,"cred_enc_part",ktest_make_sample_cred_enc_part); - encode_run(cep,enc_cred_part,"enc_cred_part","",encode_krb5_enc_cred_part); - - ktest_destroy_principal(&(cep.ticket_info[0]->client)); - ktest_destroy_principal(&(cep.ticket_info[0]->server)); - cep.ticket_info[0]->flags = 0; - cep.ticket_info[0]->times.authtime = 0; - cep.ticket_info[0]->times.starttime = 0; - cep.ticket_info[0]->times.endtime = 0; - cep.ticket_info[0]->times.renew_till = 0; - ktest_destroy_addresses(&(cep.ticket_info[0]->caddrs)); - cep.nonce = 0; - cep.timestamp = 0; - ktest_destroy_address(&(cep.s_address)); - ktest_destroy_address(&(cep.r_address)); - encode_run(cep,enc_cred_part,"enc_cred_part","(optionals NULL)",encode_krb5_enc_cred_part); - - ktest_empty_cred_enc_part(&cep); - } + /****************************************************************/ + /* encode_krb5_cred */ + { + krb5_cred c; + setup(c,cred,"cred",ktest_make_sample_cred); + encode_run(c,cred,"cred","",encode_krb5_cred); + ktest_empty_cred(&c); + } - /****************************************************************/ - /* encode_krb5_error */ - { - krb5_error kerr; - setup(kerr,error,"error",ktest_make_sample_error); - encode_run(kerr,error,"error","",encode_krb5_error); - - kerr.ctime = 0; - ktest_destroy_principal(&(kerr.client)); - ktest_empty_data(&(kerr.text)); - ktest_empty_data(&(kerr.e_data)); - encode_run(kerr,error,"error","(optionals NULL)",encode_krb5_error); - - ktest_empty_error(&kerr); - } + /****************************************************************/ + /* encode_krb5_enc_cred_part */ + { + krb5_cred_enc_part cep; + setup(cep,cred_enc_part,"cred_enc_part",ktest_make_sample_cred_enc_part); + encode_run(cep,enc_cred_part,"enc_cred_part","",encode_krb5_enc_cred_part); + + ktest_destroy_principal(&(cep.ticket_info[0]->client)); + ktest_destroy_principal(&(cep.ticket_info[0]->server)); + cep.ticket_info[0]->flags = 0; + cep.ticket_info[0]->times.authtime = 0; + cep.ticket_info[0]->times.starttime = 0; + cep.ticket_info[0]->times.endtime = 0; + cep.ticket_info[0]->times.renew_till = 0; + ktest_destroy_addresses(&(cep.ticket_info[0]->caddrs)); + cep.nonce = 0; + cep.timestamp = 0; + ktest_destroy_address(&(cep.s_address)); + ktest_destroy_address(&(cep.r_address)); + encode_run(cep,enc_cred_part,"enc_cred_part","(optionals NULL)",encode_krb5_enc_cred_part); + + ktest_empty_cred_enc_part(&cep); + } - /****************************************************************/ - /* encode_krb5_authdata */ - { - krb5_authdata **ad; - setup(ad,authorization_data,"authorization_data",ktest_make_sample_authorization_data); - - retval = encode_krb5_authdata((const krb5_authdata**)ad,&(code)); - if(retval) { - com_err("encoding authorization_data",retval,""); - exit(1); + /****************************************************************/ + /* encode_krb5_error */ + { + krb5_error kerr; + setup(kerr,error,"error",ktest_make_sample_error); + encode_run(kerr,error,"error","",encode_krb5_error); + + kerr.ctime = 0; + ktest_destroy_principal(&(kerr.client)); + ktest_empty_data(&(kerr.text)); + ktest_empty_data(&(kerr.e_data)); + encode_run(kerr,error,"error","(optionals NULL)",encode_krb5_error); + + ktest_empty_error(&kerr); } - current_appl_type = 1004; /* Force type to be authdata */ - encoder_print_results(code, "authorization_data", ""); + + /****************************************************************/ + /* encode_krb5_authdata */ + { + krb5_authdata **ad; + setup(ad,authorization_data,"authorization_data",ktest_make_sample_authorization_data); + + retval = encode_krb5_authdata((const krb5_authdata**)ad,&(code)); + if (retval) { + com_err("encoding authorization_data",retval,""); + exit(1); + } + current_appl_type = 1004; /* Force type to be authdata */ + encoder_print_results(code, "authorization_data", ""); - ktest_destroy_authorization_data(&ad); - } + ktest_destroy_authorization_data(&ad); + } - /****************************************************************/ - /* encode_pwd_sequence */ - { - passwd_phrase_element ppe; - setup(ppe,passwd_phrase_element,"PasswdSequence",ktest_make_sample_passwd_phrase_element); - encode_run(ppe,passwd_phrase_element,"pwd_sequence","",encode_krb5_pwd_sequence); - ktest_empty_passwd_phrase_element(&ppe); - } - - /****************************************************************/ - /* encode_passwd_data */ - { - krb5_pwd_data pd; - setup(pd,krb5_pwd_data,"PasswdData",ktest_make_sample_krb5_pwd_data); - encode_run(pd,krb5_pwd_data,"pwd_data","",encode_krb5_pwd_data); - ktest_empty_pwd_data(&pd); - } - - /****************************************************************/ - /* encode_padata_sequence */ - { - krb5_pa_data **pa; - - setup(pa,krb5_pa_data,"PreauthData",ktest_make_sample_pa_data_array); - retval = encode_krb5_padata_sequence((const krb5_pa_data**)pa,&(code)); - if(retval) { - com_err("encoding padata_sequence",retval,""); - exit(1); + /****************************************************************/ + /* encode_pwd_sequence */ + { + passwd_phrase_element ppe; + setup(ppe,passwd_phrase_element,"PasswdSequence",ktest_make_sample_passwd_phrase_element); + encode_run(ppe,passwd_phrase_element,"pwd_sequence","",encode_krb5_pwd_sequence); + ktest_empty_passwd_phrase_element(&ppe); + } + + /****************************************************************/ + /* encode_passwd_data */ + { + krb5_pwd_data pd; + setup(pd,krb5_pwd_data,"PasswdData",ktest_make_sample_krb5_pwd_data); + encode_run(pd,krb5_pwd_data,"pwd_data","",encode_krb5_pwd_data); + ktest_empty_pwd_data(&pd); } - encoder_print_results(code, "padata_sequence", ""); - - ktest_destroy_pa_data_array(&pa); - } - /****************************************************************/ - /* encode_padata_sequence (empty) */ - { - krb5_pa_data **pa; + /****************************************************************/ + /* encode_padata_sequence */ + { + krb5_pa_data **pa; - setup(pa,krb5_pa_data,"EmptyPreauthData",ktest_make_sample_empty_pa_data_array); - retval = encode_krb5_padata_sequence((const krb5_pa_data**)pa,&(code)); - if(retval) { - com_err("encoding padata_sequence(empty)",retval,""); - exit(1); + setup(pa,krb5_pa_data,"PreauthData",ktest_make_sample_pa_data_array); + retval = encode_krb5_padata_sequence((const krb5_pa_data**)pa,&(code)); + if (retval) { + com_err("encoding padata_sequence",retval,""); + exit(1); + } + encoder_print_results(code, "padata_sequence", ""); + + ktest_destroy_pa_data_array(&pa); } - encoder_print_results(code, "padata_sequence(empty)", ""); - - ktest_destroy_pa_data_array(&pa); - } - - /****************************************************************/ - /* encode_alt_method */ - { - krb5_alt_method am; - setup(am,krb5_alt_method,"AltMethod",ktest_make_sample_alt_method); - encode_run(am,krb5_alt_method,"alt_method","",encode_krb5_alt_method); - am.length = 0; - if (am.data) - free(am.data); - am.data = 0; - encode_run(am,krb5_alt_method,"alt_method (no data)","", - encode_krb5_alt_method); - ktest_empty_alt_method(&am); - } - - /****************************************************************/ - /* encode_etype_info */ - { - krb5_etype_info_entry **info; + + /****************************************************************/ + /* encode_padata_sequence (empty) */ + { + krb5_pa_data **pa; - setup(info,krb5_etype_info_entry **,"etype_info", - ktest_make_sample_etype_info); - retval = encode_krb5_etype_info((const krb5_etype_info_entry **)info,&(code)); - if(retval) { - com_err("encoding etype_info",retval,""); - exit(1); + setup(pa,krb5_pa_data,"EmptyPreauthData",ktest_make_sample_empty_pa_data_array); + retval = encode_krb5_padata_sequence((const krb5_pa_data**)pa,&(code)); + if (retval) { + com_err("encoding padata_sequence(empty)",retval,""); + exit(1); + } + encoder_print_results(code, "padata_sequence(empty)", ""); + + ktest_destroy_pa_data_array(&pa); } - encoder_print_results(code, "etype_info", ""); - ktest_destroy_etype_info_entry(info[2]); info[2] = 0; - ktest_destroy_etype_info_entry(info[1]); info[1] = 0; - retval = encode_krb5_etype_info((const krb5_etype_info_entry **)info,&(code)); - if(retval) { - com_err("encoding etype_info (only 1)",retval,""); - exit(1); + /****************************************************************/ + /* encode_alt_method */ + { + krb5_alt_method am; + setup(am,krb5_alt_method,"AltMethod",ktest_make_sample_alt_method); + encode_run(am,krb5_alt_method,"alt_method","",encode_krb5_alt_method); + am.length = 0; + if (am.data) + free(am.data); + am.data = 0; + encode_run(am,krb5_alt_method,"alt_method (no data)","", + encode_krb5_alt_method); + ktest_empty_alt_method(&am); } - encoder_print_results(code, "etype_info (only 1)", ""); - ktest_destroy_etype_info_entry(info[0]); info[0] = 0; + /****************************************************************/ + /* encode_etype_info */ + { + krb5_etype_info_entry **info; - retval = encode_krb5_etype_info((const krb5_etype_info_entry **)info,&(code)); - if(retval) { - com_err("encoding etype_info (no info)",retval,""); - exit(1); + setup(info,krb5_etype_info_entry **,"etype_info", + ktest_make_sample_etype_info); + retval = encode_krb5_etype_info((const krb5_etype_info_entry **)info,&(code)); + if (retval) { + com_err("encoding etype_info",retval,""); + exit(1); + } + encoder_print_results(code, "etype_info", ""); + ktest_destroy_etype_info_entry(info[2]); info[2] = 0; + ktest_destroy_etype_info_entry(info[1]); info[1] = 0; + + retval = encode_krb5_etype_info((const krb5_etype_info_entry **)info,&(code)); + if (retval) { + com_err("encoding etype_info (only 1)",retval,""); + exit(1); + } + encoder_print_results(code, "etype_info (only 1)", ""); + + ktest_destroy_etype_info_entry(info[0]); info[0] = 0; + + retval = encode_krb5_etype_info((const krb5_etype_info_entry **)info,&(code)); + if (retval) { + com_err("encoding etype_info (no info)",retval,""); + exit(1); + } + encoder_print_results(code, "etype_info (no info)", ""); + + ktest_destroy_etype_info(info); } - encoder_print_results(code, "etype_info (no info)", ""); - ktest_destroy_etype_info(info); - } + /* encode_etype_info 2*/ + { + krb5_etype_info_entry **info; + + setup(info,krb5_etype_info_entry **,"etype_info2", + ktest_make_sample_etype_info2); + retval = encode_krb5_etype_info2((const krb5_etype_info_entry **)info,&(code)); + if (retval) { + com_err("encoding etype_info",retval,""); + exit(1); + } + encoder_print_results(code, "etype_info2", ""); + ktest_destroy_etype_info_entry(info[2]); info[2] = 0; + ktest_destroy_etype_info_entry(info[1]); info[1] = 0; + + retval = encode_krb5_etype_info2((const krb5_etype_info_entry **)info,&(code)); + if (retval) { + com_err("encoding etype_info (only 1)",retval,""); + exit(1); + } + encoder_print_results(code, "etype_info2 (only 1)", ""); - /* encode_etype_info 2*/ - { - krb5_etype_info_entry **info; + ktest_destroy_etype_info(info); +/* ktest_destroy_etype_info_entry(info[0]); info[0] = 0;*/ - setup(info,krb5_etype_info_entry **,"etype_info2", - ktest_make_sample_etype_info2); - retval = encode_krb5_etype_info2((const krb5_etype_info_entry **)info,&(code)); - if(retval) { - com_err("encoding etype_info",retval,""); - exit(1); } - encoder_print_results(code, "etype_info2", ""); - ktest_destroy_etype_info_entry(info[2]); info[2] = 0; - ktest_destroy_etype_info_entry(info[1]); info[1] = 0; - retval = encode_krb5_etype_info2((const krb5_etype_info_entry **)info,&(code)); - if(retval) { - com_err("encoding etype_info (only 1)",retval,""); - exit(1); + /****************************************************************/ + /* encode_pa_enc_ts */ + { + krb5_pa_enc_ts pa_enc; + setup(pa_enc,krb5_pa_enc_ts,"pa_enc_ts",ktest_make_sample_pa_enc_ts); + encode_run(pa_enc,krb5_pa_enc_ts,"pa_enc_ts","",encode_krb5_pa_enc_ts); + pa_enc.pausec = 0; + encode_run(pa_enc,krb5_pa_enc_ts,"pa_enc_ts (no usec)","",encode_krb5_pa_enc_ts); } - encoder_print_results(code, "etype_info2 (only 1)", ""); - ktest_destroy_etype_info(info); -/* ktest_destroy_etype_info_entry(info[0]); info[0] = 0;*/ - - } - - /****************************************************************/ - /* encode_pa_enc_ts */ - { - krb5_pa_enc_ts pa_enc; - setup(pa_enc,krb5_pa_enc_ts,"pa_enc_ts",ktest_make_sample_pa_enc_ts); - encode_run(pa_enc,krb5_pa_enc_ts,"pa_enc_ts","",encode_krb5_pa_enc_ts); - pa_enc.pausec = 0; - encode_run(pa_enc,krb5_pa_enc_ts,"pa_enc_ts (no usec)","",encode_krb5_pa_enc_ts); - } - - /****************************************************************/ - /* encode_enc_data */ - { - krb5_enc_data enc_data; - setup(enc_data,krb5_enc_data,"enc_data",ktest_make_sample_enc_data); - current_appl_type = 1001; - encode_run(enc_data,krb5_enc_data,"enc_data","",encode_krb5_enc_data); - ktest_destroy_enc_data(&enc_data); - } - /****************************************************************/ - /* encode_krb5_sam_challenge */ - { - krb5_sam_challenge sam_ch; - setup(sam_ch,krb5_sam_challenge,"sam_challenge", - ktest_make_sample_sam_challenge); - encode_run(sam_ch,krb5_sam_challenge,"sam_challenge","", - encode_krb5_sam_challenge); - ktest_empty_sam_challenge(&sam_ch); - } - /****************************************************************/ - /* encode_krb5_sam_response */ - { - krb5_sam_response sam_ch; - setup(sam_ch,krb5_sam_response,"sam_response", - ktest_make_sample_sam_response); - encode_run(sam_ch,krb5_sam_response,"sam_response","", - encode_krb5_sam_response); - ktest_empty_sam_response(&sam_ch); - } + /****************************************************************/ + /* encode_enc_data */ + { + krb5_enc_data enc_data; + setup(enc_data,krb5_enc_data,"enc_data",ktest_make_sample_enc_data); + current_appl_type = 1001; + encode_run(enc_data,krb5_enc_data,"enc_data","",encode_krb5_enc_data); + ktest_destroy_enc_data(&enc_data); + } + /****************************************************************/ + /* encode_krb5_sam_challenge */ + { + krb5_sam_challenge sam_ch; + setup(sam_ch,krb5_sam_challenge,"sam_challenge", + ktest_make_sample_sam_challenge); + encode_run(sam_ch,krb5_sam_challenge,"sam_challenge","", + encode_krb5_sam_challenge); + ktest_empty_sam_challenge(&sam_ch); + } + /****************************************************************/ + /* encode_krb5_sam_response */ + { + krb5_sam_response sam_ch; + setup(sam_ch,krb5_sam_response,"sam_response", + ktest_make_sample_sam_response); + encode_run(sam_ch,krb5_sam_response,"sam_response","", + encode_krb5_sam_response); + ktest_empty_sam_response(&sam_ch); + } #if 0 - /****************************************************************/ - /* encode_krb5_sam_key */ - { - krb5_sam_key sam_ch; - setup(sam_ch,krb5_sam_key,"sam_key", - ktest_make_sample_sam_key); - encode_run(sam_ch,krb5_sam_key,"sam_key","", - encode_krb5_sam_key); - } - /****************************************************************/ - /* encode_krb5_enc_sam_response_enc */ - { - krb5_enc_sam_response_enc sam_ch; - setup(sam_ch,krb5_enc_sam_response_enc,"enc_sam_response_enc", - ktest_make_sample_enc_sam_response_enc); - encode_run(sam_ch,krb5_enc_sam_response_enc,"enc_sam_response_enc","", - encode_krb5_enc_sam_response_enc); - } - /****************************************************************/ - /* encode_krb5_predicted_sam_response */ - { - krb5_predicted_sam_response sam_ch; - setup(sam_ch,krb5_predicted_sam_response,"predicted_sam_response", - ktest_make_sample_predicted_sam_response); - encode_run(sam_ch,krb5_predicted_sam_response,"predicted_sam_response","", - encode_krb5_predicted_sam_response); - } + /****************************************************************/ + /* encode_krb5_sam_key */ + { + krb5_sam_key sam_ch; + setup(sam_ch,krb5_sam_key,"sam_key", + ktest_make_sample_sam_key); + encode_run(sam_ch,krb5_sam_key,"sam_key","", + encode_krb5_sam_key); + } + /****************************************************************/ + /* encode_krb5_enc_sam_response_enc */ + { + krb5_enc_sam_response_enc sam_ch; + setup(sam_ch,krb5_enc_sam_response_enc,"enc_sam_response_enc", + ktest_make_sample_enc_sam_response_enc); + encode_run(sam_ch,krb5_enc_sam_response_enc,"enc_sam_response_enc","", + encode_krb5_enc_sam_response_enc); + } + /****************************************************************/ + /* encode_krb5_predicted_sam_response */ + { + krb5_predicted_sam_response sam_ch; + setup(sam_ch,krb5_predicted_sam_response,"predicted_sam_response", + ktest_make_sample_predicted_sam_response); + encode_run(sam_ch,krb5_predicted_sam_response,"predicted_sam_response","", + encode_krb5_predicted_sam_response); + } #endif - krb5_free_context(test_context); - exit(error_count); - return(error_count); + krb5_free_context(test_context); + exit(error_count); + return(error_count); } diff --git a/src/tests/asn.1/ktest.c b/src/tests/asn.1/ktest.c index 12ff8fb93f..179512cbe5 100644 --- a/src/tests/asn.1/ktest.c +++ b/src/tests/asn.1/ktest.c @@ -5,636 +5,636 @@ char *sample_principal_name = "hftsai/extra@ATHENA.MIT.EDU"; krb5_error_code ktest_make_sample_authenticator(a) - krb5_authenticator * a; -{ - krb5_error_code retval; - - retval = ktest_make_sample_principal(&(a->client)); - if(retval) return retval; - a->checksum = (krb5_checksum*)calloc(1,sizeof(krb5_checksum)); - if(a->checksum == NULL) return ENOMEM; - retval = ktest_make_sample_checksum(a->checksum); - if(retval) return retval; - a->cusec = SAMPLE_USEC; - a->ctime = SAMPLE_TIME; - a->subkey = (krb5_keyblock*)calloc(1,sizeof(krb5_keyblock)); - if(a->subkey == NULL) return ENOMEM; - retval = ktest_make_sample_keyblock(a->subkey); - if(retval) return retval; - a->seq_number = SAMPLE_SEQ_NUMBER; - retval = ktest_make_sample_authorization_data(&(a->authorization_data)); - if(retval) return retval; + krb5_authenticator * a; +{ + krb5_error_code retval; + + retval = ktest_make_sample_principal(&(a->client)); + if (retval) return retval; + a->checksum = (krb5_checksum*)calloc(1,sizeof(krb5_checksum)); + if (a->checksum == NULL) return ENOMEM; + retval = ktest_make_sample_checksum(a->checksum); + if (retval) return retval; + a->cusec = SAMPLE_USEC; + a->ctime = SAMPLE_TIME; + a->subkey = (krb5_keyblock*)calloc(1,sizeof(krb5_keyblock)); + if (a->subkey == NULL) return ENOMEM; + retval = ktest_make_sample_keyblock(a->subkey); + if (retval) return retval; + a->seq_number = SAMPLE_SEQ_NUMBER; + retval = ktest_make_sample_authorization_data(&(a->authorization_data)); + if (retval) return retval; - return 0; + return 0; } krb5_error_code ktest_make_sample_principal(p) - krb5_principal * p; + krb5_principal * p; { - krb5_error_code retval; + krb5_error_code retval; - retval = krb5_parse_name(test_context, sample_principal_name, p); - return retval; + retval = krb5_parse_name(test_context, sample_principal_name, p); + return retval; } krb5_error_code ktest_make_sample_checksum(cs) - krb5_checksum * cs; + krb5_checksum * cs; { - cs->checksum_type = 1; - cs->length = 4; - cs->contents = (krb5_octet*)calloc(4,sizeof(krb5_octet)); - if(cs->contents == NULL) return ENOMEM; - memcpy(cs->contents,"1234",4); + cs->checksum_type = 1; + cs->length = 4; + cs->contents = (krb5_octet*)calloc(4,sizeof(krb5_octet)); + if (cs->contents == NULL) return ENOMEM; + memcpy(cs->contents,"1234",4); - return 0; + return 0; } krb5_error_code ktest_make_sample_keyblock(kb) - krb5_keyblock * kb; + krb5_keyblock * kb; { - kb->magic = KV5M_KEYBLOCK; - kb->enctype = 1; - kb->length = 8; - kb->contents = (krb5_octet*)calloc(8,sizeof(krb5_octet)); - if(kb->contents == NULL) return ENOMEM; - memcpy(kb->contents,"12345678",8); + kb->magic = KV5M_KEYBLOCK; + kb->enctype = 1; + kb->length = 8; + kb->contents = (krb5_octet*)calloc(8,sizeof(krb5_octet)); + if (kb->contents == NULL) return ENOMEM; + memcpy(kb->contents,"12345678",8); - return 0; + return 0; } krb5_error_code ktest_make_sample_ticket(tkt) - krb5_ticket * tkt; + krb5_ticket * tkt; { - krb5_error_code retval; + krb5_error_code retval; - retval = ktest_make_sample_principal(&(tkt->server)); - if(retval) return retval; - retval = ktest_make_sample_enc_data(&(tkt->enc_part)); - if(retval) return retval; - tkt->enc_part2 = NULL; + retval = ktest_make_sample_principal(&(tkt->server)); + if (retval) return retval; + retval = ktest_make_sample_enc_data(&(tkt->enc_part)); + if (retval) return retval; + tkt->enc_part2 = NULL; - return 0; + return 0; } krb5_error_code ktest_make_sample_enc_data(ed) - krb5_enc_data * ed; + krb5_enc_data * ed; { - krb5_error_code retval; + krb5_error_code retval; - ed->kvno = 5; - ed->enctype = 0; - retval = krb5_data_parse(&(ed->ciphertext),"krbASN.1 test message"); - if(retval) return retval; + ed->kvno = 5; + ed->enctype = 0; + retval = krb5_data_parse(&(ed->ciphertext),"krbASN.1 test message"); + if (retval) return retval; - return 0; + return 0; } krb5_error_code ktest_make_sample_enc_tkt_part(etp) - krb5_enc_tkt_part * etp; -{ - krb5_error_code retval; - - etp->flags = SAMPLE_FLAGS; - etp->session = (krb5_keyblock*)calloc(1,sizeof(krb5_keyblock)); - if(etp->session == NULL) return ENOMEM; - retval = ktest_make_sample_keyblock(etp->session); - if(retval) return retval; - retval = ktest_make_sample_principal(&(etp->client)); - if(retval) return retval; - retval = ktest_make_sample_transited(&(etp->transited)); - if(retval) return retval; - retval = ktest_make_sample_ticket_times(&(etp->times)); - if(retval) return retval; - retval = ktest_make_sample_addresses(&(etp->caddrs)); - if(retval) return retval; - retval = ktest_make_sample_authorization_data(&(etp->authorization_data)); - if(retval) return retval; - return 0; + krb5_enc_tkt_part * etp; +{ + krb5_error_code retval; + + etp->flags = SAMPLE_FLAGS; + etp->session = (krb5_keyblock*)calloc(1,sizeof(krb5_keyblock)); + if (etp->session == NULL) return ENOMEM; + retval = ktest_make_sample_keyblock(etp->session); + if (retval) return retval; + retval = ktest_make_sample_principal(&(etp->client)); + if (retval) return retval; + retval = ktest_make_sample_transited(&(etp->transited)); + if (retval) return retval; + retval = ktest_make_sample_ticket_times(&(etp->times)); + if (retval) return retval; + retval = ktest_make_sample_addresses(&(etp->caddrs)); + if (retval) return retval; + retval = ktest_make_sample_authorization_data(&(etp->authorization_data)); + if (retval) return retval; + return 0; } krb5_error_code ktest_make_sample_addresses(caddrs) - krb5_address *** caddrs; -{ - asn1_error_code retval; - int i; - - *caddrs = (krb5_address**)calloc(3,sizeof(krb5_address*)); - if(*caddrs == NULL) return ENOMEM; - for(i=0; i<2; i++){ - (*caddrs)[i] = (krb5_address*)calloc(1,sizeof(krb5_address)); - if((*caddrs)[i] == NULL) return ENOMEM; - retval = ktest_make_sample_address((*caddrs)[i]); - if(retval) return retval; - } - (*caddrs)[2] = NULL; - return 0; + krb5_address *** caddrs; +{ + asn1_error_code retval; + int i; + + *caddrs = (krb5_address**)calloc(3,sizeof(krb5_address*)); + if (*caddrs == NULL) return ENOMEM; + for (i=0; i<2; i++) { + (*caddrs)[i] = (krb5_address*)calloc(1,sizeof(krb5_address)); + if ((*caddrs)[i] == NULL) return ENOMEM; + retval = ktest_make_sample_address((*caddrs)[i]); + if (retval) return retval; + } + (*caddrs)[2] = NULL; + return 0; } krb5_error_code ktest_make_sample_authorization_data(ad) - krb5_authdata *** ad; + krb5_authdata *** ad; { - krb5_error_code retval; - int i; + krb5_error_code retval; + int i; - *ad = (krb5_authdata**)calloc(3,sizeof(krb5_authdata*)); - if(*ad == NULL) return ENOMEM; + *ad = (krb5_authdata**)calloc(3,sizeof(krb5_authdata*)); + if (*ad == NULL) return ENOMEM; - for(i=0; i<=1; i++){ - (*ad)[i] = (krb5_authdata*)calloc(1,sizeof(krb5_authdata)); - if((*ad)[i] == NULL) return ENOMEM; - retval = ktest_make_sample_authdata((*ad)[i]); - if(retval) return retval; - } - (*ad)[2] = NULL; + for (i=0; i<=1; i++) { + (*ad)[i] = (krb5_authdata*)calloc(1,sizeof(krb5_authdata)); + if ((*ad)[i] == NULL) return ENOMEM; + retval = ktest_make_sample_authdata((*ad)[i]); + if (retval) return retval; + } + (*ad)[2] = NULL; - return 0; + return 0; } krb5_error_code ktest_make_sample_transited(t) - krb5_transited * t; + krb5_transited * t; { - t->tr_type = 1; - return krb5_data_parse(&(t->tr_contents), - "EDU,MIT.,ATHENA.,WASHINGTON.EDU,CS."); + t->tr_type = 1; + return krb5_data_parse(&(t->tr_contents), + "EDU,MIT.,ATHENA.,WASHINGTON.EDU,CS."); } krb5_error_code ktest_make_sample_ticket_times(tt) - krb5_ticket_times * tt; + krb5_ticket_times * tt; { - tt->authtime = SAMPLE_TIME; - tt->starttime = SAMPLE_TIME; - tt->endtime = SAMPLE_TIME; - tt->renew_till = SAMPLE_TIME; - return 0; + tt->authtime = SAMPLE_TIME; + tt->starttime = SAMPLE_TIME; + tt->endtime = SAMPLE_TIME; + tt->renew_till = SAMPLE_TIME; + return 0; } krb5_error_code ktest_make_sample_address(a) - krb5_address * a; + krb5_address * a; { - a->addrtype = ADDRTYPE_INET; - a->length = 4; - a->contents = (krb5_octet*)calloc(4,sizeof(krb5_octet)); - if(a->contents == NULL) return ENOMEM; - a->contents[0] = 18; - a->contents[1] = 208; - a->contents[2] = 0; - a->contents[3] = 35; + a->addrtype = ADDRTYPE_INET; + a->length = 4; + a->contents = (krb5_octet*)calloc(4,sizeof(krb5_octet)); + if (a->contents == NULL) return ENOMEM; + a->contents[0] = 18; + a->contents[1] = 208; + a->contents[2] = 0; + a->contents[3] = 35; - return 0; + return 0; } krb5_error_code ktest_make_sample_authdata(ad) - krb5_authdata * ad; + krb5_authdata * ad; { - ad->ad_type = 1; - ad->length = 6; - ad->contents = (krb5_octet*)calloc(6,sizeof(krb5_octet)); - if(ad->contents == NULL) return ENOMEM; - memcpy(ad->contents,"foobar",6); - return 0; + ad->ad_type = 1; + ad->length = 6; + ad->contents = (krb5_octet*)calloc(6,sizeof(krb5_octet)); + if (ad->contents == NULL) return ENOMEM; + memcpy(ad->contents,"foobar",6); + return 0; } krb5_error_code ktest_make_sample_enc_kdc_rep_part(ekr) - krb5_enc_kdc_rep_part * ekr; -{ - krb5_error_code retval; - - ekr->session = (krb5_keyblock*)calloc(1,sizeof(krb5_keyblock)); - if(ekr->session == NULL) return ENOMEM; - retval = ktest_make_sample_keyblock(ekr->session); - if(retval) return retval; - retval = ktest_make_sample_last_req(&(ekr->last_req)); - if(retval) return retval; - ekr->nonce = SAMPLE_NONCE; - ekr->key_exp = SAMPLE_TIME; - ekr->flags = SAMPLE_FLAGS; - ekr->times.authtime = SAMPLE_TIME; - ekr->times.starttime = SAMPLE_TIME; - ekr->times.endtime = SAMPLE_TIME; - ekr->times.renew_till = SAMPLE_TIME; - retval = ktest_make_sample_principal(&(ekr->server)); - if(retval) return retval; - retval = ktest_make_sample_addresses(&(ekr->caddrs)); - if(retval) return retval; - - return 0; + krb5_enc_kdc_rep_part * ekr; +{ + krb5_error_code retval; + + ekr->session = (krb5_keyblock*)calloc(1,sizeof(krb5_keyblock)); + if (ekr->session == NULL) return ENOMEM; + retval = ktest_make_sample_keyblock(ekr->session); + if (retval) return retval; + retval = ktest_make_sample_last_req(&(ekr->last_req)); + if (retval) return retval; + ekr->nonce = SAMPLE_NONCE; + ekr->key_exp = SAMPLE_TIME; + ekr->flags = SAMPLE_FLAGS; + ekr->times.authtime = SAMPLE_TIME; + ekr->times.starttime = SAMPLE_TIME; + ekr->times.endtime = SAMPLE_TIME; + ekr->times.renew_till = SAMPLE_TIME; + retval = ktest_make_sample_principal(&(ekr->server)); + if (retval) return retval; + retval = ktest_make_sample_addresses(&(ekr->caddrs)); + if (retval) return retval; + + return 0; } krb5_error_code ktest_make_sample_last_req(lr) - krb5_last_req_entry *** lr; + krb5_last_req_entry *** lr; { - krb5_error_code retval; - int i; + krb5_error_code retval; + int i; - *lr = (krb5_last_req_entry**)calloc(3,sizeof(krb5_last_req_entry*)); - if(*lr == NULL) return ENOMEM; - for(i=0; i<=1; i++){ - retval = ktest_make_sample_last_req_entry(&((*lr)[i])); - if(retval) return retval; - } - (*lr)[2] = NULL; - return 0; + *lr = (krb5_last_req_entry**)calloc(3,sizeof(krb5_last_req_entry*)); + if (*lr == NULL) return ENOMEM; + for (i=0; i<=1; i++) { + retval = ktest_make_sample_last_req_entry(&((*lr)[i])); + if (retval) return retval; + } + (*lr)[2] = NULL; + return 0; } krb5_error_code ktest_make_sample_last_req_entry(lre) - krb5_last_req_entry ** lre; + krb5_last_req_entry ** lre; { - *lre = (krb5_last_req_entry*)calloc(1,sizeof(krb5_last_req_entry)); - if(*lre == NULL) return ENOMEM; - (*lre)->lr_type = -5; - (*lre)->value = SAMPLE_TIME; - return 0; + *lre = (krb5_last_req_entry*)calloc(1,sizeof(krb5_last_req_entry)); + if (*lre == NULL) return ENOMEM; + (*lre)->lr_type = -5; + (*lre)->value = SAMPLE_TIME; + return 0; } krb5_error_code ktest_make_sample_kdc_rep(kdcr) - krb5_kdc_rep * kdcr; -{ - krb5_error_code retval; - - retval = ktest_make_sample_pa_data_array(&(kdcr->padata)); - if(retval) return retval; - retval = ktest_make_sample_principal(&(kdcr->client)); - if(retval) return retval; - kdcr->ticket = (krb5_ticket*)calloc(1,sizeof(krb5_ticket)); - if(kdcr->ticket == NULL) return ENOMEM; - retval = ktest_make_sample_ticket(kdcr->ticket); - if(retval) return retval; - retval = ktest_make_sample_enc_data(&(kdcr->enc_part)); - if(retval) return retval; - kdcr->enc_part2 = NULL; + krb5_kdc_rep * kdcr; +{ + krb5_error_code retval; + + retval = ktest_make_sample_pa_data_array(&(kdcr->padata)); + if (retval) return retval; + retval = ktest_make_sample_principal(&(kdcr->client)); + if (retval) return retval; + kdcr->ticket = (krb5_ticket*)calloc(1,sizeof(krb5_ticket)); + if (kdcr->ticket == NULL) return ENOMEM; + retval = ktest_make_sample_ticket(kdcr->ticket); + if (retval) return retval; + retval = ktest_make_sample_enc_data(&(kdcr->enc_part)); + if (retval) return retval; + kdcr->enc_part2 = NULL; - return 0; + return 0; } krb5_error_code ktest_make_sample_pa_data_array(pad) - krb5_pa_data *** pad; + krb5_pa_data *** pad; { - krb5_error_code retval; - int i; + krb5_error_code retval; + int i; - *pad = (krb5_pa_data**)calloc(3,sizeof(krb5_pa_data*)); - if(*pad == NULL) return ENOMEM; + *pad = (krb5_pa_data**)calloc(3,sizeof(krb5_pa_data*)); + if (*pad == NULL) return ENOMEM; - for(i=0; i<=1; i++){ - (*pad)[i] = (krb5_pa_data*)calloc(1,sizeof(krb5_pa_data)); - if((*pad)[i] == NULL) return ENOMEM; - retval = ktest_make_sample_pa_data((*pad)[i]); - if(retval) return retval; - } - (*pad)[2] = NULL; + for (i=0; i<=1; i++) { + (*pad)[i] = (krb5_pa_data*)calloc(1,sizeof(krb5_pa_data)); + if ((*pad)[i] == NULL) return ENOMEM; + retval = ktest_make_sample_pa_data((*pad)[i]); + if (retval) return retval; + } + (*pad)[2] = NULL; - return 0; + return 0; } krb5_error_code ktest_make_sample_empty_pa_data_array(pad) - krb5_pa_data *** pad; + krb5_pa_data *** pad; { - *pad = (krb5_pa_data**)calloc(1,sizeof(krb5_pa_data*)); - if(*pad == NULL) return ENOMEM; + *pad = (krb5_pa_data**)calloc(1,sizeof(krb5_pa_data*)); + if (*pad == NULL) return ENOMEM; - (*pad)[0] = NULL; + (*pad)[0] = NULL; - return 0; + return 0; } krb5_error_code ktest_make_sample_pa_data(pad) - krb5_pa_data * pad; + krb5_pa_data * pad; { - pad->pa_type = 13; - pad->length = 7; - pad->contents = (krb5_octet*)calloc(7,sizeof(krb5_octet)); - if(pad->contents == NULL) return ENOMEM; - memcpy(pad->contents,"pa-data",7); - return 0; + pad->pa_type = 13; + pad->length = 7; + pad->contents = (krb5_octet*)calloc(7,sizeof(krb5_octet)); + if (pad->contents == NULL) return ENOMEM; + memcpy(pad->contents,"pa-data",7); + return 0; } krb5_error_code ktest_make_sample_ap_req(ar) - krb5_ap_req * ar; -{ - krb5_error_code retval; - ar->ap_options = SAMPLE_FLAGS; - ar->ticket = (krb5_ticket*)calloc(1,sizeof(krb5_ticket)); - if(ar->ticket == NULL) return ENOMEM; - retval = ktest_make_sample_ticket(ar->ticket); - if(retval) return retval; - retval = ktest_make_sample_enc_data(&(ar->authenticator)); - if(retval) return retval; - return 0; + krb5_ap_req * ar; +{ + krb5_error_code retval; + ar->ap_options = SAMPLE_FLAGS; + ar->ticket = (krb5_ticket*)calloc(1,sizeof(krb5_ticket)); + if (ar->ticket == NULL) return ENOMEM; + retval = ktest_make_sample_ticket(ar->ticket); + if (retval) return retval; + retval = ktest_make_sample_enc_data(&(ar->authenticator)); + if (retval) return retval; + return 0; } krb5_error_code ktest_make_sample_ap_rep(ar) - krb5_ap_rep * ar; + krb5_ap_rep * ar; { - return ktest_make_sample_enc_data(&(ar->enc_part)); + return ktest_make_sample_enc_data(&(ar->enc_part)); } krb5_error_code ktest_make_sample_ap_rep_enc_part(arep) - krb5_ap_rep_enc_part * arep; + krb5_ap_rep_enc_part * arep; { - krb5_error_code retval; + krb5_error_code retval; - arep->ctime = SAMPLE_TIME; - arep->cusec = SAMPLE_USEC; - arep->subkey = (krb5_keyblock*)calloc(1,sizeof(krb5_keyblock)); - if(arep->subkey == NULL) return ENOMEM; - retval = ktest_make_sample_keyblock(arep->subkey); - if(retval) return retval; - arep->seq_number = SAMPLE_SEQ_NUMBER; + arep->ctime = SAMPLE_TIME; + arep->cusec = SAMPLE_USEC; + arep->subkey = (krb5_keyblock*)calloc(1,sizeof(krb5_keyblock)); + if (arep->subkey == NULL) return ENOMEM; + retval = ktest_make_sample_keyblock(arep->subkey); + if (retval) return retval; + arep->seq_number = SAMPLE_SEQ_NUMBER; - return 0; + return 0; } krb5_error_code ktest_make_sample_kdc_req(kr) - krb5_kdc_req * kr; -{ - krb5_error_code retval; - - /* msg_type is left up to the calling procedure */ - retval = ktest_make_sample_pa_data_array(&(kr->padata)); - if(retval) return retval; - kr->kdc_options = SAMPLE_FLAGS; - retval = ktest_make_sample_principal(&(kr->client)); - if(retval) return retval; - retval = ktest_make_sample_principal(&(kr->server)); - if(retval) return retval; - kr->from = SAMPLE_TIME; - kr->till = SAMPLE_TIME; - kr->rtime = SAMPLE_TIME; - kr->nonce = SAMPLE_NONCE; - kr->nktypes = 2; - kr->ktype = (krb5_enctype*)calloc(2,sizeof(krb5_enctype)); - kr->ktype[0] = 0; - kr->ktype[1] = 1; - retval = ktest_make_sample_addresses(&(kr->addresses)); - if(retval) return retval; - retval = ktest_make_sample_enc_data(&(kr->authorization_data)); - if(retval) return retval; - retval = ktest_make_sample_authorization_data(&(kr->unenc_authdata)); - if(retval) return retval; - retval = ktest_make_sample_sequence_of_ticket(&(kr->second_ticket)); - if(retval) return retval; - return 0; + krb5_kdc_req * kr; +{ + krb5_error_code retval; + + /* msg_type is left up to the calling procedure */ + retval = ktest_make_sample_pa_data_array(&(kr->padata)); + if (retval) return retval; + kr->kdc_options = SAMPLE_FLAGS; + retval = ktest_make_sample_principal(&(kr->client)); + if (retval) return retval; + retval = ktest_make_sample_principal(&(kr->server)); + if (retval) return retval; + kr->from = SAMPLE_TIME; + kr->till = SAMPLE_TIME; + kr->rtime = SAMPLE_TIME; + kr->nonce = SAMPLE_NONCE; + kr->nktypes = 2; + kr->ktype = (krb5_enctype*)calloc(2,sizeof(krb5_enctype)); + kr->ktype[0] = 0; + kr->ktype[1] = 1; + retval = ktest_make_sample_addresses(&(kr->addresses)); + if (retval) return retval; + retval = ktest_make_sample_enc_data(&(kr->authorization_data)); + if (retval) return retval; + retval = ktest_make_sample_authorization_data(&(kr->unenc_authdata)); + if (retval) return retval; + retval = ktest_make_sample_sequence_of_ticket(&(kr->second_ticket)); + if (retval) return retval; + return 0; } krb5_error_code ktest_make_sample_kdc_req_body(krb) - krb5_kdc_req * krb; -{ - krb5_error_code retval; - - krb->kdc_options = SAMPLE_FLAGS; - retval = ktest_make_sample_principal(&(krb->client)); - if(retval) return retval; - retval = ktest_make_sample_principal(&(krb->server)); - if(retval) return retval; - krb->from = SAMPLE_TIME; - krb->till = SAMPLE_TIME; - krb->rtime = SAMPLE_TIME; - krb->nonce = SAMPLE_NONCE; - krb->nktypes = 2; - krb->ktype = (krb5_enctype*)calloc(2,sizeof(krb5_enctype)); - krb->ktype[0] = 0; - krb->ktype[1] = 1; - retval = ktest_make_sample_addresses(&(krb->addresses)); - if(retval) return retval; - retval = ktest_make_sample_enc_data(&(krb->authorization_data)); - if(retval) return retval; - retval = ktest_make_sample_authorization_data(&(krb->unenc_authdata)); - if(retval) return retval; - retval = ktest_make_sample_sequence_of_ticket(&(krb->second_ticket)); - if(retval) return retval; - return 0; + krb5_kdc_req * krb; +{ + krb5_error_code retval; + + krb->kdc_options = SAMPLE_FLAGS; + retval = ktest_make_sample_principal(&(krb->client)); + if (retval) return retval; + retval = ktest_make_sample_principal(&(krb->server)); + if (retval) return retval; + krb->from = SAMPLE_TIME; + krb->till = SAMPLE_TIME; + krb->rtime = SAMPLE_TIME; + krb->nonce = SAMPLE_NONCE; + krb->nktypes = 2; + krb->ktype = (krb5_enctype*)calloc(2,sizeof(krb5_enctype)); + krb->ktype[0] = 0; + krb->ktype[1] = 1; + retval = ktest_make_sample_addresses(&(krb->addresses)); + if (retval) return retval; + retval = ktest_make_sample_enc_data(&(krb->authorization_data)); + if (retval) return retval; + retval = ktest_make_sample_authorization_data(&(krb->unenc_authdata)); + if (retval) return retval; + retval = ktest_make_sample_sequence_of_ticket(&(krb->second_ticket)); + if (retval) return retval; + return 0; } krb5_error_code ktest_make_sample_safe(s) - krb5_safe * s; -{ - krb5_error_code retval; - - retval = ktest_make_sample_data(&(s->user_data)); - if(retval) return retval; - s->timestamp = SAMPLE_TIME; - s->usec = SAMPLE_USEC; - s->seq_number = SAMPLE_SEQ_NUMBER; - s->s_address = (krb5_address*)calloc(1,sizeof(krb5_address)); - if(s->s_address == NULL) return ENOMEM; - retval = ktest_make_sample_address(s->s_address); - if(retval) return retval; - s->r_address = (krb5_address*)calloc(1,sizeof(krb5_address)); - if(s->r_address == NULL) return ENOMEM; - retval = ktest_make_sample_address(s->r_address); - if(retval) return retval; - s->checksum = (krb5_checksum*)calloc(1,sizeof(krb5_checksum)); - if(s->checksum == NULL) return ENOMEM; - retval = ktest_make_sample_checksum(s->checksum); - if(retval) return retval; - - return 0; + krb5_safe * s; +{ + krb5_error_code retval; + + retval = ktest_make_sample_data(&(s->user_data)); + if (retval) return retval; + s->timestamp = SAMPLE_TIME; + s->usec = SAMPLE_USEC; + s->seq_number = SAMPLE_SEQ_NUMBER; + s->s_address = (krb5_address*)calloc(1,sizeof(krb5_address)); + if (s->s_address == NULL) return ENOMEM; + retval = ktest_make_sample_address(s->s_address); + if (retval) return retval; + s->r_address = (krb5_address*)calloc(1,sizeof(krb5_address)); + if (s->r_address == NULL) return ENOMEM; + retval = ktest_make_sample_address(s->r_address); + if (retval) return retval; + s->checksum = (krb5_checksum*)calloc(1,sizeof(krb5_checksum)); + if (s->checksum == NULL) return ENOMEM; + retval = ktest_make_sample_checksum(s->checksum); + if (retval) return retval; + + return 0; } krb5_error_code ktest_make_sample_priv(p) - krb5_priv * p; + krb5_priv * p; { - return ktest_make_sample_enc_data(&(p->enc_part)); + return ktest_make_sample_enc_data(&(p->enc_part)); } krb5_error_code ktest_make_sample_priv_enc_part(pep) - krb5_priv_enc_part * pep; -{ - krb5_error_code retval; - retval = ktest_make_sample_data(&(pep->user_data)); - if(retval) return retval; - pep->timestamp = SAMPLE_TIME; - pep->usec = SAMPLE_USEC; - pep->seq_number = SAMPLE_SEQ_NUMBER; - pep->s_address = (krb5_address*)calloc(1,sizeof(krb5_address)); - if(pep->s_address == NULL) return ENOMEM; - retval = ktest_make_sample_address(pep->s_address); - if(retval) return retval; - pep->r_address = (krb5_address*)calloc(1,sizeof(krb5_address)); - if(pep->r_address == NULL) return ENOMEM; - retval = ktest_make_sample_address(pep->r_address); - if(retval) return retval; - return 0; + krb5_priv_enc_part * pep; +{ + krb5_error_code retval; + retval = ktest_make_sample_data(&(pep->user_data)); + if (retval) return retval; + pep->timestamp = SAMPLE_TIME; + pep->usec = SAMPLE_USEC; + pep->seq_number = SAMPLE_SEQ_NUMBER; + pep->s_address = (krb5_address*)calloc(1,sizeof(krb5_address)); + if (pep->s_address == NULL) return ENOMEM; + retval = ktest_make_sample_address(pep->s_address); + if (retval) return retval; + pep->r_address = (krb5_address*)calloc(1,sizeof(krb5_address)); + if (pep->r_address == NULL) return ENOMEM; + retval = ktest_make_sample_address(pep->r_address); + if (retval) return retval; + return 0; } krb5_error_code ktest_make_sample_cred(c) - krb5_cred * c; + krb5_cred * c; { - krb5_error_code retval; - retval = ktest_make_sample_sequence_of_ticket(&(c->tickets)); - if(retval) return retval; - retval = ktest_make_sample_enc_data(&(c->enc_part)); - if(retval) return retval; - return 0; + krb5_error_code retval; + retval = ktest_make_sample_sequence_of_ticket(&(c->tickets)); + if (retval) return retval; + retval = ktest_make_sample_enc_data(&(c->enc_part)); + if (retval) return retval; + return 0; } krb5_error_code ktest_make_sample_sequence_of_ticket(sot) - krb5_ticket *** sot; -{ - krb5_error_code retval; - int i; - - *sot = (krb5_ticket**)calloc(3,sizeof(krb5_ticket*)); - if(*sot == NULL) return ENOMEM; - for(i=0; i<2; i++){ - (*sot)[i] = (krb5_ticket*)calloc(1,sizeof(krb5_ticket)); - if((*sot)[i] == NULL) return ENOMEM; - retval = ktest_make_sample_ticket((*sot)[i]); - if(retval) return retval; - } - (*sot)[2] = NULL; + krb5_ticket *** sot; +{ + krb5_error_code retval; + int i; + + *sot = (krb5_ticket**)calloc(3,sizeof(krb5_ticket*)); + if (*sot == NULL) return ENOMEM; + for (i=0; i<2; i++) { + (*sot)[i] = (krb5_ticket*)calloc(1,sizeof(krb5_ticket)); + if ((*sot)[i] == NULL) return ENOMEM; + retval = ktest_make_sample_ticket((*sot)[i]); + if (retval) return retval; + } + (*sot)[2] = NULL; - return 0; + return 0; } krb5_error_code ktest_make_sample_cred_enc_part(cep) - krb5_cred_enc_part * cep; -{ - krb5_error_code retval; - - cep->nonce = SAMPLE_NONCE; - cep->timestamp = SAMPLE_TIME; - cep->usec = SAMPLE_USEC; - cep->s_address = (krb5_address*)calloc(1,sizeof(krb5_address)); - if(cep->s_address == NULL) return ENOMEM; - retval = ktest_make_sample_address(cep->s_address); - if(retval) return retval; - cep->r_address = (krb5_address*)calloc(1,sizeof(krb5_address)); - if(cep->r_address == NULL) return ENOMEM; - retval = ktest_make_sample_address(cep->r_address); - if(retval) return retval; - retval = ktest_make_sequence_of_cred_info(&(cep->ticket_info)); - if(retval) return retval; + krb5_cred_enc_part * cep; +{ + krb5_error_code retval; + + cep->nonce = SAMPLE_NONCE; + cep->timestamp = SAMPLE_TIME; + cep->usec = SAMPLE_USEC; + cep->s_address = (krb5_address*)calloc(1,sizeof(krb5_address)); + if (cep->s_address == NULL) return ENOMEM; + retval = ktest_make_sample_address(cep->s_address); + if (retval) return retval; + cep->r_address = (krb5_address*)calloc(1,sizeof(krb5_address)); + if (cep->r_address == NULL) return ENOMEM; + retval = ktest_make_sample_address(cep->r_address); + if (retval) return retval; + retval = ktest_make_sequence_of_cred_info(&(cep->ticket_info)); + if (retval) return retval; - return 0; + return 0; } krb5_error_code ktest_make_sequence_of_cred_info(soci) - krb5_cred_info *** soci; -{ - krb5_error_code retval; - int i; - - *soci = (krb5_cred_info**)calloc(3,sizeof(krb5_cred_info*)); - if(*soci == NULL) return ENOMEM; - for(i=0; i<2; i++){ - (*soci)[i] = (krb5_cred_info*)calloc(1,sizeof(krb5_cred_info)); - if((*soci)[i] == NULL) return ENOMEM; - retval = ktest_make_sample_cred_info((*soci)[i]); - if(retval) return retval; - } - (*soci)[2] = NULL; + krb5_cred_info *** soci; +{ + krb5_error_code retval; + int i; + + *soci = (krb5_cred_info**)calloc(3,sizeof(krb5_cred_info*)); + if (*soci == NULL) return ENOMEM; + for (i=0; i<2; i++) { + (*soci)[i] = (krb5_cred_info*)calloc(1,sizeof(krb5_cred_info)); + if ((*soci)[i] == NULL) return ENOMEM; + retval = ktest_make_sample_cred_info((*soci)[i]); + if (retval) return retval; + } + (*soci)[2] = NULL; - return 0; + return 0; } krb5_error_code ktest_make_sample_cred_info(ci) - krb5_cred_info * ci; -{ - krb5_error_code retval; + krb5_cred_info * ci; +{ + krb5_error_code retval; + + ci->session = (krb5_keyblock*)calloc(1,sizeof(krb5_keyblock)); + if (ci->session == NULL) return ENOMEM; + retval = ktest_make_sample_keyblock(ci->session); + if (retval) return retval; + retval = ktest_make_sample_principal(&(ci->client)); + if (retval) return retval; + retval = ktest_make_sample_principal(&(ci->server)); + if (retval) return retval; + ci->flags = SAMPLE_FLAGS; + ci->times.authtime = SAMPLE_TIME; + ci->times.starttime = SAMPLE_TIME; + ci->times.endtime = SAMPLE_TIME; + ci->times.renew_till = SAMPLE_TIME; + retval = ktest_make_sample_addresses(&(ci->caddrs)); + if (retval) return retval; - ci->session = (krb5_keyblock*)calloc(1,sizeof(krb5_keyblock)); - if(ci->session == NULL) return ENOMEM; - retval = ktest_make_sample_keyblock(ci->session); - if(retval) return retval; - retval = ktest_make_sample_principal(&(ci->client)); - if(retval) return retval; - retval = ktest_make_sample_principal(&(ci->server)); - if(retval) return retval; - ci->flags = SAMPLE_FLAGS; - ci->times.authtime = SAMPLE_TIME; - ci->times.starttime = SAMPLE_TIME; - ci->times.endtime = SAMPLE_TIME; - ci->times.renew_till = SAMPLE_TIME; - retval = ktest_make_sample_addresses(&(ci->caddrs)); - if(retval) return retval; - - return 0; + return 0; } krb5_error_code ktest_make_sample_error(kerr) - krb5_error * kerr; -{ - krb5_error_code retval; + krb5_error * kerr; +{ + krb5_error_code retval; + + kerr->ctime = SAMPLE_TIME; + kerr->cusec = SAMPLE_USEC; + kerr->susec = SAMPLE_USEC; + kerr->stime = SAMPLE_TIME; + kerr->error = SAMPLE_ERROR; + retval = ktest_make_sample_principal(&(kerr->client)); + if (retval) return retval; + retval = ktest_make_sample_principal(&(kerr->server)); + if (retval) return retval; + retval = ktest_make_sample_data(&(kerr->text)); + if (retval) return retval; + retval = ktest_make_sample_data(&(kerr->e_data)); + if (retval) return retval; - kerr->ctime = SAMPLE_TIME; - kerr->cusec = SAMPLE_USEC; - kerr->susec = SAMPLE_USEC; - kerr->stime = SAMPLE_TIME; - kerr->error = SAMPLE_ERROR; - retval = ktest_make_sample_principal(&(kerr->client)); - if(retval) return retval; - retval = ktest_make_sample_principal(&(kerr->server)); - if(retval) return retval; - retval = ktest_make_sample_data(&(kerr->text)); - if(retval) return retval; - retval = ktest_make_sample_data(&(kerr->e_data)); - if(retval) return retval; - - return 0; + return 0; } krb5_error_code ktest_make_sample_data(d) - krb5_data * d; + krb5_data * d; { - d->data = (char*)calloc(8,sizeof(char)); - if(d->data == NULL) return ENOMEM; - d->length = 8; - memcpy(d->data,"krb5data",8); + d->data = (char*)calloc(8,sizeof(char)); + if (d->data == NULL) return ENOMEM; + d->length = 8; + memcpy(d->data,"krb5data",8); - return 0; + return 0; } krb5_error_code ktest_make_sample_passwd_phrase_element(ppe) - passwd_phrase_element * ppe; -{ - krb5_error_code retval; - - ppe->passwd = (krb5_data*)calloc(1,sizeof(krb5_data)); - if(ppe->passwd == NULL) return ENOMEM; - retval = ktest_make_sample_data(ppe->passwd); - if(retval) return retval; - ppe->phrase = (krb5_data*)calloc(1,sizeof(krb5_data)); - if(ppe->phrase == NULL) return ENOMEM; - retval = ktest_make_sample_data(ppe->phrase); - if(retval) return retval; - return 0; + passwd_phrase_element * ppe; +{ + krb5_error_code retval; + + ppe->passwd = (krb5_data*)calloc(1,sizeof(krb5_data)); + if (ppe->passwd == NULL) return ENOMEM; + retval = ktest_make_sample_data(ppe->passwd); + if (retval) return retval; + ppe->phrase = (krb5_data*)calloc(1,sizeof(krb5_data)); + if (ppe->phrase == NULL) return ENOMEM; + retval = ktest_make_sample_data(ppe->phrase); + if (retval) return retval; + return 0; } krb5_error_code ktest_make_sample_krb5_pwd_data(pd) - krb5_pwd_data * pd; + krb5_pwd_data * pd; { - krb5_error_code retval; - int i; + krb5_error_code retval; + int i; - pd->sequence_count = 2; + pd->sequence_count = 2; - pd->element = (passwd_phrase_element**)calloc(3,sizeof(passwd_phrase_element*)); - if(pd->element == NULL) return ENOMEM; + pd->element = (passwd_phrase_element**)calloc(3,sizeof(passwd_phrase_element*)); + if (pd->element == NULL) return ENOMEM; - for(i=0; i<=1; i++){ - pd->element[i] = (passwd_phrase_element*)calloc(1,sizeof(passwd_phrase_element)); - if(pd->element[i] == NULL) return ENOMEM; - retval = ktest_make_sample_passwd_phrase_element(pd->element[i]); - if(retval) return retval; - } - pd->element[2] = NULL; + for (i=0; i<=1; i++) { + pd->element[i] = (passwd_phrase_element*)calloc(1,sizeof(passwd_phrase_element)); + if (pd->element[i] == NULL) return ENOMEM; + retval = ktest_make_sample_passwd_phrase_element(pd->element[i]); + if (retval) return retval; + } + pd->element[2] = NULL; - return 0; + return 0; } krb5_error_code ktest_make_sample_alt_method(p) - krb5_alt_method * p; + krb5_alt_method * p; { p->method = 42; p->data = (krb5_octet *) strdup("secret"); - if(p->data == NULL) return ENOMEM; + if (p->data == NULL) return ENOMEM; p->length = strlen((char *) p->data); return 0; } krb5_error_code ktest_make_sample_etype_info(p) - krb5_etype_info_entry *** p; + krb5_etype_info_entry *** p; { krb5_etype_info_entry **info; int i; @@ -672,7 +672,7 @@ memfail: krb5_error_code ktest_make_sample_etype_info2(p) - krb5_etype_info_entry *** p; + krb5_etype_info_entry *** p; { krb5_etype_info_entry **info; int i; @@ -714,69 +714,69 @@ memfail: krb5_error_code ktest_make_sample_pa_enc_ts(pa_enc) - krb5_pa_enc_ts * pa_enc; + krb5_pa_enc_ts * pa_enc; { - pa_enc->patimestamp = SAMPLE_TIME; - pa_enc->pausec = SAMPLE_USEC; + pa_enc->patimestamp = SAMPLE_TIME; + pa_enc->pausec = SAMPLE_USEC; - return 0; + return 0; } krb5_error_code ktest_make_sample_sam_challenge(p) - krb5_sam_challenge * p; -{ - krb5_error_code retval; - - p->magic = KV5M_SAM_CHALLENGE; - p->sam_type = 42; /* information */ - p->sam_flags = KRB5_SAM_USE_SAD_AS_KEY; /* KRB5_SAM_* values */ - p->sam_type_name.data = strdup("type name"); - if (p->sam_type_name.data == NULL) return ENOMEM; - p->sam_type_name.length = strlen(p->sam_type_name.data); - p->sam_track_id.data = 0; - p->sam_track_id.length = 0; - p->sam_challenge_label.data = strdup("challenge label"); - if (p->sam_challenge_label.data == NULL) return ENOMEM; - p->sam_challenge_label.length = strlen(p->sam_challenge_label.data); - p->sam_challenge.data = strdup("challenge ipse"); - if (p->sam_challenge.data == NULL) return ENOMEM; - p->sam_challenge.length = strlen(p->sam_challenge.data); - p->sam_response_prompt.data = strdup("response_prompt ipse"); - if (p->sam_response_prompt.data == NULL) return ENOMEM; - p->sam_response_prompt.length = strlen(p->sam_response_prompt.data); - p->sam_pk_for_sad.data = 0; - p->sam_pk_for_sad.length = 0; - p->sam_nonce = 0x543210; - retval = ktest_make_sample_checksum(&p->sam_cksum); - if(retval) return retval; - - return 0; + krb5_sam_challenge * p; +{ + krb5_error_code retval; + + p->magic = KV5M_SAM_CHALLENGE; + p->sam_type = 42; /* information */ + p->sam_flags = KRB5_SAM_USE_SAD_AS_KEY; /* KRB5_SAM_* values */ + p->sam_type_name.data = strdup("type name"); + if (p->sam_type_name.data == NULL) return ENOMEM; + p->sam_type_name.length = strlen(p->sam_type_name.data); + p->sam_track_id.data = 0; + p->sam_track_id.length = 0; + p->sam_challenge_label.data = strdup("challenge label"); + if (p->sam_challenge_label.data == NULL) return ENOMEM; + p->sam_challenge_label.length = strlen(p->sam_challenge_label.data); + p->sam_challenge.data = strdup("challenge ipse"); + if (p->sam_challenge.data == NULL) return ENOMEM; + p->sam_challenge.length = strlen(p->sam_challenge.data); + p->sam_response_prompt.data = strdup("response_prompt ipse"); + if (p->sam_response_prompt.data == NULL) return ENOMEM; + p->sam_response_prompt.length = strlen(p->sam_response_prompt.data); + p->sam_pk_for_sad.data = 0; + p->sam_pk_for_sad.length = 0; + p->sam_nonce = 0x543210; + retval = ktest_make_sample_checksum(&p->sam_cksum); + if (retval) return retval; + + return 0; } krb5_error_code ktest_make_sample_sam_response(p) - krb5_sam_response * p; -{ - p->magic = KV5M_SAM_RESPONSE; - p->sam_type = 42; /* information */ - p->sam_flags = KRB5_SAM_USE_SAD_AS_KEY; /* KRB5_SAM_* values */ - p->sam_track_id.data = strdup("track data"); - if (p->sam_track_id.data == NULL) return ENOMEM; - p->sam_track_id.length = strlen(p->sam_track_id.data); - p->sam_enc_key.ciphertext.data = strdup("key"); - if (p->sam_enc_key.ciphertext.data == NULL) return ENOMEM; - p->sam_enc_key.ciphertext.length = strlen(p->sam_enc_key.ciphertext.data); - p->sam_enc_key.enctype = ENCTYPE_DES_CBC_CRC; - p->sam_enc_key.kvno = 1942; - p->sam_enc_nonce_or_ts.ciphertext.data = strdup("nonce or ts"); - if (p->sam_enc_nonce_or_ts.ciphertext.data == NULL) return ENOMEM; - p->sam_enc_nonce_or_ts.ciphertext.length = - strlen(p->sam_enc_nonce_or_ts.ciphertext.data); - p->sam_enc_nonce_or_ts.enctype = ENCTYPE_DES_CBC_CRC; - p->sam_enc_nonce_or_ts.kvno = 3382; - p->sam_nonce = 0x543210; - p->sam_patimestamp = SAMPLE_TIME; + krb5_sam_response * p; +{ + p->magic = KV5M_SAM_RESPONSE; + p->sam_type = 42; /* information */ + p->sam_flags = KRB5_SAM_USE_SAD_AS_KEY; /* KRB5_SAM_* values */ + p->sam_track_id.data = strdup("track data"); + if (p->sam_track_id.data == NULL) return ENOMEM; + p->sam_track_id.length = strlen(p->sam_track_id.data); + p->sam_enc_key.ciphertext.data = strdup("key"); + if (p->sam_enc_key.ciphertext.data == NULL) return ENOMEM; + p->sam_enc_key.ciphertext.length = strlen(p->sam_enc_key.ciphertext.data); + p->sam_enc_key.enctype = ENCTYPE_DES_CBC_CRC; + p->sam_enc_key.kvno = 1942; + p->sam_enc_nonce_or_ts.ciphertext.data = strdup("nonce or ts"); + if (p->sam_enc_nonce_or_ts.ciphertext.data == NULL) return ENOMEM; + p->sam_enc_nonce_or_ts.ciphertext.length = + strlen(p->sam_enc_nonce_or_ts.ciphertext.data); + p->sam_enc_nonce_or_ts.enctype = ENCTYPE_DES_CBC_CRC; + p->sam_enc_nonce_or_ts.kvno = 3382; + p->sam_nonce = 0x543210; + p->sam_patimestamp = SAMPLE_TIME; - return 0; + return 0; } @@ -787,206 +787,206 @@ krb5_error_code ktest_make_sample_sam_response(p) /* destructors */ void ktest_destroy_data(d) - krb5_data ** d; + krb5_data ** d; { - if(*d != NULL){ - if((*d)->data != NULL) free((*d)->data); - free(*d); - *d = NULL; - } + if (*d != NULL) { + if ((*d)->data != NULL) free((*d)->data); + free(*d); + *d = NULL; + } } void ktest_empty_data(d) - krb5_data * d; + krb5_data * d; { - if(d->data != NULL){ - free(d->data); - d->data = NULL; - d->length = 0; - } + if (d->data != NULL) { + free(d->data); + d->data = NULL; + d->length = 0; + } } void ktest_destroy_checksum(cs) - krb5_checksum ** cs; + krb5_checksum ** cs; { - if(*cs != NULL){ - if((*cs)->contents != NULL) free((*cs)->contents); - free(*cs); - *cs = NULL; - } + if (*cs != NULL) { + if ((*cs)->contents != NULL) free((*cs)->contents); + free(*cs); + *cs = NULL; + } } void ktest_empty_keyblock(kb) - krb5_keyblock * kb; + krb5_keyblock * kb; { - if (kb != NULL) { - if (kb->contents) { - free (kb->contents); - kb->contents = NULL; + if (kb != NULL) { + if (kb->contents) { + free (kb->contents); + kb->contents = NULL; + } } - } } void ktest_destroy_keyblock(kb) - krb5_keyblock ** kb; + krb5_keyblock ** kb; { - if(*kb != NULL){ - if((*kb)->contents != NULL) free((*kb)->contents); - free(*kb); - *kb = NULL; - } + if (*kb != NULL) { + if ((*kb)->contents != NULL) free((*kb)->contents); + free(*kb); + *kb = NULL; + } } void ktest_empty_authorization_data(ad) - krb5_authdata ** ad; + krb5_authdata ** ad; { - int i; + int i; - if(*ad != NULL) { - for(i=0; ad[i] != NULL; i++) - ktest_destroy_authdata(&(ad[i])); - } + if (*ad != NULL) { + for (i=0; ad[i] != NULL; i++) + ktest_destroy_authdata(&(ad[i])); + } } void ktest_destroy_authorization_data(ad) - krb5_authdata *** ad; + krb5_authdata *** ad; { - ktest_empty_authorization_data(*ad); - free(*ad); - *ad = NULL; + ktest_empty_authorization_data(*ad); + free(*ad); + *ad = NULL; } void ktest_destroy_authdata(ad) - krb5_authdata ** ad; + krb5_authdata ** ad; { - if(*ad != NULL){ - if((*ad)->contents != NULL) free((*ad)->contents); - free(*ad); - *ad = NULL; - } + if (*ad != NULL) { + if ((*ad)->contents != NULL) free((*ad)->contents); + free(*ad); + *ad = NULL; + } } void ktest_empty_pa_data_array(pad) - krb5_pa_data ** pad; + krb5_pa_data ** pad; { - int i; + int i; - for(i=0; pad[i] != NULL; i++) - ktest_destroy_pa_data(&(pad[i])); + for (i=0; pad[i] != NULL; i++) + ktest_destroy_pa_data(&(pad[i])); } void ktest_destroy_pa_data_array(pad) - krb5_pa_data *** pad; + krb5_pa_data *** pad; { - ktest_empty_pa_data_array(*pad); - free(*pad); - *pad = NULL; + ktest_empty_pa_data_array(*pad); + free(*pad); + *pad = NULL; } void ktest_destroy_pa_data(pad) - krb5_pa_data ** pad; + krb5_pa_data ** pad; { - if(*pad != NULL){ - if((*pad)->contents != NULL) free((*pad)->contents); - free(*pad); - *pad = NULL; - } + if (*pad != NULL) { + if ((*pad)->contents != NULL) free((*pad)->contents); + free(*pad); + *pad = NULL; + } } void ktest_destroy_address(a) - krb5_address ** a; + krb5_address ** a; { - if(*a != NULL){ - if((*a)->contents != NULL) free((*a)->contents); - free(*a); - *a = NULL; - } + if (*a != NULL) { + if ((*a)->contents != NULL) free((*a)->contents); + free(*a); + *a = NULL; + } } void ktest_empty_addresses(a) - krb5_address ** a; + krb5_address ** a; { - int i; + int i; - for(i=0; a[i] != NULL; i++) - ktest_destroy_address(&(a[i])); + for (i=0; a[i] != NULL; i++) + ktest_destroy_address(&(a[i])); } void ktest_destroy_addresses(a) - krb5_address *** a; + krb5_address *** a; { - ktest_empty_addresses(*a); - free(*a); - *a = NULL; + ktest_empty_addresses(*a); + free(*a); + *a = NULL; } void ktest_destroy_principal(p) - krb5_principal * p; + krb5_principal * p; { - int i; + int i; - for(i=0; i<(*p)->length; i++) - ktest_empty_data(&(((*p)->data)[i])); - ktest_empty_data(&((*p)->realm)); - free((*p)->data); - free(*p); - *p = NULL; + for (i=0; i<(*p)->length; i++) + ktest_empty_data(&(((*p)->data)[i])); + ktest_empty_data(&((*p)->realm)); + free((*p)->data); + free(*p); + *p = NULL; } void ktest_destroy_sequence_of_integer(soi) - long ** soi; + long ** soi; { - free(*soi); - *soi = NULL; + free(*soi); + *soi = NULL; } #if 0 void ktest_destroy_sequence_of_enctype(soi) - krb5_enctype ** soi; + krb5_enctype ** soi; { - free(*soi); - *soi = NULL; + free(*soi); + *soi = NULL; } #endif void ktest_destroy_sequence_of_ticket(sot) - krb5_ticket *** sot; + krb5_ticket *** sot; { - int i; + int i; - for(i=0; (*sot)[i] != NULL; i++) - ktest_destroy_ticket(&((*sot)[i])); - free(*sot); - *sot = NULL; + for (i=0; (*sot)[i] != NULL; i++) + ktest_destroy_ticket(&((*sot)[i])); + free(*sot); + *sot = NULL; } void ktest_destroy_ticket(tkt) - krb5_ticket ** tkt; + krb5_ticket ** tkt; { - ktest_destroy_principal(&((*tkt)->server)); - ktest_destroy_enc_data(&((*tkt)->enc_part)); - /* ktest_empty_enc_tkt_part(((*tkt)->enc_part2));*/ - free(*tkt); - *tkt = NULL; + ktest_destroy_principal(&((*tkt)->server)); + ktest_destroy_enc_data(&((*tkt)->enc_part)); + /* ktest_empty_enc_tkt_part(((*tkt)->enc_part2));*/ + free(*tkt); + *tkt = NULL; } void ktest_empty_ticket(tkt) - krb5_ticket * tkt; -{ - if(tkt->server) - ktest_destroy_principal(&((tkt)->server)); - ktest_destroy_enc_data(&((tkt)->enc_part)); - if (tkt->enc_part2) { - ktest_destroy_enc_tkt_part(&(tkt->enc_part2)); - } + krb5_ticket * tkt; +{ + if (tkt->server) + ktest_destroy_principal(&((tkt)->server)); + ktest_destroy_enc_data(&((tkt)->enc_part)); + if (tkt->enc_part2) { + ktest_destroy_enc_tkt_part(&(tkt->enc_part2)); + } } void ktest_destroy_enc_data(ed) - krb5_enc_data * ed; + krb5_enc_data * ed; { - ktest_empty_data(&(ed->ciphertext)); - ed->kvno = 0; + ktest_empty_data(&(ed->ciphertext)); + ed->kvno = 0; } void ktest_destroy_etype_info_entry(i) @@ -1001,291 +1001,291 @@ void ktest_destroy_etype_info_entry(i) void ktest_destroy_etype_info(info) krb5_etype_info_entry **info; { - int i; + int i; - for(i=0; info[i] != NULL; i++) - ktest_destroy_etype_info_entry(info[i]); - free(info); + for (i=0; info[i] != NULL; i++) + ktest_destroy_etype_info_entry(info[i]); + free(info); } void ktest_empty_kdc_req(kr) - krb5_kdc_req *kr; + krb5_kdc_req *kr; { - if (kr->padata) - ktest_destroy_pa_data_array(&(kr->padata)); + if (kr->padata) + ktest_destroy_pa_data_array(&(kr->padata)); - if (kr->client) - ktest_destroy_principal(&(kr->client)); + if (kr->client) + ktest_destroy_principal(&(kr->client)); - if (kr->server) - ktest_destroy_principal(&(kr->server)); - if (kr->ktype) - free(kr->ktype); - if (kr->addresses) - ktest_destroy_addresses(&(kr->addresses)); - ktest_destroy_enc_data(&(kr->authorization_data)); - if (kr->unenc_authdata) - ktest_destroy_authorization_data(&(kr->unenc_authdata)); - if (kr->second_ticket) - ktest_destroy_sequence_of_ticket(&(kr->second_ticket)); + if (kr->server) + ktest_destroy_principal(&(kr->server)); + if (kr->ktype) + free(kr->ktype); + if (kr->addresses) + ktest_destroy_addresses(&(kr->addresses)); + ktest_destroy_enc_data(&(kr->authorization_data)); + if (kr->unenc_authdata) + ktest_destroy_authorization_data(&(kr->unenc_authdata)); + if (kr->second_ticket) + ktest_destroy_sequence_of_ticket(&(kr->second_ticket)); } void ktest_empty_kdc_rep(kr) - krb5_kdc_rep *kr; + krb5_kdc_rep *kr; { - if (kr->padata) - ktest_destroy_pa_data_array(&(kr->padata)); + if (kr->padata) + ktest_destroy_pa_data_array(&(kr->padata)); - if (kr->client) - ktest_destroy_principal(&(kr->client)); + if (kr->client) + ktest_destroy_principal(&(kr->client)); - if (kr->ticket) - ktest_destroy_ticket(&(kr->ticket)); + if (kr->ticket) + ktest_destroy_ticket(&(kr->ticket)); - ktest_destroy_enc_data(&kr->enc_part); + ktest_destroy_enc_data(&kr->enc_part); - if (kr->enc_part2) { - ktest_empty_enc_kdc_rep_part(kr->enc_part2); - free(kr->enc_part2); - kr->enc_part2 = NULL; - } + if (kr->enc_part2) { + ktest_empty_enc_kdc_rep_part(kr->enc_part2); + free(kr->enc_part2); + kr->enc_part2 = NULL; + } } void ktest_empty_authenticator(a) - krb5_authenticator * a; + krb5_authenticator * a; { - if(a->client) - ktest_destroy_principal(&(a->client)); - if(a->checksum) - ktest_destroy_checksum(&(a->checksum)); - if(a->subkey) - ktest_destroy_keyblock(&(a->subkey)); - if(a->authorization_data) - ktest_destroy_authorization_data(&(a->authorization_data)); + if (a->client) + ktest_destroy_principal(&(a->client)); + if (a->checksum) + ktest_destroy_checksum(&(a->checksum)); + if (a->subkey) + ktest_destroy_keyblock(&(a->subkey)); + if (a->authorization_data) + ktest_destroy_authorization_data(&(a->authorization_data)); } void ktest_empty_enc_tkt_part(etp) - krb5_enc_tkt_part * etp; + krb5_enc_tkt_part * etp; { - if(etp->session) - ktest_destroy_keyblock(&(etp->session)); - if(etp->client) - ktest_destroy_principal(&(etp->client)); - if (etp->caddrs) - ktest_destroy_addresses(&(etp->caddrs)); - if(etp->authorization_data) - ktest_destroy_authorization_data(&(etp->authorization_data)); - ktest_destroy_transited(&(etp->transited)); + if (etp->session) + ktest_destroy_keyblock(&(etp->session)); + if (etp->client) + ktest_destroy_principal(&(etp->client)); + if (etp->caddrs) + ktest_destroy_addresses(&(etp->caddrs)); + if (etp->authorization_data) + ktest_destroy_authorization_data(&(etp->authorization_data)); + ktest_destroy_transited(&(etp->transited)); } void ktest_destroy_enc_tkt_part(etp) - krb5_enc_tkt_part ** etp; + krb5_enc_tkt_part ** etp; { - if(*etp) { - ktest_empty_enc_tkt_part(*etp); - free(*etp); - *etp = NULL; - } + if (*etp) { + ktest_empty_enc_tkt_part(*etp); + free(*etp); + *etp = NULL; + } } void ktest_empty_enc_kdc_rep_part(ekr) - krb5_enc_kdc_rep_part * ekr; + krb5_enc_kdc_rep_part * ekr; { - if(ekr->session) - ktest_destroy_keyblock(&(ekr->session)); + if (ekr->session) + ktest_destroy_keyblock(&(ekr->session)); - if(ekr->server) - ktest_destroy_principal(&(ekr->server)); + if (ekr->server) + ktest_destroy_principal(&(ekr->server)); - if (ekr->caddrs) - ktest_destroy_addresses(&(ekr->caddrs)); - ktest_destroy_last_req(&(ekr->last_req)); + if (ekr->caddrs) + ktest_destroy_addresses(&(ekr->caddrs)); + ktest_destroy_last_req(&(ekr->last_req)); } void ktest_destroy_transited(t) - krb5_transited * t; + krb5_transited * t; { - if(t->tr_contents.data) - ktest_empty_data(&(t->tr_contents)); + if (t->tr_contents.data) + ktest_empty_data(&(t->tr_contents)); } void ktest_empty_ap_rep(ar) - krb5_ap_rep * ar; + krb5_ap_rep * ar; { - ktest_destroy_enc_data(&ar->enc_part); + ktest_destroy_enc_data(&ar->enc_part); } void ktest_empty_ap_req(ar) - krb5_ap_req * ar; + krb5_ap_req * ar; { - if(ar->ticket) - ktest_destroy_ticket(&(ar->ticket)); - ktest_destroy_enc_data(&(ar->authenticator)); + if (ar->ticket) + ktest_destroy_ticket(&(ar->ticket)); + ktest_destroy_enc_data(&(ar->authenticator)); } void ktest_empty_cred_enc_part(cep) - krb5_cred_enc_part * cep; + krb5_cred_enc_part * cep; { - if (cep->s_address) - ktest_destroy_address(&(cep->s_address)); - if (cep->r_address) - ktest_destroy_address(&(cep->r_address)); - if (cep->ticket_info) - ktest_destroy_sequence_of_cred_info(&(cep->ticket_info)); + if (cep->s_address) + ktest_destroy_address(&(cep->s_address)); + if (cep->r_address) + ktest_destroy_address(&(cep->r_address)); + if (cep->ticket_info) + ktest_destroy_sequence_of_cred_info(&(cep->ticket_info)); } void ktest_destroy_cred_info(ci) - krb5_cred_info ** ci; + krb5_cred_info ** ci; { - if((*ci)->session) - ktest_destroy_keyblock(&((*ci)->session)); - if((*ci)->client) - ktest_destroy_principal(&((*ci)->client)); - if((*ci)->server) - ktest_destroy_principal(&((*ci)->server)); - if ((*ci)->caddrs) - ktest_destroy_addresses(&((*ci)->caddrs)); - free(*ci); - *ci = NULL; + if ((*ci)->session) + ktest_destroy_keyblock(&((*ci)->session)); + if ((*ci)->client) + ktest_destroy_principal(&((*ci)->client)); + if ((*ci)->server) + ktest_destroy_principal(&((*ci)->server)); + if ((*ci)->caddrs) + ktest_destroy_addresses(&((*ci)->caddrs)); + free(*ci); + *ci = NULL; } void ktest_destroy_sequence_of_cred_info(soci) - krb5_cred_info *** soci; + krb5_cred_info *** soci; { - int i; + int i; - for(i=0; (*soci)[i] != NULL; i++) - ktest_destroy_cred_info(&((*soci)[i])); - free(*soci); - *soci = NULL; + for (i=0; (*soci)[i] != NULL; i++) + ktest_destroy_cred_info(&((*soci)[i])); + free(*soci); + *soci = NULL; } void ktest_empty_safe(s) - krb5_safe * s; + krb5_safe * s; { - ktest_empty_data(&(s->user_data)); - ktest_destroy_address(&(s->s_address)); - ktest_destroy_address(&(s->r_address)); - ktest_destroy_checksum(&(s->checksum)); + ktest_empty_data(&(s->user_data)); + ktest_destroy_address(&(s->s_address)); + ktest_destroy_address(&(s->r_address)); + ktest_destroy_checksum(&(s->checksum)); } void ktest_empty_priv_enc_part(pep) - krb5_priv_enc_part * pep; + krb5_priv_enc_part * pep; { - ktest_empty_data(&(pep->user_data)); - ktest_destroy_address(&(pep->s_address)); - ktest_destroy_address(&(pep->r_address)); + ktest_empty_data(&(pep->user_data)); + ktest_destroy_address(&(pep->s_address)); + ktest_destroy_address(&(pep->r_address)); } void ktest_empty_priv(p) - krb5_priv * p; + krb5_priv * p; { - ktest_destroy_enc_data(&(p->enc_part)); + ktest_destroy_enc_data(&(p->enc_part)); } void ktest_empty_cred(c) - krb5_cred * c; + krb5_cred * c; { - ktest_destroy_sequence_of_ticket(&(c->tickets)); - ktest_destroy_enc_data(&(c->enc_part)); - /* enc_part2 */ + ktest_destroy_sequence_of_ticket(&(c->tickets)); + ktest_destroy_enc_data(&(c->enc_part)); + /* enc_part2 */ } void ktest_destroy_last_req(lr) - krb5_last_req_entry *** lr; + krb5_last_req_entry *** lr; { - int i; + int i; - if(*lr) { - for(i=0; (*lr)[i] != NULL; i++) { - free((*lr)[i]); + if (*lr) { + for (i=0; (*lr)[i] != NULL; i++) { + free((*lr)[i]); + } + free(*lr); } - free(*lr); - } } void ktest_empty_error(kerr) - krb5_error * kerr; + krb5_error * kerr; { - if(kerr->client) - ktest_destroy_principal(&(kerr->client)); - if(kerr->server) - ktest_destroy_principal(&(kerr->server)); - ktest_empty_data(&(kerr->text)); - ktest_empty_data(&(kerr->e_data)); + if (kerr->client) + ktest_destroy_principal(&(kerr->client)); + if (kerr->server) + ktest_destroy_principal(&(kerr->server)); + ktest_empty_data(&(kerr->text)); + ktest_empty_data(&(kerr->e_data)); } void ktest_empty_ap_rep_enc_part(arep) - krb5_ap_rep_enc_part * arep; + krb5_ap_rep_enc_part * arep; { - ktest_destroy_keyblock(&((arep)->subkey)); + ktest_destroy_keyblock(&((arep)->subkey)); } void ktest_empty_passwd_phrase_element(ppe) - passwd_phrase_element * ppe; + passwd_phrase_element * ppe; { - ktest_destroy_data(&(ppe->passwd)); - ktest_destroy_data(&(ppe->phrase)); + ktest_destroy_data(&(ppe->passwd)); + ktest_destroy_data(&(ppe->phrase)); } void ktest_empty_pwd_data(pd) - krb5_pwd_data * pd; + krb5_pwd_data * pd; { - int i; + int i; - for(i=0; i <= pd->sequence_count; i++){ - if(pd->element[i]) { - ktest_empty_passwd_phrase_element(pd->element[i]); - free(pd->element[i]); - pd->element[i] = NULL; + for (i=0; i <= pd->sequence_count; i++) { + if (pd->element[i]) { + ktest_empty_passwd_phrase_element(pd->element[i]); + free(pd->element[i]); + pd->element[i] = NULL; + } } - } - free(pd->element); + free(pd->element); } void ktest_empty_alt_method(am) - krb5_alt_method *am; + krb5_alt_method *am; { - if (am->data) { - free(am->data); - am->data = NULL; - } + if (am->data) { + free(am->data); + am->data = NULL; + } } void ktest_empty_sam_challenge(p) - krb5_sam_challenge * p; -{ - ktest_empty_data(&(p->sam_type_name)); - ktest_empty_data(&(p->sam_track_id)); - ktest_empty_data(&(p->sam_challenge_label)); - ktest_empty_data(&(p->sam_challenge)); - ktest_empty_data(&(p->sam_response_prompt)); - ktest_empty_data(&(p->sam_pk_for_sad)); - - if(p->sam_cksum.contents != NULL) { - free(p->sam_cksum.contents); - p->sam_cksum.contents = NULL; - } + krb5_sam_challenge * p; +{ + ktest_empty_data(&(p->sam_type_name)); + ktest_empty_data(&(p->sam_track_id)); + ktest_empty_data(&(p->sam_challenge_label)); + ktest_empty_data(&(p->sam_challenge)); + ktest_empty_data(&(p->sam_response_prompt)); + ktest_empty_data(&(p->sam_pk_for_sad)); + + if (p->sam_cksum.contents != NULL) { + free(p->sam_cksum.contents); + p->sam_cksum.contents = NULL; + } } void ktest_empty_sam_response(p) - krb5_sam_response * p; + krb5_sam_response * p; { - ktest_empty_data(&(p->sam_track_id)); - ktest_empty_data(&(p->sam_enc_key.ciphertext)); - ktest_empty_data(&(p->sam_enc_nonce_or_ts.ciphertext)); + ktest_empty_data(&(p->sam_track_id)); + ktest_empty_data(&(p->sam_enc_key.ciphertext)); + ktest_empty_data(&(p->sam_enc_nonce_or_ts.ciphertext)); } diff --git a/src/tests/asn.1/ktest_equal.c b/src/tests/asn.1/ktest_equal.c index c7433255f9..bc8f4bc166 100644 --- a/src/tests/asn.1/ktest_equal.c +++ b/src/tests/asn.1/ktest_equal.c @@ -5,464 +5,464 @@ #define FALSE 0 #define TRUE 1 -#define struct_equal(field,comparator)\ -comparator(&(ref->field),&(var->field)) +#define struct_equal(field,comparator) \ + comparator(&(ref->field),&(var->field)) -#define ptr_equal(field,comparator)\ -comparator(ref->field,var->field) +#define ptr_equal(field,comparator) \ + comparator(ref->field,var->field) -#define scalar_equal(field)\ -((ref->field) == (var->field)) +#define scalar_equal(field) \ + ((ref->field) == (var->field)) -#define len_equal(length,field,comparator)\ -((ref->length == var->length) && \ - comparator(ref->length,ref->field,var->field)) +#define len_equal(length,field,comparator) \ + ((ref->length == var->length) && \ + comparator(ref->length,ref->field,var->field)) int ktest_equal_authenticator(ref, var) - krb5_authenticator * ref; - krb5_authenticator * var; -{ - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p = p && ptr_equal(client,ktest_equal_principal_data); - p = p && ptr_equal(checksum,ktest_equal_checksum); - p = p && scalar_equal(cusec); - p = p && scalar_equal(ctime); - p = p && ptr_equal(subkey,ktest_equal_keyblock); - p = p && scalar_equal(seq_number); - p = p && ptr_equal(authorization_data,ktest_equal_authorization_data); - return p; + krb5_authenticator * ref; + krb5_authenticator * var; +{ + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p = p && ptr_equal(client,ktest_equal_principal_data); + p = p && ptr_equal(checksum,ktest_equal_checksum); + p = p && scalar_equal(cusec); + p = p && scalar_equal(ctime); + p = p && ptr_equal(subkey,ktest_equal_keyblock); + p = p && scalar_equal(seq_number); + p = p && ptr_equal(authorization_data,ktest_equal_authorization_data); + return p; } int ktest_equal_principal_data(ref, var) - krb5_principal_data * ref; - krb5_principal_data * var; + krb5_principal_data * ref; + krb5_principal_data * var; { - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - return(struct_equal(realm,ktest_equal_data) && - len_equal(length,data,ktest_equal_array_of_data) && - scalar_equal(type)); + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + return(struct_equal(realm,ktest_equal_data) && + len_equal(length,data,ktest_equal_array_of_data) && + scalar_equal(type)); } int ktest_equal_authdata(ref, var) - krb5_authdata * ref; - krb5_authdata * var; + krb5_authdata * ref; + krb5_authdata * var; { - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - return(scalar_equal(ad_type) && - len_equal(length,contents,ktest_equal_array_of_octet)); + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + return(scalar_equal(ad_type) && + len_equal(length,contents,ktest_equal_array_of_octet)); } int ktest_equal_checksum(ref, var) - krb5_checksum * ref; - krb5_checksum * var; + krb5_checksum * ref; + krb5_checksum * var; { - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - return(scalar_equal(checksum_type) && len_equal(length,contents,ktest_equal_array_of_octet)); + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + return(scalar_equal(checksum_type) && len_equal(length,contents,ktest_equal_array_of_octet)); } int ktest_equal_keyblock(ref, var) - krb5_keyblock * ref; - krb5_keyblock * var; + krb5_keyblock * ref; + krb5_keyblock * var; { - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - return(scalar_equal(enctype) && len_equal(length,contents,ktest_equal_array_of_octet)); + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + return(scalar_equal(enctype) && len_equal(length,contents,ktest_equal_array_of_octet)); } int ktest_equal_data(ref, var) - krb5_data * ref; - krb5_data * var; + krb5_data * ref; + krb5_data * var; { - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - return(len_equal(length,data,ktest_equal_array_of_char)); + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + return(len_equal(length,data,ktest_equal_array_of_char)); } int ktest_equal_ticket(ref, var) - krb5_ticket * ref; - krb5_ticket * var; + krb5_ticket * ref; + krb5_ticket * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p = p && ptr_equal(server,ktest_equal_principal_data); - p = p && struct_equal(enc_part,ktest_equal_enc_data); - /* enc_part2 is irrelevant, as far as the ASN.1 code is concerned */ - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p = p && ptr_equal(server,ktest_equal_principal_data); + p = p && struct_equal(enc_part,ktest_equal_enc_data); + /* enc_part2 is irrelevant, as far as the ASN.1 code is concerned */ + return p; } int ktest_equal_enc_data(ref, var) - krb5_enc_data * ref; - krb5_enc_data * var; + krb5_enc_data * ref; + krb5_enc_data * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(enctype); - p=p&&scalar_equal(kvno); - p=p&&struct_equal(ciphertext,ktest_equal_data); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(enctype); + p=p&&scalar_equal(kvno); + p=p&&struct_equal(ciphertext,ktest_equal_data); + return p; } int ktest_equal_encryption_key(ref, var) - krb5_keyblock * ref; - krb5_keyblock * var; + krb5_keyblock * ref; + krb5_keyblock * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p = p && scalar_equal(enctype); - p = p && len_equal(length,contents,ktest_equal_array_of_octet); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p = p && scalar_equal(enctype); + p = p && len_equal(length,contents,ktest_equal_array_of_octet); + return p; } int ktest_equal_enc_tkt_part(ref, var) - krb5_enc_tkt_part * ref; - krb5_enc_tkt_part * var; -{ - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p = p && scalar_equal(flags); - p = p && ptr_equal(session,ktest_equal_encryption_key); - p = p && ptr_equal(client,ktest_equal_principal_data); - p = p && struct_equal(transited,ktest_equal_transited); - p = p && struct_equal(times,ktest_equal_ticket_times); - p = p && ptr_equal(caddrs,ktest_equal_addresses); - p = p && ptr_equal(authorization_data,ktest_equal_authorization_data); - return p; + krb5_enc_tkt_part * ref; + krb5_enc_tkt_part * var; +{ + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p = p && scalar_equal(flags); + p = p && ptr_equal(session,ktest_equal_encryption_key); + p = p && ptr_equal(client,ktest_equal_principal_data); + p = p && struct_equal(transited,ktest_equal_transited); + p = p && struct_equal(times,ktest_equal_ticket_times); + p = p && ptr_equal(caddrs,ktest_equal_addresses); + p = p && ptr_equal(authorization_data,ktest_equal_authorization_data); + return p; } int ktest_equal_transited(ref, var) - krb5_transited * ref; - krb5_transited * var; + krb5_transited * ref; + krb5_transited * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p = p && scalar_equal(tr_type); - p = p && struct_equal(tr_contents,ktest_equal_data); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p = p && scalar_equal(tr_type); + p = p && struct_equal(tr_contents,ktest_equal_data); + return p; } int ktest_equal_ticket_times(ref, var) - krb5_ticket_times * ref; - krb5_ticket_times * var; + krb5_ticket_times * ref; + krb5_ticket_times * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p = p && scalar_equal(authtime); - p = p && scalar_equal(starttime); - p = p && scalar_equal(endtime); - p = p && scalar_equal(renew_till); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p = p && scalar_equal(authtime); + p = p && scalar_equal(starttime); + p = p && scalar_equal(endtime); + p = p && scalar_equal(renew_till); + return p; } int ktest_equal_address(ref, var) - krb5_address * ref; - krb5_address * var; + krb5_address * ref; + krb5_address * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(addrtype); - p=p&&len_equal(length,contents,ktest_equal_array_of_octet); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(addrtype); + p=p&&len_equal(length,contents,ktest_equal_array_of_octet); + return p; } int ktest_equal_enc_kdc_rep_part(ref, var) - krb5_enc_kdc_rep_part * ref; - krb5_enc_kdc_rep_part * var; -{ - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&ptr_equal(session,ktest_equal_keyblock); - p=p&&ptr_equal(last_req,ktest_equal_last_req); - p=p&&scalar_equal(nonce); - p=p&&scalar_equal(key_exp); - p=p&&scalar_equal(flags); - p=p&&struct_equal(times,ktest_equal_ticket_times); - p=p&&ptr_equal(server,ktest_equal_principal_data); - p=p&&ptr_equal(caddrs,ktest_equal_addresses); - return p; + krb5_enc_kdc_rep_part * ref; + krb5_enc_kdc_rep_part * var; +{ + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&ptr_equal(session,ktest_equal_keyblock); + p=p&&ptr_equal(last_req,ktest_equal_last_req); + p=p&&scalar_equal(nonce); + p=p&&scalar_equal(key_exp); + p=p&&scalar_equal(flags); + p=p&&struct_equal(times,ktest_equal_ticket_times); + p=p&&ptr_equal(server,ktest_equal_principal_data); + p=p&&ptr_equal(caddrs,ktest_equal_addresses); + return p; } int ktest_equal_priv(ref, var) - krb5_priv * ref; - krb5_priv * var; + krb5_priv * ref; + krb5_priv * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&struct_equal(enc_part,ktest_equal_enc_data); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&struct_equal(enc_part,ktest_equal_enc_data); + return p; } int ktest_equal_cred(ref, var) - krb5_cred * ref; - krb5_cred * var; + krb5_cred * ref; + krb5_cred * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&ptr_equal(tickets,ktest_equal_sequence_of_ticket); - p=p&&struct_equal(enc_part,ktest_equal_enc_data); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&ptr_equal(tickets,ktest_equal_sequence_of_ticket); + p=p&&struct_equal(enc_part,ktest_equal_enc_data); + return p; } int ktest_equal_error(ref, var) - krb5_error * ref; - krb5_error * var; -{ - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(ctime); - p=p&&scalar_equal(cusec); - p=p&&scalar_equal(susec); - p=p&&scalar_equal(stime); - p=p&&scalar_equal(error); - p=p&&ptr_equal(client,ktest_equal_principal_data); - p=p&&ptr_equal(server,ktest_equal_principal_data); - p=p&&struct_equal(text,ktest_equal_data); - p=p&&struct_equal(e_data,ktest_equal_data); - return p; + krb5_error * ref; + krb5_error * var; +{ + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(ctime); + p=p&&scalar_equal(cusec); + p=p&&scalar_equal(susec); + p=p&&scalar_equal(stime); + p=p&&scalar_equal(error); + p=p&&ptr_equal(client,ktest_equal_principal_data); + p=p&&ptr_equal(server,ktest_equal_principal_data); + p=p&&struct_equal(text,ktest_equal_data); + p=p&&struct_equal(e_data,ktest_equal_data); + return p; } int ktest_equal_ap_req(ref, var) - krb5_ap_req * ref; - krb5_ap_req * var; + krb5_ap_req * ref; + krb5_ap_req * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(ap_options); - p=p&&ptr_equal(ticket,ktest_equal_ticket); - p=p&&struct_equal(authenticator,ktest_equal_enc_data); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(ap_options); + p=p&&ptr_equal(ticket,ktest_equal_ticket); + p=p&&struct_equal(authenticator,ktest_equal_enc_data); + return p; } int ktest_equal_ap_rep(ref, var) - krb5_ap_rep * ref; - krb5_ap_rep * var; + krb5_ap_rep * ref; + krb5_ap_rep * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&struct_equal(enc_part,ktest_equal_enc_data); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&struct_equal(enc_part,ktest_equal_enc_data); + return p; } int ktest_equal_ap_rep_enc_part(ref, var) - krb5_ap_rep_enc_part * ref; - krb5_ap_rep_enc_part * var; + krb5_ap_rep_enc_part * ref; + krb5_ap_rep_enc_part * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(ctime); - p=p&&scalar_equal(cusec); - p=p&&ptr_equal(subkey,ktest_equal_encryption_key); - p=p&&scalar_equal(seq_number); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(ctime); + p=p&&scalar_equal(cusec); + p=p&&ptr_equal(subkey,ktest_equal_encryption_key); + p=p&&scalar_equal(seq_number); + return p; } int ktest_equal_safe(ref, var) - krb5_safe * ref; - krb5_safe * var; + krb5_safe * ref; + krb5_safe * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&struct_equal(user_data,ktest_equal_data); - p=p&&scalar_equal(timestamp); - p=p&&scalar_equal(usec); - p=p&&scalar_equal(seq_number); - p=p&&ptr_equal(s_address,ktest_equal_address); - p=p&&ptr_equal(r_address,ktest_equal_address); - p=p&&ptr_equal(checksum,ktest_equal_checksum); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&struct_equal(user_data,ktest_equal_data); + p=p&&scalar_equal(timestamp); + p=p&&scalar_equal(usec); + p=p&&scalar_equal(seq_number); + p=p&&ptr_equal(s_address,ktest_equal_address); + p=p&&ptr_equal(r_address,ktest_equal_address); + p=p&&ptr_equal(checksum,ktest_equal_checksum); + return p; } int ktest_equal_enc_cred_part(ref, var) - krb5_cred_enc_part * ref; - krb5_cred_enc_part * var; + krb5_cred_enc_part * ref; + krb5_cred_enc_part * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(nonce); - p=p&&scalar_equal(timestamp); - p=p&&scalar_equal(usec); - p=p&&ptr_equal(s_address,ktest_equal_address); - p=p&&ptr_equal(r_address,ktest_equal_address); - p=p&&ptr_equal(ticket_info,ktest_equal_sequence_of_cred_info); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(nonce); + p=p&&scalar_equal(timestamp); + p=p&&scalar_equal(usec); + p=p&&ptr_equal(s_address,ktest_equal_address); + p=p&&ptr_equal(r_address,ktest_equal_address); + p=p&&ptr_equal(ticket_info,ktest_equal_sequence_of_cred_info); + return p; } int ktest_equal_enc_priv_part(ref, var) - krb5_priv_enc_part * ref; - krb5_priv_enc_part * var; + krb5_priv_enc_part * ref; + krb5_priv_enc_part * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&struct_equal(user_data,ktest_equal_data); - p=p&&scalar_equal(timestamp); - p=p&&scalar_equal(usec); - p=p&&scalar_equal(seq_number); - p=p&&ptr_equal(s_address,ktest_equal_address); - p=p&&ptr_equal(r_address,ktest_equal_address); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&struct_equal(user_data,ktest_equal_data); + p=p&&scalar_equal(timestamp); + p=p&&scalar_equal(usec); + p=p&&scalar_equal(seq_number); + p=p&&ptr_equal(s_address,ktest_equal_address); + p=p&&ptr_equal(r_address,ktest_equal_address); + return p; } int ktest_equal_as_rep(ref, var) - krb5_kdc_rep * ref; - krb5_kdc_rep * var; + krb5_kdc_rep * ref; + krb5_kdc_rep * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(msg_type); - p=p&&ptr_equal(padata,ktest_equal_sequence_of_pa_data); - p=p&&ptr_equal(client,ktest_equal_principal_data); - p=p&&ptr_equal(ticket,ktest_equal_ticket); - p=p&&struct_equal(enc_part,ktest_equal_enc_data); - p=p&&ptr_equal(enc_part2,ktest_equal_enc_kdc_rep_part); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(msg_type); + p=p&&ptr_equal(padata,ktest_equal_sequence_of_pa_data); + p=p&&ptr_equal(client,ktest_equal_principal_data); + p=p&&ptr_equal(ticket,ktest_equal_ticket); + p=p&&struct_equal(enc_part,ktest_equal_enc_data); + p=p&&ptr_equal(enc_part2,ktest_equal_enc_kdc_rep_part); + return p; } int ktest_equal_tgs_rep(ref, var) - krb5_kdc_rep * ref; - krb5_kdc_rep * var; + krb5_kdc_rep * ref; + krb5_kdc_rep * var; { - return ktest_equal_as_rep(ref,var); + return ktest_equal_as_rep(ref,var); } int ktest_equal_as_req(ref, var) - krb5_kdc_req * ref; - krb5_kdc_req * var; -{ - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(msg_type); - p=p&&ptr_equal(padata,ktest_equal_sequence_of_pa_data); - p=p&&scalar_equal(kdc_options); - p=p&&ptr_equal(client,ktest_equal_principal_data); - p=p&&ptr_equal(server,ktest_equal_principal_data); - p=p&&scalar_equal(from); - p=p&&scalar_equal(till); - p=p&&scalar_equal(rtime); - p=p&&scalar_equal(nonce); - p=p&&len_equal(nktypes,ktype,ktest_equal_array_of_enctype); - p=p&&ptr_equal(addresses,ktest_equal_addresses); - p=p&&struct_equal(authorization_data,ktest_equal_enc_data); + krb5_kdc_req * ref; + krb5_kdc_req * var; +{ + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(msg_type); + p=p&&ptr_equal(padata,ktest_equal_sequence_of_pa_data); + p=p&&scalar_equal(kdc_options); + p=p&&ptr_equal(client,ktest_equal_principal_data); + p=p&&ptr_equal(server,ktest_equal_principal_data); + p=p&&scalar_equal(from); + p=p&&scalar_equal(till); + p=p&&scalar_equal(rtime); + p=p&&scalar_equal(nonce); + p=p&&len_equal(nktypes,ktype,ktest_equal_array_of_enctype); + p=p&&ptr_equal(addresses,ktest_equal_addresses); + p=p&&struct_equal(authorization_data,ktest_equal_enc_data); /* This field isn't actually in the ASN.1 encoding. */ /* p=p&&ptr_equal(unenc_authdata,ktest_equal_authorization_data); */ - return p; + return p; } int ktest_equal_tgs_req(ref, var) - krb5_kdc_req * ref; - krb5_kdc_req * var; + krb5_kdc_req * ref; + krb5_kdc_req * var; { - return ktest_equal_as_req(ref,var); + return ktest_equal_as_req(ref,var); } int ktest_equal_kdc_req_body(ref, var) - krb5_kdc_req * ref; - krb5_kdc_req * var; -{ - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(kdc_options); - p=p&&ptr_equal(client,ktest_equal_principal_data); - p=p&&ptr_equal(server,ktest_equal_principal_data); - p=p&&scalar_equal(from); - p=p&&scalar_equal(till); - p=p&&scalar_equal(rtime); - p=p&&scalar_equal(nonce); - p=p&&len_equal(nktypes,ktype,ktest_equal_array_of_enctype); - p=p&&ptr_equal(addresses,ktest_equal_addresses); - p=p&&struct_equal(authorization_data,ktest_equal_enc_data); - /* This isn't part of the ASN.1 encoding. */ - /* p=p&&ptr_equal(unenc_authdata,ktest_equal_authorization_data); */ - return p; + krb5_kdc_req * ref; + krb5_kdc_req * var; +{ + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(kdc_options); + p=p&&ptr_equal(client,ktest_equal_principal_data); + p=p&&ptr_equal(server,ktest_equal_principal_data); + p=p&&scalar_equal(from); + p=p&&scalar_equal(till); + p=p&&scalar_equal(rtime); + p=p&&scalar_equal(nonce); + p=p&&len_equal(nktypes,ktype,ktest_equal_array_of_enctype); + p=p&&ptr_equal(addresses,ktest_equal_addresses); + p=p&&struct_equal(authorization_data,ktest_equal_enc_data); + /* This isn't part of the ASN.1 encoding. */ + /* p=p&&ptr_equal(unenc_authdata,ktest_equal_authorization_data); */ + return p; } int ktest_equal_last_req_entry(ref, var) - krb5_last_req_entry * ref; - krb5_last_req_entry * var; + krb5_last_req_entry * ref; + krb5_last_req_entry * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(lr_type); - p=p&&scalar_equal(value); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(lr_type); + p=p&&scalar_equal(value); + return p; } int ktest_equal_pa_data(ref, var) - krb5_pa_data * ref; - krb5_pa_data * var; + krb5_pa_data * ref; + krb5_pa_data * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(pa_type); - p=p&&len_equal(length,contents,ktest_equal_array_of_octet); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(pa_type); + p=p&&len_equal(length,contents,ktest_equal_array_of_octet); + return p; } int ktest_equal_cred_info(ref, var) - krb5_cred_info * ref; - krb5_cred_info * var; + krb5_cred_info * ref; + krb5_cred_info * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&ptr_equal(session,ktest_equal_keyblock); - p=p&&ptr_equal(client,ktest_equal_principal_data); - p=p&&ptr_equal(server,ktest_equal_principal_data); - p=p&&scalar_equal(flags); - p=p&&struct_equal(times,ktest_equal_ticket_times); - p=p&&ptr_equal(caddrs,ktest_equal_addresses); + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&ptr_equal(session,ktest_equal_keyblock); + p=p&&ptr_equal(client,ktest_equal_principal_data); + p=p&&ptr_equal(server,ktest_equal_principal_data); + p=p&&scalar_equal(flags); + p=p&&struct_equal(times,ktest_equal_ticket_times); + p=p&&ptr_equal(caddrs,ktest_equal_addresses); - return p; + return p; } int ktest_equal_passwd_phrase_element(ref, var) - passwd_phrase_element * ref; - passwd_phrase_element * var; + passwd_phrase_element * ref; + passwd_phrase_element * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&ptr_equal(passwd,ktest_equal_data); - p=p&&ptr_equal(phrase,ktest_equal_data); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&ptr_equal(passwd,ktest_equal_data); + p=p&&ptr_equal(phrase,ktest_equal_data); + return p; } int ktest_equal_krb5_pwd_data(ref, var) - krb5_pwd_data * ref; - krb5_pwd_data * var; + krb5_pwd_data * ref; + krb5_pwd_data * var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(sequence_count); - p=p&&ptr_equal(element,ktest_equal_array_of_passwd_phrase_element); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(sequence_count); + p=p&&ptr_equal(element,ktest_equal_array_of_passwd_phrase_element); + return p; } int ktest_equal_krb5_alt_method(ref, var) @@ -496,174 +496,174 @@ int ktest_equal_krb5_pa_enc_ts(ref, var) krb5_pa_enc_ts *ref; krb5_pa_enc_ts *var; { - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(patimestamp); - p=p&&scalar_equal(pausec); - return p; + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(patimestamp); + p=p&&scalar_equal(pausec); + return p; } #define equal_str(f) struct_equal(f,ktest_equal_data) int ktest_equal_sam_challenge(ref, var) - krb5_sam_challenge *ref; - krb5_sam_challenge *var; -{ - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(sam_type); - p=p&&scalar_equal(sam_flags); - p=p&&scalar_equal(sam_nonce); - p=p&&ktest_equal_checksum(&ref->sam_cksum,&var->sam_cksum); - p=p&&equal_str(sam_track_id); - p=p&&equal_str(sam_challenge_label); - p=p&&equal_str(sam_challenge); - p=p&&equal_str(sam_response_prompt); - p=p&&equal_str(sam_pk_for_sad); - return p; + krb5_sam_challenge *ref; + krb5_sam_challenge *var; +{ + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(sam_type); + p=p&&scalar_equal(sam_flags); + p=p&&scalar_equal(sam_nonce); + p=p&&ktest_equal_checksum(&ref->sam_cksum,&var->sam_cksum); + p=p&&equal_str(sam_track_id); + p=p&&equal_str(sam_challenge_label); + p=p&&equal_str(sam_challenge); + p=p&&equal_str(sam_response_prompt); + p=p&&equal_str(sam_pk_for_sad); + return p; } int ktest_equal_sam_response(ref, var) - krb5_sam_response *ref; - krb5_sam_response *var; -{ - int p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - p=p&&scalar_equal(sam_type); - p=p&&scalar_equal(sam_flags); - p=p&&equal_str(sam_track_id); - p=p&&struct_equal(sam_enc_key,ktest_equal_enc_data); - p=p&&struct_equal(sam_enc_nonce_or_ts,ktest_equal_enc_data); - p=p&&scalar_equal(sam_nonce); - p=p&&scalar_equal(sam_patimestamp); - return p; + krb5_sam_response *ref; + krb5_sam_response *var; +{ + int p=TRUE; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + p=p&&scalar_equal(sam_type); + p=p&&scalar_equal(sam_flags); + p=p&&equal_str(sam_track_id); + p=p&&struct_equal(sam_enc_key,ktest_equal_enc_data); + p=p&&struct_equal(sam_enc_nonce_or_ts,ktest_equal_enc_data); + p=p&&scalar_equal(sam_nonce); + p=p&&scalar_equal(sam_patimestamp); + return p; } /**** arrays ****************************************************************/ int ktest_equal_array_of_data(length, ref, var) - const int length; - krb5_data * ref; - krb5_data * var; + const int length; + krb5_data * ref; + krb5_data * var; { - int i,p=TRUE; + int i,p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - for(i=0; i<(length); i++){ - p = p && ktest_equal_data(&(ref[i]),&(var[i])); - } - return p; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + for (i=0; i<(length); i++) { + p = p && ktest_equal_data(&(ref[i]),&(var[i])); + } + return p; } int ktest_equal_array_of_octet(length, ref, var) - const unsigned int length; - krb5_octet * ref; - krb5_octet * var; + const unsigned int length; + krb5_octet * ref; + krb5_octet * var; { - unsigned int i, p=TRUE; + unsigned int i, p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - for(i=0; i<length; i++) - p = p && (ref[i] == var[i]); - return p; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + for (i=0; i<length; i++) + p = p && (ref[i] == var[i]); + return p; } int ktest_equal_array_of_char(length, ref, var) - const unsigned int length; - char * ref; - char * var; + const unsigned int length; + char * ref; + char * var; { - unsigned int i, p=TRUE; + unsigned int i, p=TRUE; - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - for(i=0; i<length; i++) - p = p && (ref[i] == var[i]); - return p; + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + for (i=0; i<length; i++) + p = p && (ref[i] == var[i]); + return p; } int ktest_equal_array_of_enctype(length, ref, var) - const int length; - krb5_enctype * ref; - krb5_enctype * var; -{ - int i, p=TRUE; - - if(ref==var) return TRUE; - else if(ref == NULL || var == NULL) return FALSE; - for(i=0; i<length; i++) - p = p && (ref[i] == var[i]); - return p; -} - -#define array_compare(comparator)\ -int i,p=TRUE;\ -if(ref==var) return TRUE;\ -if(!ref || !ref[0])\ - return (!var || !var[0]);\ -if(!var || !var[0]) return FALSE;\ -for(i=0; ref[i] != NULL && var[i] != NULL; i++)\ - p = p && comparator(ref[i],var[i]);\ -if(ref[i] == NULL && var[i] == NULL) return p;\ -else return FALSE + const int length; + krb5_enctype * ref; + krb5_enctype * var; +{ + int i, p=TRUE; + + if (ref==var) return TRUE; + else if (ref == NULL || var == NULL) return FALSE; + for (i=0; i<length; i++) + p = p && (ref[i] == var[i]); + return p; +} + +#define array_compare(comparator) \ + int i,p=TRUE; \ + if (ref==var) return TRUE; \ + if (!ref || !ref[0]) \ + return (!var || !var[0]); \ + if (!var || !var[0]) return FALSE; \ + for (i=0; ref[i] != NULL && var[i] != NULL; i++) \ + p = p && comparator(ref[i],var[i]); \ + if (ref[i] == NULL && var[i] == NULL) return p; \ + else return FALSE int ktest_equal_authorization_data(ref, var) - krb5_authdata ** ref; - krb5_authdata ** var; + krb5_authdata ** ref; + krb5_authdata ** var; { - array_compare(ktest_equal_authdata); + array_compare(ktest_equal_authdata); } int ktest_equal_addresses(ref, var) - krb5_address ** ref; - krb5_address ** var; + krb5_address ** ref; + krb5_address ** var; { - array_compare(ktest_equal_address); + array_compare(ktest_equal_address); } int ktest_equal_last_req(ref, var) - krb5_last_req_entry ** ref; - krb5_last_req_entry ** var; + krb5_last_req_entry ** ref; + krb5_last_req_entry ** var; { - array_compare(ktest_equal_last_req_entry); + array_compare(ktest_equal_last_req_entry); } int ktest_equal_sequence_of_ticket(ref, var) - krb5_ticket ** ref; - krb5_ticket ** var; + krb5_ticket ** ref; + krb5_ticket ** var; { - array_compare(ktest_equal_ticket); + array_compare(ktest_equal_ticket); } int ktest_equal_sequence_of_pa_data(ref, var) - krb5_pa_data ** ref; - krb5_pa_data ** var; + krb5_pa_data ** ref; + krb5_pa_data ** var; { - array_compare(ktest_equal_pa_data); + array_compare(ktest_equal_pa_data); } int ktest_equal_sequence_of_cred_info(ref, var) - krb5_cred_info ** ref; - krb5_cred_info ** var; + krb5_cred_info ** ref; + krb5_cred_info ** var; { - array_compare(ktest_equal_cred_info); + array_compare(ktest_equal_cred_info); } int ktest_equal_array_of_passwd_phrase_element(ref, var) - passwd_phrase_element ** ref; - passwd_phrase_element ** var; + passwd_phrase_element ** ref; + passwd_phrase_element ** var; { - array_compare(ktest_equal_passwd_phrase_element); + array_compare(ktest_equal_passwd_phrase_element); } int ktest_equal_etype_info(ref, var) - krb5_etype_info_entry ** ref; - krb5_etype_info_entry ** var; + krb5_etype_info_entry ** ref; + krb5_etype_info_entry ** var; { - array_compare(ktest_equal_krb5_etype_info_entry); + array_compare(ktest_equal_krb5_etype_info_entry); } diff --git a/src/tests/asn.1/t_trval.c b/src/tests/asn.1/t_trval.c index 2c948fc8ee..75dcc0caaa 100644 --- a/src/tests/asn.1/t_trval.c +++ b/src/tests/asn.1/t_trval.c @@ -38,8 +38,8 @@ static void usage() { - fprintf(stderr, "Usage: trval [--types] [--krb5] [--krb5decode] [--hex] [-notypebytes] [file]\n"); - exit(1); + fprintf(stderr, "Usage: trval [--types] [--krb5] [--krb5decode] [--hex] [-notypebytes] [file]\n"); + exit(1); } /* @@ -48,60 +48,60 @@ static void usage() */ static int check_option(word, option) - char *word; - char *option; + char *word; + char *option; { - if (word[0] != '-') - return 0; - if (word[1] == '-') - word++; - if (strcmp(word+1, option)) - return 0; - return 1; + if (word[0] != '-') + return 0; + if (word[1] == '-') + word++; + if (strcmp(word+1, option)) + return 0; + return 1; } int main(argc, argv) - int argc; - char **argv; + int argc; + char **argv; { - int optflg = 1; - FILE *fp; - int r = 0; + int optflg = 1; + FILE *fp; + int r = 0; - while (--argc > 0) { - argv++; - if (optflg && *(argv)[0] == '-') { - if (check_option(*argv, "help")) - usage(); - else if (check_option(*argv, "types")) - print_types = 1; - else if (check_option(*argv, "notypes")) - print_types = 0; - else if (check_option(*argv, "krb5")) - print_krb5_types = 1; - else if (check_option(*argv, "hex")) - do_hex = 1; - else if (check_option(*argv, "notypebytes")) - print_id_and_len = 0; - else if (check_option(*argv, "krb5decode")) { - print_id_and_len = 0; - print_krb5_types = 1; - print_types = 1; - } else { - fprintf(stderr,"trval: unknown option: %s\n", *argv); - usage(); - } - } else { - optflg = 0; - if ((fp = fopen(*argv,"r")) == NULL) { - fprintf(stderr,"trval: unable to open %s\n", *argv); - continue; - } - r = trval(fp, stdout); - fclose(fp); - } + while (--argc > 0) { + argv++; + if (optflg && *(argv)[0] == '-') { + if (check_option(*argv, "help")) + usage(); + else if (check_option(*argv, "types")) + print_types = 1; + else if (check_option(*argv, "notypes")) + print_types = 0; + else if (check_option(*argv, "krb5")) + print_krb5_types = 1; + else if (check_option(*argv, "hex")) + do_hex = 1; + else if (check_option(*argv, "notypebytes")) + print_id_and_len = 0; + else if (check_option(*argv, "krb5decode")) { + print_id_and_len = 0; + print_krb5_types = 1; + print_types = 1; + } else { + fprintf(stderr,"trval: unknown option: %s\n", *argv); + usage(); + } + } else { + optflg = 0; + if ((fp = fopen(*argv,"r")) == NULL) { + fprintf(stderr,"trval: unable to open %s\n", *argv); + continue; + } + r = trval(fp, stdout); + fclose(fp); } - if (optflg) r = trval(stdin, stdout); + } + if (optflg) r = trval(stdin, stdout); - exit(r); + exit(r); } diff --git a/src/tests/asn.1/trval.c b/src/tests/asn.1/trval.c index f94459bbf8..99c0c38464 100644 --- a/src/tests/asn.1/trval.c +++ b/src/tests/asn.1/trval.c @@ -44,21 +44,21 @@ #define OK 0 #define NOTOK (-1) - /* IDENTIFIER OCTET = TAG CLASS | FORM OF ENCODING | TAG NUMBER */ +/* IDENTIFIER OCTET = TAG CLASS | FORM OF ENCODING | TAG NUMBER */ - /* TAG CLASSES */ +/* TAG CLASSES */ #define ID_CLASS 0xc0 /* bits 8 and 7 */ #define CLASS_UNIV 0x00 /* 0 = universal */ #define CLASS_APPL 0x40 /* 1 = application */ #define CLASS_CONT 0x80 /* 2 = context-specific */ #define CLASS_PRIV 0xc0 /* 3 = private */ - /* FORM OF ENCODING */ +/* FORM OF ENCODING */ #define ID_FORM 0x20 /* bit 6 */ #define FORM_PRIM 0x00 /* 0 = primitive */ #define FORM_CONS 0x20 /* 1 = constructed */ - /* TAG NUMBERS */ +/* TAG NUMBERS */ #define ID_TAG 0x1f /* bits 5-1 */ #define PRIM_BOOL 0x01 /* Boolean */ #define PRIM_INT 0x02 /* Integer */ @@ -131,192 +131,192 @@ static int convert_nibble(int ch) } int trval(fin, fout) - FILE *fin; - FILE *fout; + FILE *fin; + FILE *fout; { - unsigned char *p; - unsigned int maxlen; - int len; - int cc, cc2, n1, n2; - int r; - int rlen; + unsigned char *p; + unsigned int maxlen; + int len; + int cc, cc2, n1, n2; + int r; + int rlen; - maxlen = BUFSIZ; - p = (unsigned char *)malloc(maxlen); - len = 0; - while ((cc = fgetc(fin)) != EOF) { - if ((unsigned int) len == maxlen) { - maxlen += BUFSIZ; - p = (unsigned char *)realloc(p, maxlen); - } - if (do_hex) { - if (cc == ' ' || cc == '\n' || cc == '\t') - continue; - cc2 = fgetc(fin); - if (cc2 == EOF) - break; - n1 = convert_nibble(cc); - n2 = convert_nibble(cc2); - cc = (n1 << 4) + n2; - } - p[len++] = cc; + maxlen = BUFSIZ; + p = (unsigned char *)malloc(maxlen); + len = 0; + while ((cc = fgetc(fin)) != EOF) { + if ((unsigned int) len == maxlen) { + maxlen += BUFSIZ; + p = (unsigned char *)realloc(p, maxlen); } - fprintf(fout, "<%d>", len); - r = trval2(fout, p, len, 0, &rlen); - fprintf(fout, "\n"); - (void) free(p); - return(r); + if (do_hex) { + if (cc == ' ' || cc == '\n' || cc == '\t') + continue; + cc2 = fgetc(fin); + if (cc2 == EOF) + break; + n1 = convert_nibble(cc); + n2 = convert_nibble(cc2); + cc = (n1 << 4) + n2; + } + p[len++] = cc; + } + fprintf(fout, "<%d>", len); + r = trval2(fout, p, len, 0, &rlen); + fprintf(fout, "\n"); + (void) free(p); + return(r); } int trval2(fp, enc, len, lev, rlen) - FILE *fp; - unsigned char *enc; - int len; - int lev; - int *rlen; + FILE *fp; + unsigned char *enc; + int len; + int lev; + int *rlen; { - int l, eid, elen, xlen, r, rlen2; - int rlen_ext = 0; + int l, eid, elen, xlen, r, rlen2; + int rlen_ext = 0; - r = OK; + r = OK; - if (len < 2) { - fprintf(fp, "missing id and length octets (%d)\n", len); - return(NOTOK); - } + if (len < 2) { + fprintf(fp, "missing id and length octets (%d)\n", len); + return(NOTOK); + } - fprintf(fp, "\n"); - for (l=0; l<lev; l++) fprintf(fp, ". "); + fprintf(fp, "\n"); + for (l=0; l<lev; l++) fprintf(fp, ". "); context_restart: - eid = enc[0]; - elen = enc[1]; + eid = enc[0]; + elen = enc[1]; - if (print_id_and_len) { - fprintf(fp, "%02x ", eid); - fprintf(fp, "%02x ", elen); - } + if (print_id_and_len) { + fprintf(fp, "%02x ", eid); + fprintf(fp, "%02x ", elen); + } - if (elen == LEN_XTND) { - fprintf(fp, - "indefinite length encoding not implemented (0x%02x)\n", elen); - return(NOTOK); - } + if (elen == LEN_XTND) { + fprintf(fp, + "indefinite length encoding not implemented (0x%02x)\n", elen); + return(NOTOK); + } - xlen = 0; - if (elen & LEN_XTND) { - xlen = elen & LEN_MASK; - if (xlen > len - 2) { - fprintf(fp, "extended length too long (%d > %d - 2)\n", xlen, len); - return(NOTOK); - } - elen = decode_len(fp, enc+2, xlen); + xlen = 0; + if (elen & LEN_XTND) { + xlen = elen & LEN_MASK; + if (xlen > len - 2) { + fprintf(fp, "extended length too long (%d > %d - 2)\n", xlen, len); + return(NOTOK); } + elen = decode_len(fp, enc+2, xlen); + } - if (elen > len - 2 - xlen) { - fprintf(fp, "length too long (%d > %d - 2 - %d)\n", elen, len, xlen); - return(NOTOK); - } + if (elen > len - 2 - xlen) { + fprintf(fp, "length too long (%d > %d - 2 - %d)\n", elen, len, xlen); + return(NOTOK); + } - print_tag_type(fp, eid, lev); + print_tag_type(fp, eid, lev); - if (print_context_shortcut && - ((eid & ID_CLASS) == CLASS_CONT) && (lev > 0)) { - rlen_ext += 2 + xlen; - enc += 2 + xlen; - goto context_restart; - } + if (print_context_shortcut && + ((eid & ID_CLASS) == CLASS_CONT) && (lev > 0)) { + rlen_ext += 2 + xlen; + enc += 2 + xlen; + goto context_restart; + } - switch(eid & ID_FORM) { - case FORM_PRIM: - r = do_prim(fp, eid & ID_TAG, enc+2+xlen, elen, lev+1); - *rlen = 2 + xlen + elen + rlen_ext; - break; - case FORM_CONS: - if (print_constructed_length) { - fprintf(fp, "constr "); - fprintf(fp, "<%d>", elen); - } - r = do_cons(fp, enc+2+xlen, elen, lev+1, &rlen2); - *rlen = 2 + xlen + rlen2 + rlen_ext; - break; + switch(eid & ID_FORM) { + case FORM_PRIM: + r = do_prim(fp, eid & ID_TAG, enc+2+xlen, elen, lev+1); + *rlen = 2 + xlen + elen + rlen_ext; + break; + case FORM_CONS: + if (print_constructed_length) { + fprintf(fp, "constr "); + fprintf(fp, "<%d>", elen); } + r = do_cons(fp, enc+2+xlen, elen, lev+1, &rlen2); + *rlen = 2 + xlen + rlen2 + rlen_ext; + break; + } - return(r); + return(r); } int decode_len(fp, enc, len) - FILE *fp; - unsigned char *enc; - int len; + FILE *fp; + unsigned char *enc; + int len; { - int rlen; - int i; + int rlen; + int i; + if (print_id_and_len) + fprintf(fp, "%02x ", enc[0]); + rlen = enc[0]; + for (i=1; i<len; i++) { if (print_id_and_len) - fprintf(fp, "%02x ", enc[0]); - rlen = enc[0]; - for (i=1; i<len; i++) { - if (print_id_and_len) - fprintf(fp, "%02x ", enc[i]); - rlen = (rlen * 0x100) + enc[i]; - } - return(rlen); + fprintf(fp, "%02x ", enc[i]); + rlen = (rlen * 0x100) + enc[i]; + } + return(rlen); } /* * This is the printing function for bit strings */ int do_prim_bitstring(fp, tag, enc, len, lev) - FILE *fp; - int tag; - unsigned char *enc; - int len; - int lev; + FILE *fp; + int tag; + unsigned char *enc; + int len; + int lev; { - int i; - long num = 0; + int i; + long num = 0; - if (tag != PRIM_BITS || len > 5) - return 0; + if (tag != PRIM_BITS || len > 5) + return 0; - for (i=1; i < len; i++) { - num = num << 8; - num += enc[i]; - } + for (i=1; i < len; i++) { + num = num << 8; + num += enc[i]; + } - fprintf(fp, "0x%lx", num); - if (enc[0]) - fprintf(fp, " (%d unused bits)", enc[0]); - return 1; + fprintf(fp, "0x%lx", num); + if (enc[0]) + fprintf(fp, " (%d unused bits)", enc[0]); + return 1; } /* * This is the printing function for integers */ int do_prim_int(fp, tag, enc, len, lev) - FILE *fp; - int tag; - unsigned char *enc; - int len; - int lev; + FILE *fp; + int tag; + unsigned char *enc; + int len; + int lev; { - int i; - long num = 0; + int i; + long num = 0; - if (tag != PRIM_INT || len > 4) - return 0; + if (tag != PRIM_INT || len > 4) + return 0; - if (enc[0] & 0x80) - num = -1; + if (enc[0] & 0x80) + num = -1; - for (i=0; i < len; i++) { - num = num << 8; - num += enc[i]; - } + for (i=0; i < len; i++) { + num = num << 8; + num += enc[i]; + } - fprintf(fp, "%ld", num); - return 1; + fprintf(fp, "%ld", num); + return 1; } @@ -325,80 +325,80 @@ int do_prim_int(fp, tag, enc, len, lev) * other other type which is best printed as a string */ int do_prim_string(fp, tag, enc, len, lev) - FILE *fp; - int tag; - unsigned char *enc; - int len; - int lev; + FILE *fp; + int tag; + unsigned char *enc; + int len; + int lev; { - int i; - - /* - * Only try this printing function with "reasonable" types - */ - if ((tag < DEFN_NUMS) && (tag != PRIM_OCTS)) - return 0; - - for (i=0; i < len; i++) - if (!isprint(enc[i])) - return 0; - fprintf(fp, "\"%.*s\"", len, enc); - return 1; + int i; + + /* + * Only try this printing function with "reasonable" types + */ + if ((tag < DEFN_NUMS) && (tag != PRIM_OCTS)) + return 0; + + for (i=0; i < len; i++) + if (!isprint(enc[i])) + return 0; + fprintf(fp, "\"%.*s\"", len, enc); + return 1; } int do_prim(fp, tag, enc, len, lev) - FILE *fp; - int tag; - unsigned char *enc; - int len; - int lev; + FILE *fp; + int tag; + unsigned char *enc; + int len; + int lev; { - int n; - int i; - int j; - int width; - - if (do_prim_string(fp, tag, enc, len, lev)) - return OK; - if (do_prim_int(fp, tag, enc, len, lev)) - return OK; - if (do_prim_bitstring(fp, tag, enc, len, lev)) - return OK; - - if (print_primitive_length) - fprintf(fp, "<%d>", len); + int n; + int i; + int j; + int width; + + if (do_prim_string(fp, tag, enc, len, lev)) + return OK; + if (do_prim_int(fp, tag, enc, len, lev)) + return OK; + if (do_prim_bitstring(fp, tag, enc, len, lev)) + return OK; + + if (print_primitive_length) + fprintf(fp, "<%d>", len); - width = (80 - (lev * 3) - 8) / 4; + width = (80 - (lev * 3) - 8) / 4; - for (n = 0; n < len; n++) { - if ((n % width) == 0) { - fprintf(fp, "\n"); - for (i=0; i<lev; i++) fprintf(fp, " "); - } - fprintf(fp, "%02x ", enc[n]); - if ((n % width) == (width-1)) { - fprintf(fp, " "); - for (i=n-(width-1); i<=n; i++) - if (isprint(enc[i])) fprintf(fp, "%c", enc[i]); - else fprintf(fp, "."); - } + for (n = 0; n < len; n++) { + if ((n % width) == 0) { + fprintf(fp, "\n"); + for (i=0; i<lev; i++) fprintf(fp, " "); } - if ((j = (n % width)) != 0) { - fprintf(fp, " "); - for (i=0; i<width-j; i++) fprintf(fp, " "); - for (i=n-j; i<n; i++) - if (isprint(enc[i])) fprintf(fp, "%c", enc[i]); - else fprintf(fp, "."); + fprintf(fp, "%02x ", enc[n]); + if ((n % width) == (width-1)) { + fprintf(fp, " "); + for (i=n-(width-1); i<=n; i++) + if (isprint(enc[i])) fprintf(fp, "%c", enc[i]); + else fprintf(fp, "."); } - return(OK); + } + if ((j = (n % width)) != 0) { + fprintf(fp, " "); + for (i=0; i<width-j; i++) fprintf(fp, " "); + for (i=n-j; i<n; i++) + if (isprint(enc[i])) fprintf(fp, "%c", enc[i]); + else fprintf(fp, "."); + } + return(OK); } int do_cons(fp, enc, len, lev, rlen) -FILE *fp; -unsigned char *enc; -int len; -int lev; -int *rlen; + FILE *fp; + unsigned char *enc; + int len; + int lev; + int *rlen; { int n; int r = 0; @@ -414,7 +414,7 @@ int *rlen; } if (rlent != len) { fprintf(fp, "inconsistent constructed lengths (%d != %d)\n", - rlent, len); + rlent, len); return(NOTOK); } *rlen = rlent; @@ -422,344 +422,344 @@ int *rlen; } struct typestring_table { - int k1, k2; - char *str; - int new_appl; + int k1, k2; + char *str; + int new_appl; }; static char *lookup_typestring(table, key1, key2) - struct typestring_table *table; - int key1, key2; + struct typestring_table *table; + int key1, key2; { - struct typestring_table *ent; - - for (ent = table; ent->k1 > 0; ent++) { - if ((ent->k1 == key1) && - (ent->k2 == key2)) { - if (ent->new_appl) - current_appl_type = ent->new_appl; - return ent->str; - } + struct typestring_table *ent; + + for (ent = table; ent->k1 > 0; ent++) { + if ((ent->k1 == key1) && + (ent->k2 == key2)) { + if (ent->new_appl) + current_appl_type = ent->new_appl; + return ent->str; } - return 0; + } + return 0; } struct typestring_table univ_types[] = { - { PRIM_BOOL, -1, "Boolean"}, - { PRIM_INT, -1, "Integer"}, - { PRIM_BITS, -1, "Bit String"}, - { PRIM_OCTS, -1, "Octet String"}, - { PRIM_NULL, -1, "Null"}, - { PRIM_OID, -1, "Object Identifier"}, - { PRIM_ODE, -1, "Object Descriptor"}, - { CONS_EXTN, -1, "External"}, - { PRIM_REAL, -1, "Real"}, - { PRIM_ENUM, -1, "Enumerated type"}, - { PRIM_ENCR, -1, "Encrypted"}, - { CONS_SEQ, -1, "Sequence/Sequence Of"}, - { CONS_SET, -1, "Set/Set Of"}, - { DEFN_NUMS, -1, "Numeric String"}, - { DEFN_PRTS, -1, "Printable String"}, - { DEFN_T61S, -1, "T.61 String"}, - { DEFN_VTXS, -1, "Videotex String"}, - { DEFN_IA5S, -1, "IA5 String"}, - { DEFN_UTCT, -1, "UTCTime"}, - { DEFN_GENT, -1, "Generalized Time"}, - { DEFN_GFXS, -1, "Graphics string (ISO2375)"}, - { DEFN_VISS, -1, "Visible string"}, - { DEFN_GENS, -1, "General string"}, - { DEFN_CHRS, -1, "Character string"}, - { -1, -1, 0} - }; + { PRIM_BOOL, -1, "Boolean"}, + { PRIM_INT, -1, "Integer"}, + { PRIM_BITS, -1, "Bit String"}, + { PRIM_OCTS, -1, "Octet String"}, + { PRIM_NULL, -1, "Null"}, + { PRIM_OID, -1, "Object Identifier"}, + { PRIM_ODE, -1, "Object Descriptor"}, + { CONS_EXTN, -1, "External"}, + { PRIM_REAL, -1, "Real"}, + { PRIM_ENUM, -1, "Enumerated type"}, + { PRIM_ENCR, -1, "Encrypted"}, + { CONS_SEQ, -1, "Sequence/Sequence Of"}, + { CONS_SET, -1, "Set/Set Of"}, + { DEFN_NUMS, -1, "Numeric String"}, + { DEFN_PRTS, -1, "Printable String"}, + { DEFN_T61S, -1, "T.61 String"}, + { DEFN_VTXS, -1, "Videotex String"}, + { DEFN_IA5S, -1, "IA5 String"}, + { DEFN_UTCT, -1, "UTCTime"}, + { DEFN_GENT, -1, "Generalized Time"}, + { DEFN_GFXS, -1, "Graphics string (ISO2375)"}, + { DEFN_VISS, -1, "Visible string"}, + { DEFN_GENS, -1, "General string"}, + { DEFN_CHRS, -1, "Character string"}, + { -1, -1, 0} +}; #ifdef KRB5 struct typestring_table krb5_types[] = { - { 1, -1, "Krb5 Ticket"}, - { 2, -1, "Krb5 Autenticator"}, - { 3, -1, "Krb5 Encrypted ticket part"}, - { 10, -1, "Krb5 AS-REQ packet"}, - { 11, -1, "Krb5 AS-REP packet"}, - { 12, -1, "Krb5 TGS-REQ packet"}, - { 13, -1, "Krb5 TGS-REP packet"}, - { 14, -1, "Krb5 AP-REQ packet"}, - { 15, -1, "Krb5 AP-REP packet"}, - { 20, -1, "Krb5 SAFE packet"}, - { 21, -1, "Krb5 PRIV packet"}, - { 22, -1, "Krb5 CRED packet"}, - { 30, -1, "Krb5 ERROR packet"}, - { 25, -1, "Krb5 Encrypted AS-REP part"}, - { 26, -1, "Krb5 Encrypted TGS-REP part"}, - { 27, -1, "Krb5 Encrypted AP-REP part"}, - { 28, -1, "Krb5 Encrypted PRIV part"}, - { 29, -1, "Krb5 Encrypted CRED part"}, - { -1, -1, 0} + { 1, -1, "Krb5 Ticket"}, + { 2, -1, "Krb5 Autenticator"}, + { 3, -1, "Krb5 Encrypted ticket part"}, + { 10, -1, "Krb5 AS-REQ packet"}, + { 11, -1, "Krb5 AS-REP packet"}, + { 12, -1, "Krb5 TGS-REQ packet"}, + { 13, -1, "Krb5 TGS-REP packet"}, + { 14, -1, "Krb5 AP-REQ packet"}, + { 15, -1, "Krb5 AP-REP packet"}, + { 20, -1, "Krb5 SAFE packet"}, + { 21, -1, "Krb5 PRIV packet"}, + { 22, -1, "Krb5 CRED packet"}, + { 30, -1, "Krb5 ERROR packet"}, + { 25, -1, "Krb5 Encrypted AS-REP part"}, + { 26, -1, "Krb5 Encrypted TGS-REP part"}, + { 27, -1, "Krb5 Encrypted AP-REP part"}, + { 28, -1, "Krb5 Encrypted PRIV part"}, + { 29, -1, "Krb5 Encrypted CRED part"}, + { -1, -1, 0} }; struct typestring_table krb5_fields[] = { - { 1000, 0, "name-type"}, /* PrincipalName */ - { 1000, 1, "name-string"}, - - { 1001, 0, "etype"}, /* Encrypted data */ - { 1001, 1, "kvno"}, - { 1001, 2, "cipher"}, - - { 1002, 0, "addr-type"}, /* HostAddress */ - { 1002, 1, "address"}, - - { 1003, 0, "addr-type"}, /* HostAddresses */ - { 1003, 1, "address"}, - - { 1004, 0, "ad-type"}, /* AuthorizationData */ - { 1004, 1, "ad-data"}, - - { 1005, 0, "keytype"}, /* EncryptionKey */ - { 1005, 1, "keyvalue"}, - - { 1006, 0, "cksumtype"}, /* Checksum */ - { 1006, 1, "checksum"}, - - { 1007, 0, "kdc-options"}, /* KDC-REQ-BODY */ - { 1007, 1, "cname", 1000}, - { 1007, 2, "realm"}, - { 1007, 3, "sname", 1000}, - { 1007, 4, "from"}, - { 1007, 5, "till"}, - { 1007, 6, "rtime"}, - { 1007, 7, "nonce"}, - { 1007, 8, "etype"}, - { 1007, 9, "addresses", 1003}, - { 1007, 10, "enc-authorization-data", 1001}, - { 1007, 11, "additional-tickets"}, - - { 1008, 1, "padata-type"}, /* PA-DATA */ - { 1008, 2, "pa-data"}, - - { 1009, 0, "user-data"}, /* KRB-SAFE-BODY */ - { 1009, 1, "timestamp"}, - { 1009, 2, "usec"}, - { 1009, 3, "seq-number"}, - { 1009, 4, "s-address", 1002}, - { 1009, 5, "r-address", 1002}, - - { 1010, 0, "lr-type"}, /* LastReq */ - { 1010, 1, "lr-value"}, - - { 1011, 0, "key", 1005}, /* KRB-CRED-INFO */ - { 1011, 1, "prealm"}, - { 1011, 2, "pname", 1000}, - { 1011, 3, "flags"}, - { 1011, 4, "authtime"}, - { 1011, 5, "startime"}, - { 1011, 6, "endtime"}, - { 1011, 7, "renew-till"}, - { 1011, 8, "srealm"}, - { 1011, 9, "sname", 1000}, - { 1011, 10, "caddr", 1002}, - - { 1, 0, "tkt-vno"}, /* Ticket */ - { 1, 1, "realm"}, - { 1, 2, "sname", 1000}, - { 1, 3, "tkt-enc-part", 1001}, - - { 2, 0, "authenticator-vno"}, /* Authenticator */ - { 2, 1, "crealm"}, - { 2, 2, "cname", 1000}, - { 2, 3, "cksum", 1006}, - { 2, 4, "cusec"}, - { 2, 5, "ctime"}, - { 2, 6, "subkey", 1005}, - { 2, 7, "seq-number"}, - { 2, 8, "authorization-data", 1004}, - - { 3, 0, "flags"}, /* EncTicketPart */ - { 3, 1, "key", 1005}, - { 3, 2, "crealm"}, - { 3, 3, "cname", 1000}, - { 3, 4, "transited"}, - { 3, 5, "authtime"}, - { 3, 6, "starttime"}, - { 3, 7, "endtime"}, - { 3, 8, "renew-till"}, - { 3, 9, "caddr", 1003}, - { 3, 10, "authorization-data", 1004}, - - { 10, 1, "pvno"}, /* AS-REQ */ - { 10, 2, "msg-type"}, - { 10, 3, "padata", 1008}, - { 10, 4, "req-body", 1007}, - - { 11, 0, "pvno"}, /* AS-REP */ - { 11, 1, "msg-type"}, - { 11, 2, "padata", 1008}, - { 11, 3, "crealm"}, - { 11, 4, "cname", 1000}, - { 11, 5, "ticket"}, - { 11, 6, "enc-part", 1001}, - - { 12, 1, "pvno"}, /* TGS-REQ */ - { 12, 2, "msg-type"}, - { 12, 3, "padata", 1008}, - { 12, 4, "req-body", 1007}, - - { 13, 0, "pvno"}, /* TGS-REP */ - { 13, 1, "msg-type"}, - { 13, 2, "padata", 1008}, - { 13, 3, "crealm"}, - { 13, 4, "cname", 1000}, - { 13, 5, "ticket"}, - { 13, 6, "enc-part", 1001}, - - { 14, 0, "pvno"}, /* AP-REQ */ - { 14, 1, "msg-type"}, - { 14, 2, "ap-options"}, - { 14, 3, "ticket"}, - { 14, 4, "authenticator", 1001}, - - { 15, 0, "pvno"}, /* AP-REP */ - { 15, 1, "msg-type"}, - { 15, 2, "enc-part", 1001}, + { 1000, 0, "name-type"}, /* PrincipalName */ + { 1000, 1, "name-string"}, + + { 1001, 0, "etype"}, /* Encrypted data */ + { 1001, 1, "kvno"}, + { 1001, 2, "cipher"}, + + { 1002, 0, "addr-type"}, /* HostAddress */ + { 1002, 1, "address"}, + + { 1003, 0, "addr-type"}, /* HostAddresses */ + { 1003, 1, "address"}, + + { 1004, 0, "ad-type"}, /* AuthorizationData */ + { 1004, 1, "ad-data"}, + + { 1005, 0, "keytype"}, /* EncryptionKey */ + { 1005, 1, "keyvalue"}, + + { 1006, 0, "cksumtype"}, /* Checksum */ + { 1006, 1, "checksum"}, + + { 1007, 0, "kdc-options"}, /* KDC-REQ-BODY */ + { 1007, 1, "cname", 1000}, + { 1007, 2, "realm"}, + { 1007, 3, "sname", 1000}, + { 1007, 4, "from"}, + { 1007, 5, "till"}, + { 1007, 6, "rtime"}, + { 1007, 7, "nonce"}, + { 1007, 8, "etype"}, + { 1007, 9, "addresses", 1003}, + { 1007, 10, "enc-authorization-data", 1001}, + { 1007, 11, "additional-tickets"}, + + { 1008, 1, "padata-type"}, /* PA-DATA */ + { 1008, 2, "pa-data"}, + + { 1009, 0, "user-data"}, /* KRB-SAFE-BODY */ + { 1009, 1, "timestamp"}, + { 1009, 2, "usec"}, + { 1009, 3, "seq-number"}, + { 1009, 4, "s-address", 1002}, + { 1009, 5, "r-address", 1002}, + + { 1010, 0, "lr-type"}, /* LastReq */ + { 1010, 1, "lr-value"}, + + { 1011, 0, "key", 1005}, /* KRB-CRED-INFO */ + { 1011, 1, "prealm"}, + { 1011, 2, "pname", 1000}, + { 1011, 3, "flags"}, + { 1011, 4, "authtime"}, + { 1011, 5, "startime"}, + { 1011, 6, "endtime"}, + { 1011, 7, "renew-till"}, + { 1011, 8, "srealm"}, + { 1011, 9, "sname", 1000}, + { 1011, 10, "caddr", 1002}, + + { 1, 0, "tkt-vno"}, /* Ticket */ + { 1, 1, "realm"}, + { 1, 2, "sname", 1000}, + { 1, 3, "tkt-enc-part", 1001}, + + { 2, 0, "authenticator-vno"}, /* Authenticator */ + { 2, 1, "crealm"}, + { 2, 2, "cname", 1000}, + { 2, 3, "cksum", 1006}, + { 2, 4, "cusec"}, + { 2, 5, "ctime"}, + { 2, 6, "subkey", 1005}, + { 2, 7, "seq-number"}, + { 2, 8, "authorization-data", 1004}, + + { 3, 0, "flags"}, /* EncTicketPart */ + { 3, 1, "key", 1005}, + { 3, 2, "crealm"}, + { 3, 3, "cname", 1000}, + { 3, 4, "transited"}, + { 3, 5, "authtime"}, + { 3, 6, "starttime"}, + { 3, 7, "endtime"}, + { 3, 8, "renew-till"}, + { 3, 9, "caddr", 1003}, + { 3, 10, "authorization-data", 1004}, + + { 10, 1, "pvno"}, /* AS-REQ */ + { 10, 2, "msg-type"}, + { 10, 3, "padata", 1008}, + { 10, 4, "req-body", 1007}, + + { 11, 0, "pvno"}, /* AS-REP */ + { 11, 1, "msg-type"}, + { 11, 2, "padata", 1008}, + { 11, 3, "crealm"}, + { 11, 4, "cname", 1000}, + { 11, 5, "ticket"}, + { 11, 6, "enc-part", 1001}, + + { 12, 1, "pvno"}, /* TGS-REQ */ + { 12, 2, "msg-type"}, + { 12, 3, "padata", 1008}, + { 12, 4, "req-body", 1007}, + + { 13, 0, "pvno"}, /* TGS-REP */ + { 13, 1, "msg-type"}, + { 13, 2, "padata", 1008}, + { 13, 3, "crealm"}, + { 13, 4, "cname", 1000}, + { 13, 5, "ticket"}, + { 13, 6, "enc-part", 1001}, + + { 14, 0, "pvno"}, /* AP-REQ */ + { 14, 1, "msg-type"}, + { 14, 2, "ap-options"}, + { 14, 3, "ticket"}, + { 14, 4, "authenticator", 1001}, + + { 15, 0, "pvno"}, /* AP-REP */ + { 15, 1, "msg-type"}, + { 15, 2, "enc-part", 1001}, - { 20, 0, "pvno"}, /* KRB-SAFE */ - { 20, 1, "msg-type"}, - { 20, 2, "safe-body", 1009}, - { 20, 3, "cksum", 1006}, - - { 21, 0, "pvno"}, /* KRB-PRIV */ - { 21, 1, "msg-type"}, - { 21, 2, "enc-part", 1001}, - - { 22, 0, "pvno"}, /* KRB-CRED */ - { 22, 1, "msg-type"}, - { 22, 2, "tickets"}, - { 22, 3, "enc-part", 1001}, - - { 25, 0, "key", 1005}, /* EncASRepPart */ - { 25, 1, "last-req", 1010}, - { 25, 2, "nonce"}, - { 25, 3, "key-expiration"}, - { 25, 4, "flags"}, - { 25, 5, "authtime"}, - { 25, 6, "starttime"}, - { 25, 7, "enddtime"}, - { 25, 8, "renew-till"}, - { 25, 9, "srealm"}, - { 25, 10, "sname", 1000}, - { 25, 11, "caddr", 1003}, + { 20, 0, "pvno"}, /* KRB-SAFE */ + { 20, 1, "msg-type"}, + { 20, 2, "safe-body", 1009}, + { 20, 3, "cksum", 1006}, + + { 21, 0, "pvno"}, /* KRB-PRIV */ + { 21, 1, "msg-type"}, + { 21, 2, "enc-part", 1001}, + + { 22, 0, "pvno"}, /* KRB-CRED */ + { 22, 1, "msg-type"}, + { 22, 2, "tickets"}, + { 22, 3, "enc-part", 1001}, + + { 25, 0, "key", 1005}, /* EncASRepPart */ + { 25, 1, "last-req", 1010}, + { 25, 2, "nonce"}, + { 25, 3, "key-expiration"}, + { 25, 4, "flags"}, + { 25, 5, "authtime"}, + { 25, 6, "starttime"}, + { 25, 7, "enddtime"}, + { 25, 8, "renew-till"}, + { 25, 9, "srealm"}, + { 25, 10, "sname", 1000}, + { 25, 11, "caddr", 1003}, - { 26, 0, "key", 1005}, /* EncTGSRepPart */ - { 26, 1, "last-req", 1010}, - { 26, 2, "nonce"}, - { 26, 3, "key-expiration"}, - { 26, 4, "flags"}, - { 26, 5, "authtime"}, - { 26, 6, "starttime"}, - { 26, 7, "enddtime"}, - { 26, 8, "renew-till"}, - { 26, 9, "srealm"}, - { 26, 10, "sname", 1000}, - { 26, 11, "caddr", 1003}, + { 26, 0, "key", 1005}, /* EncTGSRepPart */ + { 26, 1, "last-req", 1010}, + { 26, 2, "nonce"}, + { 26, 3, "key-expiration"}, + { 26, 4, "flags"}, + { 26, 5, "authtime"}, + { 26, 6, "starttime"}, + { 26, 7, "enddtime"}, + { 26, 8, "renew-till"}, + { 26, 9, "srealm"}, + { 26, 10, "sname", 1000}, + { 26, 11, "caddr", 1003}, - { 27, 0, "ctime"}, /* EncApRepPart */ - { 27, 1, "cusec"}, - { 27, 2, "subkey", 1005}, - { 27, 3, "seq-number"}, - - { 28, 0, "user-data"}, /* EncKrbPrivPart */ - { 28, 1, "timestamp"}, - { 28, 2, "usec"}, - { 28, 3, "seq-number"}, - { 28, 4, "s-address", 1002}, - { 28, 5, "r-address", 1002}, - - { 29, 0, "ticket-info", 1011}, /* EncKrbCredPart */ - { 29, 1, "nonce"}, - { 29, 2, "timestamp"}, - { 29, 3, "usec"}, - { 29, 4, "s-address", 1002}, - { 29, 5, "r-address", 1002}, - - { 30, 0, "pvno"}, /* KRB-ERROR */ - { 30, 1, "msg-type"}, - { 30, 2, "ctime"}, - { 30, 3, "cusec"}, - { 30, 4, "stime"}, - { 30, 5, "susec"}, - { 30, 6, "error-code"}, - { 30, 7, "crealm"}, - { 30, 8, "cname", 1000}, - { 30, 9, "realm"}, - { 30, 10, "sname", 1000}, - { 30, 11, "e-text"}, - { 30, 12, "e-data"}, + { 27, 0, "ctime"}, /* EncApRepPart */ + { 27, 1, "cusec"}, + { 27, 2, "subkey", 1005}, + { 27, 3, "seq-number"}, + + { 28, 0, "user-data"}, /* EncKrbPrivPart */ + { 28, 1, "timestamp"}, + { 28, 2, "usec"}, + { 28, 3, "seq-number"}, + { 28, 4, "s-address", 1002}, + { 28, 5, "r-address", 1002}, + + { 29, 0, "ticket-info", 1011}, /* EncKrbCredPart */ + { 29, 1, "nonce"}, + { 29, 2, "timestamp"}, + { 29, 3, "usec"}, + { 29, 4, "s-address", 1002}, + { 29, 5, "r-address", 1002}, + + { 30, 0, "pvno"}, /* KRB-ERROR */ + { 30, 1, "msg-type"}, + { 30, 2, "ctime"}, + { 30, 3, "cusec"}, + { 30, 4, "stime"}, + { 30, 5, "susec"}, + { 30, 6, "error-code"}, + { 30, 7, "crealm"}, + { 30, 8, "cname", 1000}, + { 30, 9, "realm"}, + { 30, 10, "sname", 1000}, + { 30, 11, "e-text"}, + { 30, 12, "e-data"}, - { -1, -1, 0} + { -1, -1, 0} }; #endif void print_tag_type(fp, eid, lev) - FILE *fp; - int eid; - int lev; + FILE *fp; + int eid; + int lev; { - int tag = eid & ID_TAG; - int do_space = 1; - char *str; + int tag = eid & ID_TAG; + int do_space = 1; + char *str; - fprintf(fp, "["); + fprintf(fp, "["); - switch(eid & ID_CLASS) { - case CLASS_UNIV: - if (print_types && print_skip_tagnum) - do_space = 0; - else - fprintf(fp, "UNIV %d", tag); - break; - case CLASS_APPL: - current_appl_type = tag; + switch(eid & ID_CLASS) { + case CLASS_UNIV: + if (print_types && print_skip_tagnum) + do_space = 0; + else + fprintf(fp, "UNIV %d", tag); + break; + case CLASS_APPL: + current_appl_type = tag; #ifdef KRB5 - if (print_krb5_types) { - str = lookup_typestring(krb5_types, tag, -1); - if (str) { - fputs(str, fp); - break; - } - } -#endif - fprintf(fp, "APPL %d", tag); + if (print_krb5_types) { + str = lookup_typestring(krb5_types, tag, -1); + if (str) { + fputs(str, fp); break; - case CLASS_CONT: -#ifdef KRB5 - if (print_krb5_types && current_appl_type) { - str = lookup_typestring(krb5_fields, - current_appl_type, tag); - if (str) { - fputs(str, fp); - break; - } - } + } + } #endif - if (print_skip_context && lev) - fprintf(fp, "%d", tag); - else - fprintf(fp, "CONT %d", tag); - break; - case CLASS_PRIV: - fprintf(fp, "PRIV %d", tag); + fprintf(fp, "APPL %d", tag); + break; + case CLASS_CONT: +#ifdef KRB5 + if (print_krb5_types && current_appl_type) { + str = lookup_typestring(krb5_fields, + current_appl_type, tag); + if (str) { + fputs(str, fp); break; + } } +#endif + if (print_skip_context && lev) + fprintf(fp, "%d", tag); + else + fprintf(fp, "CONT %d", tag); + break; + case CLASS_PRIV: + fprintf(fp, "PRIV %d", tag); + break; + } - if (print_types && ((eid & ID_CLASS) == CLASS_UNIV)) { - if (do_space) - fputs(" ", fp); - str = lookup_typestring(univ_types, eid & ID_TAG, -1); - if (str) - fputs(str, fp); - else - fprintf(fp, "UNIV %d???", eid & ID_TAG); - } + if (print_types && ((eid & ID_CLASS) == CLASS_UNIV)) { + if (do_space) + fputs(" ", fp); + str = lookup_typestring(univ_types, eid & ID_TAG, -1); + if (str) + fputs(str, fp); + else + fprintf(fp, "UNIV %d???", eid & ID_TAG); + } - fprintf(fp, "] "); + fprintf(fp, "] "); } diff --git a/src/tests/asn.1/utility.c b/src/tests/asn.1/utility.c index 19abfbdc33..c5715b0bb6 100644 --- a/src/tests/asn.1/utility.c +++ b/src/tests/asn.1/utility.c @@ -7,58 +7,58 @@ char hexchar (const unsigned int digit); asn1_error_code asn1_krb5_data_unparse(code, s) - const krb5_data * code; - char ** s; + const krb5_data * code; + char ** s; { - if(*s != NULL) free(*s); + if (*s != NULL) free(*s); - if(code==NULL){ - *s = (char*)calloc(strlen("<NULL>")+1, sizeof(char)); - if(*s == NULL) return ENOMEM; - strcpy(*s,"<NULL>"); - }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>"); - }else{ - unsigned int i; + if (code==NULL) { + *s = (char*)calloc(strlen("<NULL>")+1, sizeof(char)); + if (*s == NULL) return ENOMEM; + strcpy(*s,"<NULL>"); + } 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>"); + } else { + unsigned int i; - *s = (char*)calloc((size_t) 3*(code->length), sizeof(char)); - if(*s == NULL) return ENOMEM; - for(i = 0; i < code->length; i++){ - (*s)[3*i] = hexchar((unsigned char) (((code->data)[i]&0xF0)>>4)); - (*s)[3*i+1] = hexchar((unsigned char) ((code->data)[i]&0x0F)); - (*s)[3*i+2] = ' '; + *s = (char*)calloc((size_t) 3*(code->length), sizeof(char)); + if (*s == NULL) return ENOMEM; + for (i = 0; i < code->length; i++) { + (*s)[3*i] = hexchar((unsigned char) (((code->data)[i]&0xF0)>>4)); + (*s)[3*i+1] = hexchar((unsigned char) ((code->data)[i]&0x0F)); + (*s)[3*i+2] = ' '; + } + (*s)[3*(code->length)-1] = '\0'; } - (*s)[3*(code->length)-1] = '\0'; - } - return 0; + return 0; } char hexchar(digit) - const unsigned int digit; + const unsigned int digit; { - if(digit<=9) - return '0'+digit; - else if(digit<=15) - return 'A'+digit-10; - else - return 'X'; + if (digit<=9) + return '0'+digit; + else if (digit<=15) + return 'A'+digit-10; + else + return 'X'; } krb5_error_code krb5_data_parse(d, s) - krb5_data * d; - const char * s; + krb5_data * d; + const char * s; { - /*if(d->data != NULL){ - free(d->data); - d->length = 0; - }*/ - d->data = (char*)calloc(strlen(s),sizeof(char)); - if(d->data == NULL) return ENOMEM; - d->length = strlen(s); - memcpy(d->data,s,strlen(s)); - return 0; + /*if (d->data != NULL) { + free(d->data); + d->length = 0; + }*/ + d->data = (char*)calloc(strlen(s),sizeof(char)); + if (d->data == NULL) return ENOMEM; + d->length = strlen(s); + memcpy(d->data,s,strlen(s)); + return 0; } krb5_error_code krb5_data_hex_parse(krb5_data *d, const char *s) @@ -99,27 +99,27 @@ krb5_error_code krb5_data_hex_parse(krb5_data *d, const char *s) #if 0 void asn1buf_print(buf) - const asn1buf * buf; + const asn1buf * buf; { - asn1buf bufcopy; - char *s=NULL; - int length; - int i; + asn1buf bufcopy; + char *s=NULL; + int length; + int i; - bufcopy.base = bufcopy.next = buf->next; - bufcopy.bound = buf->bound; - length = asn1buf_len(&bufcopy); + bufcopy.base = bufcopy.next = buf->next; + bufcopy.bound = buf->bound; + length = asn1buf_len(&bufcopy); - s = calloc(3*length, sizeof(char)); - if(s == NULL) return; - for(i=0; i<length; i++){ - s[3*i] = hexchar(((bufcopy.base)[i]&0xF0)>>4); - s[3*i+1] = hexchar((bufcopy.base)[i]&0x0F); - s[3*i+2] = ' '; - } - s[3*length-1] = '\0'; + s = calloc(3*length, sizeof(char)); + if (s == NULL) return; + for (i=0; i<length; i++) { + s[3*i] = hexchar(((bufcopy.base)[i]&0xF0)>>4); + s[3*i+1] = hexchar((bufcopy.base)[i]&0x0F); + s[3*i+2] = ' '; + } + s[3*length-1] = '\0'; - printf("%s\n",s); - free(s); + printf("%s\n",s); + free(s); } #endif |