From 7d2b2444f213d9f9b7560bad49bafff4fc46a526 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Thu, 9 Nov 1995 01:05:57 +0000 Subject: [PATCH] * krb5_encode_test.c (main): In case of an error in the encoding routines, exit. Otherwise, calling the print routines will often lead to a coredump. * ktest.c (ktest_make_sample_etype_info): Set etype.length to -1 to mean that the optional salt string is missing. (This is change in the convention used by the ASN.1 encoder and decoder for this ASN.1 structure.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7068 dc483132-0cff-0310-8789-dd5450dbe970 --- src/tests/asn.1/ChangeLog | 11 +++++++++++ src/tests/asn.1/krb5_encode_test.c | 30 ++++++++++++++++++++++++------ src/tests/asn.1/ktest.c | 2 +- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/tests/asn.1/ChangeLog b/src/tests/asn.1/ChangeLog index 837279e3b..b6f9bf11a 100644 --- a/src/tests/asn.1/ChangeLog +++ b/src/tests/asn.1/ChangeLog @@ -1,3 +1,14 @@ +Wed Nov 8 20:03:51 1995 Theodore Y. Ts'o + + * krb5_encode_test.c (main): In case of an error in the encoding + routines, exit. Otherwise, calling the print routines + will often lead to a coredump. + + * ktest.c (ktest_make_sample_etype_info): Set etype.length to -1 + to mean that the optional salt string is missing. (This + is change in the convention used by the ASN.1 encoder and + decoder for this ASN.1 structure.) + Tue Oct 31 21:30:28 1995 Theodore Y. Ts'o * krb5_decode_test.c (main): Add tests for diff --git a/src/tests/asn.1/krb5_encode_test.c b/src/tests/asn.1/krb5_encode_test.c index ca18a8812..6755ec85b 100644 --- a/src/tests/asn.1/krb5_encode_test.c +++ b/src/tests/asn.1/krb5_encode_test.c @@ -417,7 +417,10 @@ void main(argc, argv) 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,""); + if(retval) { + com_err("encoding authorization_data",retval,""); + exit(1); + } encoder_print_results(code, "authorization_data", ""); } @@ -444,7 +447,10 @@ void main(argc, argv) 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,""); + if(retval) { + com_err("encoding padata_sequence",retval,""); + exit(1); + } encoder_print_results(code, "padata_sequence", ""); } @@ -455,7 +461,10 @@ void main(argc, argv) 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,""); + if(retval) { + com_err("encoding padata_sequence(empty)",retval,""); + exit(1); + } encoder_print_results(code, "padata_sequence(empty)", ""); } @@ -479,19 +488,28 @@ void main(argc, argv) 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,""); + 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,""); + 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,""); + if(retval) { + com_err("encoding etype_info (no info)",retval,""); + exit(1); + } encoder_print_results(code, "etype_info (no info)", ""); free(info); diff --git a/src/tests/asn.1/ktest.c b/src/tests/asn.1/ktest.c index a995d1d99..5700760af 100644 --- a/src/tests/asn.1/ktest.c +++ b/src/tests/asn.1/ktest.c @@ -680,7 +680,7 @@ krb5_error_code ktest_make_sample_etype_info(p) info[i]->magic = KV5M_ETYPE_INFO_ENTRY; } free(info[1]->salt); - info[1]->length = 0; + info[1]->length = -1; info[1]->salt = 0; *p = info; return 0; -- 2.26.2