From ca6be810869ab33553b4cd4f8b26b87f134f34b3 Mon Sep 17 00:00:00 2001 From: Justin Anderson Date: Mon, 1 Oct 2007 18:39:59 +0000 Subject: [PATCH] - null params are always expected to result in ccErrBadParam. - clarified some test descriptions ticket: 5459 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20036 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ccapi/test/test_ccapi_ccache.c | 28 ++++++++++++++++------------ src/ccapi/test/test_ccapi_context.c | 14 +++++++------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/ccapi/test/test_ccapi_ccache.c b/src/ccapi/test/test_ccapi_ccache.c index 60e278930..7059f98cc 100644 --- a/src/ccapi/test/test_ccapi_ccache.c +++ b/src/ccapi/test/test_ccapi_ccache.c @@ -831,7 +831,7 @@ int check_cc_ccache_store_credentials() { if (&creds_union) { release_v5_creds_union(&creds_union); } // try with bad params - check_once_cc_ccache_store_credentials(ccache, NULL, ccErrInvalidCredentials, "NULL creds param"); + check_once_cc_ccache_store_credentials(ccache, NULL, ccErrBadParam, "NULL creds param"); // invalid creds if (!err) { @@ -843,7 +843,7 @@ int check_cc_ccache_store_credentials() { free(creds_union.credentials.credentials_v5->client); creds_union.credentials.credentials_v5->client = NULL; } - check_once_cc_ccache_store_credentials(ccache, &creds_union, ccErrInvalidCredentials, "invalid creds (NULL client string)"); + check_once_cc_ccache_store_credentials(ccache, &creds_union, ccErrBadParam, "invalid creds (NULL client string)"); } if (&creds_union) { release_v5_creds_union(&creds_union); } @@ -898,8 +898,9 @@ cc_int32 check_once_cc_ccache_store_credentials(cc_ccache_t ccache, const cc_cre cc_credentials_iterator_t creds_iterator = NULL; cc_credentials_t creds = NULL; - cc_int32 possible_return_values[5] = { + cc_int32 possible_return_values[6] = { ccNoError, + ccErrBadParam, ccErrInvalidCCache, ccErrInvalidCredentials, ccErrBadCredentialsVersion, @@ -1006,10 +1007,10 @@ int check_cc_ccache_remove_credentials() { } // NULL param - check_once_cc_ccache_remove_credentials(ccache, NULL, ccErrInvalidCredentials, "NULL creds in param"); + check_once_cc_ccache_remove_credentials(ccache, NULL, ccErrBadParam, "NULL creds in param"); // non-existent creds (remove same one twice) - check_once_cc_ccache_remove_credentials(ccache, creds_array[0], ccErrCredentialsNotFound, "removed same creds twice"); + check_once_cc_ccache_remove_credentials(ccache, creds_array[0], ccErrInvalidCredentials, "removed same creds twice"); // non-existent ccache if (ccache) { @@ -1049,8 +1050,9 @@ cc_int32 check_once_cc_ccache_remove_credentials(cc_ccache_t ccache, cc_credenti cc_credentials_iterator_t creds_iterator = NULL; cc_credentials_t creds = NULL; - cc_int32 possible_return_values[5] = { + cc_int32 possible_return_values[6] = { ccNoError, + ccErrBadParam, ccErrInvalidCCache, ccErrInvalidCredentials, ccErrCredentialsNotFound, @@ -1156,7 +1158,7 @@ int check_cc_ccache_new_credentials_iterator() { } if (!err) { - check_once_cc_ccache_new_credentials_iterator(ccache, &creds_iterator, ccErrCCacheNotFound, "invalid ccache"); + check_once_cc_ccache_new_credentials_iterator(ccache, &creds_iterator, ccErrInvalidCCache, "invalid ccache"); } if (creds_iterator) { @@ -1178,11 +1180,12 @@ int check_cc_ccache_new_credentials_iterator() { cc_int32 check_once_cc_ccache_new_credentials_iterator(cc_ccache_t ccache, cc_credentials_iterator_t *iterator, cc_int32 expected_err, const char *description) { cc_int32 err = ccNoError; - cc_int32 possible_return_values[4] = { + cc_int32 possible_return_values[5] = { ccNoError, ccErrBadParam, ccErrNoMem, ccErrCCacheNotFound, + ccErrInvalidCCache, }; BEGIN_CHECK_ONCE(description); @@ -1489,7 +1492,7 @@ int check_cc_ccache_get_last_default_time() { } if (!err) { - check_once_cc_ccache_get_last_default_time(ccache_1, &last_time_1, ccErrCCacheNotFound, "destroyed ccache"); + check_once_cc_ccache_get_last_default_time(ccache_1, &last_time_1, ccErrInvalidCCache, "destroyed ccache"); } if (ccache_1) { cc_ccache_release(ccache_1); } @@ -1553,7 +1556,7 @@ int check_cc_ccache_move() { // NULL param if (!err) { - check_once_cc_ccache_move(destination, NULL, ccErrInvalidCCache, "NULL destination param"); + check_once_cc_ccache_move(destination, NULL, ccErrBadParam, "NULL destination param"); } // non-existent ccache @@ -1586,8 +1589,9 @@ cc_int32 check_once_cc_ccache_move(cc_ccache_t source, cc_ccache_t destination, cc_string_t src_principal = NULL; cc_string_t dst_principal = NULL; - cc_int32 possible_return_values[3] = { + cc_int32 possible_return_values[4] = { ccNoError, + ccErrBadParam, ccErrInvalidCCache, ccErrCCacheNotFound, }; @@ -1717,7 +1721,7 @@ int check_cc_ccache_compare() { } equal = 0; check_once_cc_ccache_compare(ccache_a, ccache_b, &equal, ccNoError, "compare different ccaches"); - check_once_cc_ccache_compare(ccache_a, NULL, &equal, ccErrInvalidCCache, "NULL compare_to ccache"); + check_once_cc_ccache_compare(ccache_a, NULL, &equal, ccErrBadParam, "NULL compare_to ccache"); check_once_cc_ccache_compare(ccache_a, ccache_b, NULL, ccErrBadParam, "NULL out param"); if (ccache_a) { cc_ccache_release(ccache_a); } diff --git a/src/ccapi/test/test_ccapi_context.c b/src/ccapi/test/test_ccapi_context.c index 0e1309d82..ce4ea1dc0 100644 --- a/src/ccapi/test/test_ccapi_context.c +++ b/src/ccapi/test/test_ccapi_context.c @@ -11,11 +11,11 @@ int check_cc_initialize() { BEGIN_TEST("cc_initialize"); // try every api_version - err = check_once_cc_initialize(&context, ccapi_version_2, NULL, NULL, 11, NULL); // err == CC_NOT_SUPP, not reflected in documentation rev 8 - err = check_once_cc_initialize(&context, ccapi_version_3, NULL, NULL, ccNoError, NULL); // !err - err = check_once_cc_initialize(&context, ccapi_version_4, NULL, NULL, ccNoError, NULL); // " - err = check_once_cc_initialize(&context, ccapi_version_5, NULL, NULL, ccNoError, NULL); // " - err = check_once_cc_initialize(&context, ccapi_version_6, NULL, NULL, ccNoError, NULL); // " + err = check_once_cc_initialize(&context, ccapi_version_2, NULL, NULL, 11, "cc_initialize with ccapi_version_2"); // err == CC_NOT_SUPP, not reflected in documentation rev 8 + err = check_once_cc_initialize(&context, ccapi_version_3, NULL, NULL, ccNoError, "cc_initialize with ccapi_version_3"); // !err + err = check_once_cc_initialize(&context, ccapi_version_4, NULL, NULL, ccNoError, "cc_initialize with ccapi_version_4"); // " + err = check_once_cc_initialize(&context, ccapi_version_5, NULL, NULL, ccNoError, "cc_initialize with ccapi_version_5"); // " + err = check_once_cc_initialize(&context, ccapi_version_6, NULL, NULL, ccNoError, "cc_initialize with ccapi_version_6"); // " // try bad api_version err = check_once_cc_initialize(&context, INT_MAX, NULL, NULL, ccErrBadAPIVersion, NULL); // err == ccErrBadAPIVersion @@ -665,7 +665,7 @@ int check_cc_context_create_ccache() { } // try bad parameters - err = check_once_cc_context_create_ccache(context, NULL, cc_credentials_v5, "foo@BAR.ORG", &ccache, ccErrBadName, "NULL name"); // NULL name + err = check_once_cc_context_create_ccache(context, NULL, cc_credentials_v5, "foo@BAR.ORG", &ccache, ccErrBadParam, "NULL name"); // NULL name err = check_once_cc_context_create_ccache(context, "name", cc_credentials_v4_v5, "foo@BAR.ORG", &ccache, ccErrBadCredentialsVersion, "invalid creds_vers"); // invalid creds_vers err = check_once_cc_context_create_ccache(context, "name", cc_credentials_v5, NULL, &ccache, ccErrBadParam, "NULL principal"); // NULL principal err = check_once_cc_context_create_ccache(context, "name", cc_credentials_v5, "foo@BAR.ORG", NULL, ccErrBadParam, "NULL ccache"); // NULL ccache @@ -1031,7 +1031,7 @@ int check_cc_context_compare(){ check_once_cc_context_compare(context_a, context_a, &equal, ccNoError, "valid params, same contexts"); check_once_cc_context_compare(context_a, context_b, &equal, ccNoError, "valid params, different contexts"); - check_once_cc_context_compare(context_a, NULL, &equal, ccErrInvalidContext, "NULL compare_to context"); + check_once_cc_context_compare(context_a, NULL, &equal, ccErrBadParam, "NULL compare_to context"); check_once_cc_context_compare(context_a, context_b, NULL, ccErrBadParam, "NULL out param"); if (context_a) { cc_context_release(context_a); } -- 2.26.2