TargetVersion: 1.7
authorKevin Koch <kpkoch@mit.edu>
Wed, 11 Jul 2007 20:31:54 +0000 (20:31 +0000)
committerKevin Koch <kpkoch@mit.edu>
Wed, 11 Jul 2007 20:31:54 +0000 (20:31 +0000)
Component: krb5-libs
Ticket: new
Subj: Work on compiling the CCAPI test suite on Windows.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19692 dc483132-0cff-0310-8789-dd5450dbe970

src/ccapi/test/main.c
src/ccapi/test/test_ccapi_ccache.c
src/ccapi/test/test_ccapi_ccache.h
src/ccapi/test/test_ccapi_context.h
src/ccapi/test/test_ccapi_globals.h
src/ccapi/test/test_ccapi_iterators.c
src/ccapi/test/test_ccapi_iterators.h
src/ccapi/test/test_ccapi_log.h
src/ccapi/test/test_ccapi_util.h
src/ccapi/test/test_constants.c

index 94176f5e6df8a8f87cf401f3e641186bb505c496..eb8731c53f971f14bf6699622c719dbc963aba93 100644 (file)
@@ -1,11 +1,13 @@
 #include <stdio.h>
 #include <limits.h>
-#include <Kerberos/Kerberos.h>
+
+// #include <Kerberos.h>
 
 #include "test_ccapi_check.h"
 #include "test_ccapi_constants.h"
 #include "test_ccapi_context.h"
 #include "test_ccapi_ccache.h"
+#include "test_ccapi_iterators.h"
 
 int main (int argc, const char * argv[]) {
     
index cba481c75cfb3d2e6453b0b5dbb5972923856d99..10f038f55be84e99fdb81846b92b107186ddfbf7 100644 (file)
 
 
 int check_cc_ccache_release() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache = NULL;
+       
        BEGIN_TEST("cc_ccache_release");
        
        #ifndef cc_ccache_release
@@ -19,10 +23,6 @@ int check_cc_ccache_release() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache = NULL;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -46,22 +46,23 @@ int check_cc_ccache_release() {
 cc_int32 check_once_cc_ccache_release(cc_context_t context, cc_ccache_t ccache, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
        
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_release
-       
        cc_int32 possible_return_values[2] = {
                ccNoError, 
                ccErrInvalidCCache, 
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-       
+
        cc_string_t name = NULL;
        
        err = cc_ccache_get_name(ccache, &name);
        err = cc_ccache_release(ccache);
        ccache = NULL;
        
+    BEGIN_CHECK_ONCE(description);
+       
+       #ifdef cc_ccache_release
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+       
        // check returned error
        check_err(err, expected_err, possible_return_values);
        
@@ -85,6 +86,10 @@ cc_int32 check_once_cc_ccache_release(cc_context_t context, cc_ccache_t ccache,
 
 
 int check_cc_ccache_destroy() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache = NULL;
+       
        BEGIN_TEST("cc_ccache_destroy");
        
        #ifndef cc_ccache_destroy
@@ -92,10 +97,6 @@ int check_cc_ccache_destroy() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache = NULL;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -119,18 +120,19 @@ int check_cc_ccache_destroy() {
 cc_int32 check_once_cc_ccache_destroy(cc_context_t context, cc_ccache_t ccache, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
        
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_destroy
-       
        cc_int32 possible_return_values[2] = {
                ccNoError, 
                ccErrInvalidCCache, 
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-       
+
        cc_string_t name = NULL;
        
+    BEGIN_CHECK_ONCE(description);
+       
+       #ifdef cc_ccache_destroy
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+       
        err = cc_ccache_get_name(ccache, &name);
        err = cc_ccache_destroy(ccache);
        ccache = NULL;
@@ -158,6 +160,10 @@ cc_int32 check_once_cc_ccache_destroy(cc_context_t context, cc_ccache_t ccache,
 
 
 int check_cc_ccache_set_default() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache = NULL;
+       
        BEGIN_TEST("cc_ccache_set_default");
        
        #ifndef cc_ccache_set_default
@@ -165,10 +171,6 @@ int check_cc_ccache_set_default() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache = NULL;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        // try when it's the only ccache (already default)
@@ -224,21 +226,22 @@ int check_cc_ccache_set_default() {
 cc_int32 check_once_cc_ccache_set_default(cc_context_t context, cc_ccache_t ccache, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
        
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_set_default
-       
        cc_int32 possible_return_values[3] = {
                ccNoError, 
                ccErrInvalidCCache, 
                ccErrCCacheNotFound, 
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-       
+
        cc_ccache_t default_ccache = NULL;
        cc_string_t name = NULL;
        cc_string_t default_name = NULL;
        
+    BEGIN_CHECK_ONCE(description);
+       
+       #ifdef cc_ccache_set_default
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+       
        err = cc_ccache_set_default(ccache);
        // check returned error
        check_err(err, expected_err, possible_return_values);
@@ -276,6 +279,10 @@ cc_int32 check_once_cc_ccache_set_default(cc_context_t context, cc_ccache_t ccac
 
 
 int check_cc_ccache_get_credentials_version() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache = NULL;
+       
        BEGIN_TEST("cc_ccache_get_credentials_version");
        
        #ifndef cc_ccache_get_credentials_version
@@ -283,10 +290,6 @@ int check_cc_ccache_get_credentials_version() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache = NULL;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        // try one created with v5 creds
@@ -359,20 +362,21 @@ int check_cc_ccache_get_credentials_version() {
 cc_int32 check_once_cc_ccache_get_credentials_version(cc_ccache_t ccache, cc_uint32 expected_cred_vers, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
        
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_get_credentials_version
-       
        cc_int32 possible_return_values[4] = {
                ccNoError, 
                ccErrInvalidCCache, 
                ccErrBadParam, 
                ccErrCCacheNotFound, 
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-       
+
        cc_uint32 stored_cred_vers = 0;
        
+    BEGIN_CHECK_ONCE(description);
+       
+       #ifdef cc_ccache_get_credentials_version
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+       
        err = cc_ccache_get_credentials_version(ccache, &stored_cred_vers);
        
        // check returned error
@@ -394,6 +398,10 @@ cc_int32 check_once_cc_ccache_get_credentials_version(cc_ccache_t ccache, cc_uin
 
 
 int check_cc_ccache_get_name() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache = NULL;
+       
        BEGIN_TEST("cc_ccache_get_name");
        
        #ifndef cc_ccache_get_name
@@ -401,10 +409,6 @@ int check_cc_ccache_get_name() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache = NULL;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -461,20 +465,21 @@ int check_cc_ccache_get_name() {
 cc_int32 check_once_cc_ccache_get_name(cc_ccache_t ccache, const char *expected_name, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
        
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_get_name
-       
        cc_int32 possible_return_values[4] = {
                ccNoError, 
                ccErrInvalidCCache, 
                ccErrBadParam, 
                ccErrCCacheNotFound, 
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-       
+
        cc_string_t stored_name = NULL;
        
+    BEGIN_CHECK_ONCE(description);
+       
+       #ifdef cc_ccache_get_name
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+       
        if (expected_name == NULL) { // we want to try with a NULL param
                err = cc_ccache_get_name(ccache, NULL);
        }
@@ -501,8 +506,55 @@ cc_int32 check_once_cc_ccache_get_name(cc_ccache_t ccache, const char *expected_
 
 // ---------------------------------------------------------------------------
 
+cc_int32 check_once_cc_ccache_get_principal(cc_ccache_t ccache, cc_uint32 cred_vers, const char *expected_principal, cc_int32 expected_err, const char *description) {
+       cc_int32 err = ccNoError;
+       cc_string_t stored_principal = NULL;
+               
+       cc_int32 possible_return_values[6] = {
+               ccNoError, 
+               ccErrNoMem, 
+               ccErrBadCredentialsVersion, 
+               ccErrBadParam, 
+               ccErrInvalidCCache, 
+               ccErrCCacheNotFound, 
+       };
+
+    BEGIN_CHECK_ONCE(description);
+       
+       #ifdef cc_ccache_get_principal
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+       
+       if (expected_principal == NULL) { // we want to try with a NULL param
+               err = cc_ccache_get_principal(ccache, cred_vers, NULL);
+       }
+       else {
+               err = cc_ccache_get_principal(ccache, cred_vers, &stored_principal);
+       }
+       
+       // check returned error
+       check_err(err, expected_err, possible_return_values);
+       
+       if (!err) {
+               check_if(strcmp(stored_principal->data, expected_principal), "expected princ == \"%s\" stored princ == \"%s\"", expected_principal, stored_principal->data);
+       }
+       
+       if (stored_principal) { cc_string_release(stored_principal); }
+       
+       #endif /* cc_ccache_get_principal */
+       
+       END_CHECK_ONCE;
+       
+       return err;
+}
+
+// ---------------------------------------------------------------------------
 
 int check_cc_ccache_get_principal() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache = NULL;
+       
        BEGIN_TEST("cc_ccache_get_principal");
        
        #ifndef cc_ccache_get_principal
@@ -510,10 +562,6 @@ int check_cc_ccache_get_principal() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache = NULL;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -572,53 +620,13 @@ int check_cc_ccache_get_principal() {
        END_TEST_AND_RETURN     
 }
 
-cc_int32 check_once_cc_ccache_get_principal(cc_ccache_t ccache, cc_uint32 cred_vers, const char *expected_principal, cc_int32 expected_err, const char *description) {
-       cc_int32 err = ccNoError;
-       
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_get_principal
-       
-       cc_int32 possible_return_values[6] = {
-               ccNoError, 
-               ccErrNoMem, 
-               ccErrBadCredentialsVersion, 
-               ccErrBadParam, 
-               ccErrInvalidCCache, 
-               ccErrCCacheNotFound, 
-       };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-       
-       cc_string_t stored_principal = NULL;
-       
-       if (expected_principal == NULL) { // we want to try with a NULL param
-               err = cc_ccache_get_principal(ccache, cred_vers, NULL);
-       }
-       else {
-               err = cc_ccache_get_principal(ccache, cred_vers, &stored_principal);
-       }
-       
-       // check returned error
-       check_err(err, expected_err, possible_return_values);
-       
-       if (!err) {
-               check_if(strcmp(stored_principal->data, expected_principal), "expected princ == \"%s\" stored princ == \"%s\"", expected_principal, stored_principal->data);
-       }
-       
-       if (stored_principal) { cc_string_release(stored_principal); }
-       
-       #endif /* cc_ccache_get_principal */
-       
-       END_CHECK_ONCE;
-       
-       return err;
-}
-
-
 // ---------------------------------------------------------------------------
 
-
 int check_cc_ccache_set_principal() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache = NULL;
+       
        BEGIN_TEST("cc_ccache_set_principal");
        
        #ifndef cc_ccache_set_principal
@@ -626,10 +634,6 @@ int check_cc_ccache_set_principal() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache = NULL;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -742,11 +746,8 @@ int check_cc_ccache_set_principal() {
 
 cc_int32 check_once_cc_ccache_set_principal(cc_ccache_t ccache, cc_uint32 cred_vers, const char *in_principal, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
-       
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_set_principal
-       
+       cc_string_t stored_principal = NULL;
+               
        cc_int32 possible_return_values[6] = {
                ccNoError, 
                ccErrNoMem, 
@@ -755,9 +756,12 @@ cc_int32 check_once_cc_ccache_set_principal(cc_ccache_t ccache, cc_uint32 cred_v
                ccErrBadParam, 
                ccErrCCacheNotFound, 
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+
+    BEGIN_CHECK_ONCE(description);
        
-       cc_string_t stored_principal = NULL;
+       #ifdef cc_ccache_set_principal
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
        
        err = cc_ccache_set_principal(ccache, cred_vers, in_principal);
        
@@ -787,13 +791,6 @@ cc_int32 check_once_cc_ccache_set_principal(cc_ccache_t ccache, cc_uint32 cred_v
 
 
 int check_cc_ccache_store_credentials() {
-       BEGIN_TEST("cc_ccache_store_credentials");
-       
-       #ifndef cc_ccache_store_credentials
-       log_error("cc_ccache_store_credentials is not implemented yet");
-       failure_count++;
-       #else
-       
        cc_int32 err = 0;
        cc_context_t context = NULL;
        cc_ccache_t ccache = NULL;
@@ -801,6 +798,13 @@ int check_cc_ccache_store_credentials() {
        cc_credentials_union creds_union;
        cc_string_t name = NULL;
        
+       BEGIN_TEST("cc_ccache_store_credentials");
+       
+       #ifndef cc_ccache_store_credentials
+       log_error("cc_ccache_store_credentials is not implemented yet");
+       failure_count++;
+       #else
+       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -887,11 +891,9 @@ int check_cc_ccache_store_credentials() {
 
 cc_int32 check_once_cc_ccache_store_credentials(cc_ccache_t ccache, const cc_credentials_union *credentials, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
-       
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_store_credentials
-       
+       cc_credentials_iterator_t creds_iterator = NULL;
+       cc_credentials_t creds = NULL;
+               
        cc_int32 possible_return_values[5] = {
                ccNoError, 
                ccErrInvalidCCache, 
@@ -899,10 +901,12 @@ cc_int32 check_once_cc_ccache_store_credentials(cc_ccache_t ccache, const cc_cre
                ccErrBadCredentialsVersion, 
                ccErrCCacheNotFound, 
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+
+    BEGIN_CHECK_ONCE(description);
        
-       cc_credentials_iterator_t creds_iterator = NULL;
-       cc_credentials_t creds = NULL;
+       #ifdef cc_ccache_store_credentials
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
        
        err = cc_ccache_store_credentials(ccache, credentials);
                
@@ -942,13 +946,6 @@ cc_int32 check_once_cc_ccache_store_credentials(cc_ccache_t ccache, const cc_cre
 
 
 int check_cc_ccache_remove_credentials() {
-       BEGIN_TEST("cc_ccache_remove_credentials");
-       
-       #ifndef cc_ccache_remove_credentials
-       log_error("cc_ccache_remove_credentials is not implemented yet");
-       failure_count++;
-       #else
-       
        cc_int32 err = 0;
        cc_context_t context = NULL;
        cc_ccache_t ccache = NULL;
@@ -960,11 +957,18 @@ int check_cc_ccache_remove_credentials() {
        cc_string_t name = NULL;
        unsigned int i;
        
-       err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
+       BEGIN_TEST("cc_ccache_remove_credentials");
        
-       if (!err) {
-               err = destroy_all_ccaches(context);
-       }
+       #ifndef cc_ccache_remove_credentials
+       log_error("cc_ccache_remove_credentials is not implemented yet");
+       failure_count++;
+       #else
+       
+       err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
+       
+       if (!err) {
+               err = destroy_all_ccaches(context);
+       }
        
        if (!err) {
                err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
@@ -1038,11 +1042,9 @@ int check_cc_ccache_remove_credentials() {
 
 cc_int32 check_once_cc_ccache_remove_credentials(cc_ccache_t ccache, cc_credentials_t in_creds, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
-       
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_remove_credentials
-       
+       cc_credentials_iterator_t creds_iterator = NULL;
+       cc_credentials_t creds = NULL;
+               
        cc_int32 possible_return_values[5] = {
                ccNoError, 
                ccErrInvalidCCache, 
@@ -1050,10 +1052,12 @@ cc_int32 check_once_cc_ccache_remove_credentials(cc_ccache_t ccache, cc_credenti
                ccErrCredentialsNotFound, 
                ccErrCCacheNotFound,
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+
+    BEGIN_CHECK_ONCE(description);
        
-       cc_credentials_iterator_t creds_iterator = NULL;
-       cc_credentials_t creds = NULL;
+       #ifdef cc_ccache_remove_credentials
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
        
        err = cc_ccache_remove_credentials(ccache, in_creds);
                
@@ -1095,13 +1099,6 @@ cc_int32 check_once_cc_ccache_remove_credentials(cc_ccache_t ccache, cc_credenti
 
 
 int check_cc_ccache_new_credentials_iterator() {
-       BEGIN_TEST("cc_ccache_new_credentials_iterator");
-       
-       #ifndef cc_ccache_new_credentials_iterator
-       log_error("cc_ccache_new_credentials_iterator is not implemented yet");
-       failure_count++;
-       #else
-       
        cc_int32 err = 0;
        cc_context_t context = NULL;
        cc_ccache_t ccache = NULL;
@@ -1109,6 +1106,13 @@ int check_cc_ccache_new_credentials_iterator() {
        cc_credentials_iterator_t creds_iterator = NULL;
        cc_string_t name = NULL;
        
+       BEGIN_TEST("cc_ccache_new_credentials_iterator");
+       
+       #ifndef cc_ccache_new_credentials_iterator
+       log_error("cc_ccache_new_credentials_iterator is not implemented yet");
+       failure_count++;
+       #else
+       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -1170,16 +1174,17 @@ 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;
        
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_new_credentials_iterator
-       
        cc_int32 possible_return_values[4] = {
                ccNoError, 
                ccErrBadParam, 
                ccErrNoMem, 
                ccErrCCacheNotFound, 
        };
+
+    BEGIN_CHECK_ONCE(description);
+       
+       #ifdef cc_ccache_new_credentials_iterator
+       
        #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
        
        err = cc_ccache_new_credentials_iterator(ccache, iterator);
@@ -1197,15 +1202,47 @@ cc_int32 check_once_cc_ccache_new_credentials_iterator(cc_ccache_t ccache, cc_cr
 
 // ---------------------------------------------------------------------------
 
+cc_int32 check_once_cc_ccache_get_change_time(cc_ccache_t ccache, cc_time_t *last_time, cc_int32 expected_err, const char *description) {
+       cc_int32 err = ccNoError;
+       cc_time_t this_time = 0;
+               
+       cc_int32 possible_return_values[4] = {
+               ccNoError, 
+               ccErrInvalidCCache, 
+               ccErrBadParam, 
+               ccErrCCacheNotFound, 
+       };
 
-int check_cc_ccache_get_change_time() {
-       BEGIN_TEST("cc_ccache_get_change_time");
+    BEGIN_CHECK_ONCE(description);
        
-       #ifndef cc_ccache_get_change_time
-       log_error("cc_ccache_get_change_time is not implemented yet");
-       failure_count++;
-       #else
+       #ifdef cc_ccache_get_change_time
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
        
+       if (last_time == NULL) {
+               err = cc_ccache_get_change_time(ccache, NULL); // passed NULL to compare against because intention is actually to pass bad param instead
+       } else {
+               err = cc_ccache_get_change_time(ccache, &this_time);
+       }
+       
+       // check returned error
+       check_err(err, expected_err, possible_return_values);
+       
+       if ((!err) && last_time) {
+               check_if(this_time <= *last_time, "change time didn't increase when expected");
+               *last_time = this_time;
+       }
+               
+       #endif /* cc_ccache_get_change_time */
+       
+       END_CHECK_ONCE;
+       
+       return err;
+}
+
+// ---------------------------------------------------------------------------
+
+int check_cc_ccache_get_change_time() {
        cc_int32 err = 0;
        cc_context_t context = NULL;
        cc_ccache_t dummy_ccache = NULL;
@@ -1215,6 +1252,13 @@ int check_cc_ccache_get_change_time() {
        cc_credentials_t credentials = NULL;
        cc_time_t last_time = 0;
        
+    BEGIN_TEST("cc_ccache_get_change_time");
+       
+       #ifndef cc_ccache_get_change_time
+       log_error("cc_ccache_get_change_time is not implemented yet");
+       failure_count++;
+       #else
+       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -1322,56 +1366,51 @@ int check_cc_ccache_get_change_time() {
        END_TEST_AND_RETURN
 }
 
-cc_int32 check_once_cc_ccache_get_change_time(cc_ccache_t ccache, cc_time_t *last_time, cc_int32 expected_err, const char *description) {
+
+// ---------------------------------------------------------------------------
+
+cc_int32 check_once_cc_ccache_get_last_default_time(cc_ccache_t ccache, cc_time_t *last_time, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
-       
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_get_change_time
-       
-       cc_int32 possible_return_values[4] = {
+       cc_time_t this_time = 0;
+               
+       cc_int32 possible_return_values[5] = {
                ccNoError, 
                ccErrInvalidCCache, 
                ccErrBadParam, 
+               ccErrNeverDefault, 
                ccErrCCacheNotFound, 
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+
+    BEGIN_CHECK_ONCE(description);
        
-       cc_time_t this_time = 0;
+       #ifdef cc_ccache_get_last_default_time
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
        
        if (last_time == NULL) {
-               err = cc_ccache_get_change_time(ccache, NULL); // passed NULL to compare against because intention is actually to pass bad param instead
+               err = cc_ccache_get_last_default_time(ccache, NULL); // passed NULL to compare against because intention is actually to pass bad param instead
        } else {
-               err = cc_ccache_get_change_time(ccache, &this_time);
+               err = cc_ccache_get_last_default_time(ccache, &this_time);
        }
        
        // check returned error
        check_err(err, expected_err, possible_return_values);
        
-       if ((!err) && last_time) {
-               check_if(this_time <= *last_time, "change time didn't increase when expected");
+       if (!err && last_time) {
+               check_if(this_time > *last_time, "last default time isn't as expected");
                *last_time = this_time;
        }
                
-       #endif /* cc_ccache_get_change_time */
+       #endif /* cc_ccache_get_last_default_time */
        
        END_CHECK_ONCE;
        
        return err;
 }
 
-
 // ---------------------------------------------------------------------------
 
-
 int check_cc_ccache_get_last_default_time() {
-       BEGIN_TEST("cc_ccache_get_last_default_time");
-       
-       #ifndef cc_ccache_get_last_default_time
-       log_error("cc_ccache_get_last_default_time is not implemented yet");
-       failure_count++;
-       #else
-       
        cc_int32 err = 0;
        cc_context_t context = NULL;
        cc_ccache_t ccache_1 = NULL;
@@ -1380,6 +1419,13 @@ int check_cc_ccache_get_last_default_time() {
        cc_time_t last_time_2 = 0;
        cc_string_t name = NULL;
        
+       BEGIN_TEST("cc_ccache_get_last_default_time");
+       
+       #ifndef cc_ccache_get_last_default_time
+       log_error("cc_ccache_get_last_default_time is not implemented yet");
+       failure_count++;
+       #else
+       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -1454,57 +1500,9 @@ int check_cc_ccache_get_last_default_time() {
        END_TEST_AND_RETURN
 }
 
-cc_int32 check_once_cc_ccache_get_last_default_time(cc_ccache_t ccache, cc_time_t *last_time, cc_int32 expected_err, const char *description) {
-       cc_int32 err = ccNoError;
-       
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_get_last_default_time
-       
-       cc_int32 possible_return_values[5] = {
-               ccNoError, 
-               ccErrInvalidCCache, 
-               ccErrBadParam, 
-               ccErrNeverDefault, 
-               ccErrCCacheNotFound, 
-       };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-       
-       cc_time_t this_time = 0;
-       
-       if (last_time == NULL) {
-               err = cc_ccache_get_last_default_time(ccache, NULL); // passed NULL to compare against because intention is actually to pass bad param instead
-       } else {
-               err = cc_ccache_get_last_default_time(ccache, &this_time);
-       }
-       
-       // check returned error
-       check_err(err, expected_err, possible_return_values);
-       
-       if (!err && last_time) {
-               check_if(this_time > *last_time, "last default time isn't as expected");
-               *last_time = this_time;
-       }
-               
-       #endif /* cc_ccache_get_last_default_time */
-       
-       END_CHECK_ONCE;
-       
-       return err;
-}
-
-
 // ---------------------------------------------------------------------------
 
-
 int check_cc_ccache_move() {
-       BEGIN_TEST("cc_ccache_move");
-       
-       #ifndef cc_ccache_move
-       log_error("cc_ccache_move is not implemented yet");
-       failure_count++;
-       #else
-       
        cc_int32 err = 0;
        cc_context_t context = NULL;
        cc_ccache_t source = NULL;
@@ -1513,6 +1511,13 @@ int check_cc_ccache_move() {
        cc_credentials_union creds_union;
        unsigned int i = 0;
        
+       BEGIN_TEST("cc_ccache_move");
+       
+       #ifndef cc_ccache_move
+       log_error("cc_ccache_move is not implemented yet");
+       failure_count++;
+       #else
+       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -1569,26 +1574,26 @@ int check_cc_ccache_move() {
 
 cc_int32 check_once_cc_ccache_move(cc_ccache_t source, cc_ccache_t destination, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
+       cc_credentials_t dst_creds[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, };
+       cc_credentials_t creds = NULL;
+       cc_credentials_iterator_t cred_iterator = NULL;
+       unsigned int i = 0;
        
-       BEGIN_CHECK_ONCE(description);
-       
-       #ifdef cc_ccache_move
+       cc_string_t src_principal = NULL;
+       cc_string_t dst_principal = NULL;
        
        cc_int32 possible_return_values[3] = {
                ccNoError, 
                ccErrInvalidCCache, 
                ccErrCCacheNotFound,
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+
+    BEGIN_CHECK_ONCE(description);
        
-       cc_credentials_t dst_creds[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, };
-       cc_credentials_t creds = NULL;
-       cc_credentials_iterator_t cred_iterator = NULL;
-       unsigned int i = 0;
+       #ifdef cc_ccache_move
+       
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
        
-       cc_string_t src_principal = NULL;
-       cc_string_t dst_principal = NULL;
-
        if (destination) {
                // verify all of destination's credentials are no longer there (save a list and call remove_cred for each, expecting an err in response)        
                if (!err) {
@@ -1669,6 +1674,12 @@ cc_int32 check_once_cc_ccache_move(cc_ccache_t source, cc_ccache_t destination,
 // ---------------------------------------------------------------------------
 
 int check_cc_ccache_compare() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache_a = NULL;
+       cc_ccache_t ccache_b = NULL;
+       cc_uint32 equal = 0;
+       
        BEGIN_TEST("cc_ccache_compare");
        
        #ifndef cc_ccache_compare
@@ -1676,12 +1687,6 @@ int check_cc_ccache_compare() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache_a = NULL;
-       cc_ccache_t ccache_b = NULL;
-       cc_uint32 equal = 0;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
 
        if (!err) {
@@ -1726,10 +1731,7 @@ int check_cc_ccache_compare() {
 
 cc_int32 check_once_cc_ccache_compare(cc_ccache_t ccache, cc_ccache_t compare_to, cc_uint32 *equal, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
-
-       BEGIN_CHECK_ONCE(description);
-
-       #ifdef cc_ccache_compare
+       cc_uint32 actually_equal = 0;
        
        cc_int32 possible_return_values[4] = {
                ccNoError, 
@@ -1737,9 +1739,12 @@ cc_int32 check_once_cc_ccache_compare(cc_ccache_t ccache, cc_ccache_t compare_to
                ccErrBadParam, 
                ccErrServerUnavailable,
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+
+    BEGIN_CHECK_ONCE(description);
+
+       #ifdef cc_ccache_compare
        
-       cc_uint32 actually_equal = 0;
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
        
        if (equal) {
                actually_equal = *equal;
@@ -1768,6 +1773,11 @@ cc_int32 check_once_cc_ccache_compare(cc_ccache_t ccache, cc_ccache_t compare_to
 // ---------------------------------------------------------------------------
 
 int check_cc_ccache_get_kdc_time_offset() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache = NULL;
+       cc_time_t time_offset = 0;
+       
        BEGIN_TEST("cc_ccache_get_kdc_time_offset");
        
        #ifndef cc_ccache_get_kdc_time_offset
@@ -1775,11 +1785,6 @@ int check_cc_ccache_get_kdc_time_offset() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache = NULL;
-       cc_time_t time_offset = 0;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
 
        if (!err) {
@@ -1827,10 +1832,7 @@ int check_cc_ccache_get_kdc_time_offset() {
 
 cc_int32 check_once_cc_ccache_get_kdc_time_offset(cc_ccache_t ccache, cc_int32 credentials_version, cc_time_t *time_offset, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
-
-       BEGIN_CHECK_ONCE(description);
-
-       #ifdef cc_ccache_get_kdc_time_offset
+       cc_time_t expected_offset;
        
        cc_int32 possible_return_values[7] = {
                ccNoError, 
@@ -1841,9 +1843,12 @@ cc_int32 check_once_cc_ccache_get_kdc_time_offset(cc_ccache_t ccache, cc_int32 c
                ccErrServerUnavailable, 
                ccErrBadCredentialsVersion,     
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+
+    BEGIN_CHECK_ONCE(description);
+
+       #ifdef cc_ccache_get_kdc_time_offset
        
-       cc_time_t expected_offset;
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
        
        if (time_offset) {
                expected_offset = *time_offset;
@@ -1867,6 +1872,10 @@ cc_int32 check_once_cc_ccache_get_kdc_time_offset(cc_ccache_t ccache, cc_int32 c
 // ---------------------------------------------------------------------------
 
 int check_cc_ccache_set_kdc_time_offset() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache = NULL;
+       
        BEGIN_TEST("cc_ccache_set_kdc_time_offset");
        
        #ifndef cc_ccache_set_kdc_time_offset
@@ -1874,10 +1883,6 @@ int check_cc_ccache_set_kdc_time_offset() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache = NULL;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
 
        if (!err) {
@@ -1906,11 +1911,8 @@ int check_cc_ccache_set_kdc_time_offset() {
 
 cc_int32 check_once_cc_ccache_set_kdc_time_offset(cc_ccache_t ccache, cc_int32 credentials_version, cc_time_t time_offset, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
-
-       BEGIN_CHECK_ONCE(description);
-
-       #ifdef cc_ccache_set_kdc_time_offset
-       
+       cc_time_t stored_offset = 0;
+               
        cc_int32 possible_return_values[6] = {
                ccNoError, 
                ccErrCCacheNotFound, 
@@ -1919,10 +1921,13 @@ cc_int32 check_once_cc_ccache_set_kdc_time_offset(cc_ccache_t ccache, cc_int32 c
                ccErrServerUnavailable, 
                ccErrBadCredentialsVersion,
        };
+
+    BEGIN_CHECK_ONCE(description);
+
+       #ifdef cc_ccache_set_kdc_time_offset
+       
        #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
        
-       cc_time_t stored_offset = 0;
-               
        err = cc_ccache_set_kdc_time_offset(ccache, credentials_version, time_offset);
        
        // check returned error
@@ -1945,6 +1950,10 @@ cc_int32 check_once_cc_ccache_set_kdc_time_offset(cc_ccache_t ccache, cc_int32 c
 // ---------------------------------------------------------------------------
 
 int check_cc_ccache_clear_kdc_time_offset() {
+       cc_int32 err = 0;
+       cc_context_t context = NULL;
+       cc_ccache_t ccache = NULL;
+       
        BEGIN_TEST("cc_ccache_clear_kdc_time_offset");
        
        #ifndef cc_ccache_clear_kdc_time_offset
@@ -1952,10 +1961,6 @@ int check_cc_ccache_clear_kdc_time_offset() {
        failure_count++;
        #else
        
-       cc_int32 err = 0;
-       cc_context_t context = NULL;
-       cc_ccache_t ccache = NULL;
-       
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
 
        if (!err) {
@@ -1990,10 +1995,7 @@ int check_cc_ccache_clear_kdc_time_offset() {
 
 cc_int32 check_once_cc_ccache_clear_kdc_time_offset(cc_ccache_t ccache, cc_int32 credentials_version, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
-
-       BEGIN_CHECK_ONCE(description);
-
-       #ifdef cc_ccache_clear_kdc_time_offset
+       cc_time_t stored_offset = 0;
        
        cc_int32 possible_return_values[6] = {
                ccNoError, 
@@ -2003,10 +2005,12 @@ cc_int32 check_once_cc_ccache_clear_kdc_time_offset(cc_ccache_t ccache, cc_int32
                ccErrServerUnavailable, 
                ccErrBadCredentialsVersion,
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+       BEGIN_CHECK_ONCE(description);
 
-       cc_time_t stored_offset = 0;
+       #ifdef cc_ccache_clear_kdc_time_offset
        
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
+
        err = cc_ccache_clear_kdc_time_offset(ccache, credentials_version);
        
        // check returned error
index 31d00832f4de78b6f3635d3ce69b02576a53cc8e..c953557053a33404aaea7b2522850173a62859ca 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _TEST_CCAPI_CCACHE_H_
 #define _TEST_CCAPI_CCACHE_H_
 
-#include <Kerberos/CredentialsCache.h>
+#include <CredentialsCache.h>
 
 
 int check_cc_ccache_release();
index e347692ea55395281053163f0582b40cb9eca2f6..2c7ce1f68d1f46e5dac3230fc5c518e0b669e742 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _TEST_CCAPI_CONTEXT_H_
 #define _TEST_CCAPI_CONTEXT_H_
 
-#include <Kerberos/CredentialsCache.h>
+#include <CredentialsCache.h>
 
 int check_cc_initialize();
 cc_int32 check_once_cc_initialize(cc_context_t *out_context, cc_int32 in_version, cc_int32 *out_supported_version, char const **out_vendor, cc_int32 expected_err, const char *description);
index cebfb63d87b5f11fca1a118072ffca1d12a96b79..eba364a99ba0b876c256c333b68da3988dae4187 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _TEST_CCAPI_GLOBALS_H_
 #define _TEST_CCAPI_GLOBALS_H_
 
-#include <Kerberos/CredentialsCache.h>
+#include "CredentialsCache.h"
 
 /* GLOBALS */
 extern unsigned int total_failure_count;
index afc855687e25f58e4341a1a0299bf01bb510299c..2d02cee95ebf927e350571ca57c66b9b728bffed 100644 (file)
@@ -1,3 +1,5 @@
+#include "CredentialsCache.h"
+
 #include "test_ccapi_iterators.h"
 #include "test_ccapi_check.h"
 #include "test_ccapi_util.h"
@@ -6,13 +8,13 @@
 // ---------------------------------------------------------------------------
 
 int check_cc_ccache_iterator_next() {
-       BEGIN_TEST("cc_ccache_iterator_next");
-               
        cc_int32 err = 0;
        cc_context_t context = NULL;
        cc_ccache_t ccache = NULL;
        cc_ccache_iterator_t iterator = NULL;
        unsigned int i;
+
+    BEGIN_TEST("cc_ccache_iterator_next");
        
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
@@ -83,7 +85,7 @@ int check_cc_ccache_iterator_next() {
 cc_int32 check_once_cc_ccache_iterator_next(cc_ccache_iterator_t iterator, cc_uint32 expected_count, cc_int32 expected_err, const char *description) {
        cc_int32 err = ccNoError;
 
-       BEGIN_CHECK_ONCE(description);
+//     BEGIN_CHECK_ONCE(description);
 
        cc_int32 possible_return_values[6] = {
                ccNoError, 
@@ -115,7 +117,7 @@ cc_int32 check_once_cc_ccache_iterator_next(cc_ccache_iterator_t iterator, cc_ui
        
        check_if(actual_count != expected_count, "iterator didn't iterate over all ccaches");
 
-       END_CHECK_ONCE;
+//     END_CHECK_ONCE;
 
        return err;     
 }
@@ -124,8 +126,6 @@ cc_int32 check_once_cc_ccache_iterator_next(cc_ccache_iterator_t iterator, cc_ui
 // ---------------------------------------------------------------------------
 
 int check_cc_credentials_iterator_next() {
-       BEGIN_TEST("cc_credentials_iterator_next");
-               
        cc_int32 err = 0;
        cc_context_t context = NULL;
        cc_ccache_t ccache = NULL;
@@ -133,6 +133,8 @@ int check_cc_credentials_iterator_next() {
        cc_credentials_iterator_t iterator = NULL;
        unsigned int i;
        
+       BEGIN_TEST("cc_credentials_iterator_next");
+               
        err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
        
        if (!err) {
@@ -205,9 +207,9 @@ int check_cc_credentials_iterator_next() {
 }
 
 cc_int32 check_once_cc_credentials_iterator_next(cc_credentials_iterator_t iterator, cc_uint32 expected_count, cc_int32 expected_err, const char *description) {
-       cc_int32 err = ccNoError;
-
-       BEGIN_CHECK_ONCE(description);
+       cc_int32            err             = ccNoError;
+       cc_credentials_t    creds           = NULL;
+       cc_uint32           actual_count    = 0;
 
        cc_int32 possible_return_values[5] = {
                ccNoError, 
@@ -216,10 +218,10 @@ cc_int32 check_once_cc_credentials_iterator_next(cc_credentials_iterator_t itera
                ccErrNoMem, 
                ccErrInvalidCredentialsIterator,
        };
-       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
 
-       cc_credentials_t creds = NULL;
-       cc_uint32 actual_count = 0;
+    BEGIN_CHECK_ONCE(description);
+
+       #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
 
        while (!err) {
                err = cc_credentials_iterator_next(iterator, &creds);
index 4ce81982d4d5f55c940c6614a6a1860b5a923455..77719b940ce877ca266125ec6dfe01f7d2c33db5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _TEST_CCAPI_ITERATORS_H_
 #define _TEST_CCAPI_ITERATORS_H_
 
-#include <Kerberos/CredentialsCache.h>
+#include <CredentialsCache.h>
 
 int check_cc_ccache_iterator_next();
 cc_int32 check_once_cc_ccache_iterator_next(cc_ccache_iterator_t iterator, cc_uint32 expected_count, cc_int32 expected_err, const char *description);
index abb79d593aaab94176031e1d6e28bb3040623245..5c3cce010769539bdedb73de611396d97fcf3ee6 100644 (file)
@@ -9,7 +9,8 @@
                _log_error(__FILE__, __LINE__, format , ## __VA_ARGS__)
 
 void _log_error_v(const char *file, int line, const char *format, va_list ap);
-void _log_error(const char *file, int line, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
+// void _log_error(const char *file, int line, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
+void _log_error(const char *file, int line, const char *format, ...);
 
 void test_header(const char *msg);
 void test_footer(const char *msg, int err);
index 8c9e51e5154657a564f9d98817b407da1e498e6a..bf8251a1e559e27b64f2bb264b79fb4364312596 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _TEST_CCAPI_UTIL_H_
 #define _TEST_CCAPI_UTIL_H_
 
-#include <Kerberos/CredentialsCache.h>
+#include <CredentialsCache.h>
 #include "test_ccapi_globals.h"
 #include "test_ccapi_log.h"
 
index 9f52e74b4245cac66392c65491de2a54127119a9..4be473f633649edc45f32dbb31fa8b0946125d6c 100644 (file)
@@ -1,6 +1,6 @@
 #include <stdio.h>
 #include <limits.h>
-#include <Kerberos/Kerberos.h>
+// #include <Kerberos/Kerberos.h>
 
 #include "test_ccapi_check.h"
 #include "test_ccapi_constants.h"