- null params are always expected to result in ccErrBadParam.
authorJustin Anderson <jander@mit.edu>
Mon, 1 Oct 2007 18:39:59 +0000 (18:39 +0000)
committerJustin Anderson <jander@mit.edu>
Mon, 1 Oct 2007 18:39:59 +0000 (18:39 +0000)
- 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
src/ccapi/test/test_ccapi_context.c

index 60e2789302b9aae89b5fcbdb60186ce11561755f..7059f98cc721ed5c50f4bacee067985f7bc5a8f1 100644 (file)
@@ -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); }
index 0e1309d826af82836c7d0e07527debbc58172fd3..ce4ea1dc00627b1f19c36ae11a24b441148a3f79 100644 (file)
@@ -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); }