aboutsummaryrefslogtreecommitdiff
path: root/src/ccapi
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>2009-10-31 00:48:38 +0000
committerTom Yu <tlyu@mit.edu>2009-10-31 00:48:38 +0000
commit02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b (patch)
tree61b9147863cd8be3eff63903dc36cae168254bd5 /src/ccapi
parent162ab371748cba0cc6f172419bd6e71fa04bb878 (diff)
downloadkrb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.zip
krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.gz
krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.bz2
make mark-cstyle
make reindent git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23100 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi')
-rw-r--r--src/ccapi/common/cci_array_internal.c111
-rw-r--r--src/ccapi/common/cci_cred_union.c462
-rw-r--r--src/ccapi/common/cci_debugging.c14
-rw-r--r--src/ccapi/common/cci_debugging.h6
-rw-r--r--src/ccapi/common/cci_identifier.c106
-rw-r--r--src/ccapi/common/cci_message.c76
-rw-r--r--src/ccapi/common/cci_message.h4
-rw-r--r--src/ccapi/common/cci_types.h26
-rw-r--r--src/ccapi/common/mac/cci_os_identifier.c25
-rw-r--r--src/ccapi/common/win/OldCC/ccutils.c8
-rw-r--r--src/ccapi/common/win/cci_os_debugging.c2
-rw-r--r--src/ccapi/common/win/tls.c14
-rw-r--r--src/ccapi/common/win/tls.h2
-rw-r--r--src/ccapi/common/win/win-utils.c6
-rw-r--r--src/ccapi/lib/ccapi_ccache.c264
-rw-r--r--src/ccapi/lib/ccapi_ccache_iterator.c94
-rw-r--r--src/ccapi/lib/ccapi_context.c295
-rw-r--r--src/ccapi/lib/ccapi_context.h8
-rw-r--r--src/ccapi/lib/ccapi_context_change_time.c64
-rw-r--r--src/ccapi/lib/ccapi_credentials.c58
-rw-r--r--src/ccapi/lib/ccapi_credentials_iterator.c82
-rw-r--r--src/ccapi/lib/ccapi_ipc.c22
-rw-r--r--src/ccapi/lib/ccapi_string.c46
-rw-r--r--src/ccapi/lib/ccapi_v2.c454
-rw-r--r--src/ccapi/lib/mac/ccapi_vector.c26
-rw-r--r--src/ccapi/lib/mac/ccapi_vector.h26
-rw-r--r--src/ccapi/lib/win/OldCC/ccapi.h64
-rw-r--r--src/ccapi/lib/win/ccs_reply_proc.c2
-rw-r--r--src/ccapi/lib/win/dllmain.h4
-rw-r--r--src/ccapi/server/ccs_array.c12
-rw-r--r--src/ccapi/server/ccs_cache_collection.c450
-rw-r--r--src/ccapi/server/ccs_cache_collection.h2
-rw-r--r--src/ccapi/server/ccs_callback.c92
-rw-r--r--src/ccapi/server/ccs_ccache.c485
-rw-r--r--src/ccapi/server/ccs_ccache.h2
-rw-r--r--src/ccapi/server/ccs_ccache_iterator.c53
-rw-r--r--src/ccapi/server/ccs_client.c94
-rw-r--r--src/ccapi/server/ccs_credentials.c50
-rw-r--r--src/ccapi/server/ccs_credentials_iterator.c49
-rw-r--r--src/ccapi/server/ccs_list.c16
-rw-r--r--src/ccapi/server/ccs_list_internal.c303
-rw-r--r--src/ccapi/server/ccs_lock.c110
-rw-r--r--src/ccapi/server/ccs_lock_state.c238
-rw-r--r--src/ccapi/server/ccs_lock_state.h6
-rw-r--r--src/ccapi/server/ccs_pipe.c2
-rw-r--r--src/ccapi/server/ccs_server.c148
-rw-r--r--src/ccapi/server/mac/ccs_os_notify.c28
-rw-r--r--src/ccapi/server/mac/ccs_os_pipe.c17
-rw-r--r--src/ccapi/server/mac/ccs_os_server.c16
-rw-r--r--src/ccapi/server/win/ccs_os_pipe.c5
-rw-r--r--src/ccapi/server/win/ccs_request_proc.c8
-rw-r--r--src/ccapi/server/win/ccs_win_pipe.c6
-rw-r--r--src/ccapi/server/win/ccs_win_pipe.h16
-rw-r--r--src/ccapi/server/win/workitem.h6
-rw-r--r--src/ccapi/test/main.c22
-rw-r--r--src/ccapi/test/pingtest.c10
-rw-r--r--src/ccapi/test/simple_lock_test.c12
-rw-r--r--src/ccapi/test/test_cc_ccache_compare.c2
-rw-r--r--src/ccapi/test/test_cc_ccache_destroy.c2
-rw-r--r--src/ccapi/test/test_cc_ccache_get_change_time.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_get_credentials_version.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_get_kdc_time_offset.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_get_last_default_time.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_get_name.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_get_principal.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_iterator_next.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_move.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_new_credentials_iterator.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_release.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_remove_credentials.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_set_default.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_set_kdc_time_offset.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_set_principal.c3
-rw-r--r--src/ccapi/test/test_cc_ccache_store_credentials.c3
-rw-r--r--src/ccapi/test/test_cc_close.c2
-rw-r--r--src/ccapi/test/test_cc_context_compare.c3
-rw-r--r--src/ccapi/test/test_cc_context_create_ccache.c3
-rw-r--r--src/ccapi/test/test_cc_context_create_default_ccache.c3
-rw-r--r--src/ccapi/test/test_cc_context_create_new_ccache.c3
-rw-r--r--src/ccapi/test/test_cc_context_get_change_time.c3
-rw-r--r--src/ccapi/test/test_cc_context_get_default_ccache_name.c3
-rw-r--r--src/ccapi/test/test_cc_context_new_ccache_iterator.c3
-rw-r--r--src/ccapi/test/test_cc_context_open_ccache.c3
-rw-r--r--src/ccapi/test/test_cc_context_open_default_ccache.c3
-rw-r--r--src/ccapi/test/test_cc_context_release.c2
-rw-r--r--src/ccapi/test/test_cc_create.c2
-rw-r--r--src/ccapi/test/test_cc_credentials_iterator_next.c2
-rw-r--r--src/ccapi/test/test_cc_destroy.c2
-rw-r--r--src/ccapi/test/test_cc_get_NC_info.c2
-rw-r--r--src/ccapi/test/test_cc_get_change_time.c2
-rw-r--r--src/ccapi/test/test_cc_get_cred_version.c2
-rw-r--r--src/ccapi/test/test_cc_get_name.c2
-rw-r--r--src/ccapi/test/test_cc_get_principal.c2
-rw-r--r--src/ccapi/test/test_cc_initialize.c2
-rw-r--r--src/ccapi/test/test_cc_open.c2
-rw-r--r--src/ccapi/test/test_cc_remove_cred.c2
-rw-r--r--src/ccapi/test/test_cc_seq_fetch_NCs_begin.c2
-rw-r--r--src/ccapi/test/test_cc_seq_fetch_NCs_next.c2
-rw-r--r--src/ccapi/test/test_cc_seq_fetch_creds_begin.c2
-rw-r--r--src/ccapi/test/test_cc_seq_fetch_creds_next.c2
-rw-r--r--src/ccapi/test/test_cc_set_principal.c2
-rw-r--r--src/ccapi/test/test_cc_shutdown.c2
-rw-r--r--src/ccapi/test/test_cc_store.c2
-rw-r--r--src/ccapi/test/test_ccapi_ccache.c989
-rw-r--r--src/ccapi/test/test_ccapi_check.c10
-rw-r--r--src/ccapi/test/test_ccapi_check.h12
-rw-r--r--src/ccapi/test/test_ccapi_constants.c14
-rw-r--r--src/ccapi/test/test_ccapi_context.c544
-rw-r--r--src/ccapi/test/test_ccapi_globals.c18
-rw-r--r--src/ccapi/test/test_ccapi_iterators.c68
-rw-r--r--src/ccapi/test/test_ccapi_log.c4
-rw-r--r--src/ccapi/test/test_ccapi_util.c34
-rw-r--r--src/ccapi/test/test_ccapi_v2.c907
-rw-r--r--src/ccapi/test/test_ccapi_v2.h22
-rw-r--r--src/ccapi/test/test_constants.c2
115 files changed, 3663 insertions, 3706 deletions
diff --git a/src/ccapi/common/cci_array_internal.c b/src/ccapi/common/cci_array_internal.c
index b5a0f69..6e8bf21 100644
--- a/src/ccapi/common/cci_array_internal.c
+++ b/src/ccapi/common/cci_array_internal.c
@@ -37,7 +37,7 @@ struct cci_array_d {
cci_array_object_t *objects;
cc_uint64 count;
cc_uint64 max_count;
-
+
cci_array_object_release_t object_release;
};
@@ -52,19 +52,19 @@ static cc_int32 cci_array_resize (cci_array_t io_array,
{
cc_int32 err = ccNoError;
cc_uint64 new_max_count = 0;
-
+
if (!io_array) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
cc_uint64 old_max_count = io_array->max_count;
new_max_count = io_array->max_count;
-
+
if (in_new_count > old_max_count) {
/* Expand the array */
while (in_new_count > new_max_count) {
new_max_count += CCI_ARRAY_COUNT_INCREMENT;
}
-
+
} else if ((in_new_count + CCI_ARRAY_COUNT_INCREMENT) < old_max_count) {
/* Shrink the array, but never drop below CC_ARRAY_COUNT_INCREMENT */
while ((in_new_count + CCI_ARRAY_COUNT_INCREMENT) < new_max_count &&
@@ -73,24 +73,24 @@ static cc_int32 cci_array_resize (cci_array_t io_array,
}
}
}
-
+
if (!err && io_array->max_count != new_max_count) {
cci_array_object_t *objects = io_array->objects;
-
+
if (!objects) {
objects = malloc (new_max_count * sizeof (*objects));
} else {
objects = realloc (objects, new_max_count * sizeof (*objects));
}
if (!objects) { err = cci_check_error (ccErrNoMem); }
-
+
if (!err) {
io_array->objects = objects;
io_array->max_count = new_max_count;
- }
+ }
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -104,27 +104,27 @@ cc_int32 cci_array_new (cci_array_t *out_array,
{
cc_int32 err = ccNoError;
cci_array_t array = NULL;
-
+
if (!out_array) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
array = malloc (sizeof (*array));
- if (array) {
+ if (array) {
*array = cci_array_initializer;
array->object_release = in_array_object_release;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
*out_array = array;
array = NULL;
}
-
+
cci_array_release (array);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -132,10 +132,10 @@ cc_int32 cci_array_new (cci_array_t *out_array,
cc_int32 cci_array_release (cci_array_t io_array)
{
cc_int32 err = ccNoError;
-
+
if (!err && io_array) {
cc_uint64 i;
-
+
if (io_array->object_release) {
for (i = 0; i < io_array->count; i++) {
io_array->object_release (io_array->objects[i]);
@@ -144,8 +144,8 @@ cc_int32 cci_array_release (cci_array_t io_array)
free (io_array->objects);
free (io_array);
}
-
- return err;
+
+ return err;
}
/* ------------------------------------------------------------------------ */
@@ -166,9 +166,9 @@ cci_array_object_t cci_array_object_at_index (cci_array_t io_array,
if (!io_array) {
cci_debug_printf ("%s() got NULL array", __FUNCTION__);
} else {
- cci_debug_printf ("%s() got bad index %lld (count = %lld)", __FUNCTION__,
+ cci_debug_printf ("%s() got bad index %lld (count = %lld)", __FUNCTION__,
in_position, io_array->count);
- }
+ }
return NULL;
}
}
@@ -176,7 +176,7 @@ cci_array_object_t cci_array_object_at_index (cci_array_t io_array,
#ifdef TARGET_OS_MAC
#pragma mark -
#endif
-
+
/* ------------------------------------------------------------------------ */
cc_int32 cci_array_insert (cci_array_t io_array,
@@ -184,34 +184,34 @@ cc_int32 cci_array_insert (cci_array_t io_array,
cc_uint64 in_position)
{
cc_int32 err = ccNoError;
-
+
if (!io_array ) { err = cci_check_error (ccErrBadParam); }
if (!in_object) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
/* Don't try to insert past the end and don't overflow the array */
if (in_position > io_array->count || io_array->count == UINT64_MAX) {
err = cci_check_error (ccErrBadParam);
}
}
-
+
if (!err) {
err = cci_array_resize (io_array, io_array->count + 1);
}
-
+
if (!err) {
cc_uint64 move_count = io_array->count - in_position;
-
+
if (move_count > 0) {
memmove (&io_array->objects[in_position + 1], &io_array->objects[in_position],
move_count * sizeof (*io_array->objects));
}
-
+
io_array->objects[in_position] = in_object;
io_array->count++;
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -220,29 +220,29 @@ cc_int32 cci_array_remove (cci_array_t io_array,
cc_uint64 in_position)
{
cc_int32 err = ccNoError;
-
+
if (!io_array) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err && in_position >= io_array->count) {
err = cci_check_error (ccErrBadParam);
}
-
+
if (!err) {
cc_uint64 move_count = io_array->count - in_position - 1;
cci_array_object_t object = io_array->objects[in_position];
-
+
if (move_count > 0) {
memmove (&io_array->objects[in_position], &io_array->objects[in_position + 1],
move_count * sizeof (*io_array->objects));
}
io_array->count--;
-
+
if (io_array->object_release) { io_array->object_release (object); }
-
+
cci_array_resize (io_array, io_array->count);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -253,14 +253,14 @@ cc_int32 cci_array_move (cci_array_t io_array,
cc_uint64 *out_real_new_position)
{
cc_int32 err = ccNoError;
-
+
if (!io_array ) { err = cci_check_error (ccErrBadParam); }
if (!out_real_new_position) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err && in_position >= io_array->count) {
err = cci_check_error (ccErrBadParam);
}
-
+
if (!err && in_new_position > io_array->count) {
err = cci_check_error (ccErrBadParam);
}
@@ -269,7 +269,7 @@ cc_int32 cci_array_move (cci_array_t io_array,
cc_uint64 move_to = 0;
cc_uint64 move_count = 0;
cc_uint64 real_new_position = 0;
-
+
if (in_position < in_new_position) {
/* shift right, making an empty space so the
* actual new position is one less in_new_position */
@@ -277,30 +277,30 @@ cc_int32 cci_array_move (cci_array_t io_array,
move_to = in_position;
move_count = in_new_position - in_position - 1;
real_new_position = in_new_position - 1;
-
+
} else if (in_position > in_new_position) {
/* shift left */
move_from = in_new_position;
move_to = in_new_position + 1;
- move_count = in_position - in_new_position;
+ move_count = in_position - in_new_position;
real_new_position = in_new_position;
-
+
} else {
real_new_position = in_new_position;
}
-
+
if (move_count > 0) {
cci_array_object_t object = io_array->objects[in_position];
-
- memmove (&io_array->objects[move_to], &io_array->objects[move_from],
+
+ memmove (&io_array->objects[move_to], &io_array->objects[move_from],
move_count * sizeof (*io_array->objects));
io_array->objects[real_new_position] = object;
}
-
+
*out_real_new_position = real_new_position;
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -311,4 +311,3 @@ cc_int32 cci_array_push_front (cci_array_t io_array,
cc_uint64 real_new_position = 0;
return cci_array_move (io_array, in_position, 0, &real_new_position);
}
-
diff --git a/src/ccapi/common/cci_cred_union.c b/src/ccapi/common/cci_cred_union.c
index 94aebdd..a2f8ca8 100644
--- a/src/ccapi/common/cci_cred_union.c
+++ b/src/ccapi/common/cci_cred_union.c
@@ -35,14 +35,14 @@
static cc_uint32 cci_credentials_v4_release (cc_credentials_v4_t *io_v4creds)
{
cc_int32 err = ccNoError;
-
+
if (!io_v4creds) { err = ccErrBadParam; }
-
+
if (!err) {
memset (io_v4creds, 0, sizeof (*io_v4creds));
free (io_v4creds);
}
-
+
return err;
}
@@ -53,78 +53,78 @@ static cc_uint32 cci_credentials_v4_read (cc_credentials_v4_t **out_v4creds,
{
cc_int32 err = ccNoError;
cc_credentials_v4_t *v4creds = NULL;
-
+
if (!io_stream ) { err = cci_check_error (ccErrBadParam); }
if (!out_v4creds) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
v4creds = malloc (sizeof (*v4creds));
if (!v4creds) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (io_stream, &v4creds->version);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, v4creds->principal, cc_v4_name_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, v4creds->principal_instance, cc_v4_instance_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, v4creds->service, cc_v4_name_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, v4creds->service_instance, cc_v4_instance_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, v4creds->realm, cc_v4_realm_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, v4creds->session_key, cc_v4_key_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_int32 (io_stream, &v4creds->kvno);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_int32 (io_stream, &v4creds->string_to_key_type);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (io_stream, &v4creds->issue_date);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_int32 (io_stream, &v4creds->lifetime);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (io_stream, &v4creds->address);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_int32 (io_stream, &v4creds->ticket_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read (io_stream, v4creds->ticket, cc_v4_ticket_size);
}
-
+
if (!err) {
*out_v4creds = v4creds;
v4creds = NULL;
}
-
+
free (v4creds);
-
+
return cci_check_error (err);
}
@@ -134,66 +134,66 @@ static cc_uint32 cci_credentials_v4_write (cc_credentials_v4_t *in_v4creds,
k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
-
+
if (!io_stream ) { err = cci_check_error (ccErrBadParam); }
if (!in_v4creds) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (io_stream, in_v4creds->version);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, in_v4creds->principal, cc_v4_name_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, in_v4creds->principal_instance, cc_v4_instance_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, in_v4creds->service, cc_v4_name_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, in_v4creds->service_instance, cc_v4_instance_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, in_v4creds->realm, cc_v4_realm_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, in_v4creds->session_key, cc_v4_key_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_int32 (io_stream, in_v4creds->kvno);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_int32 (io_stream, in_v4creds->string_to_key_type);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (io_stream, in_v4creds->issue_date);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_int32 (io_stream, in_v4creds->lifetime);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (io_stream, in_v4creds->address);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_int32 (io_stream, in_v4creds->ticket_size);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write (io_stream, in_v4creds->ticket, cc_v4_ticket_size);
}
-
+
return cci_check_error (err);
}
@@ -206,16 +206,16 @@ static cc_uint32 cci_credentials_v4_write (cc_credentials_v4_t *in_v4creds,
static cc_uint32 cci_cc_data_contents_release (cc_data *io_ccdata)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccdata && io_ccdata->data) { err = ccErrBadParam; }
-
+
if (!err) {
if (io_ccdata->length) {
memset (io_ccdata->data, 0, io_ccdata->length);
}
free (io_ccdata->data);
}
-
+
return err;
}
@@ -224,14 +224,14 @@ static cc_uint32 cci_cc_data_contents_release (cc_data *io_ccdata)
static cc_uint32 cci_cc_data_release (cc_data *io_ccdata)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccdata) { err = ccErrBadParam; }
-
+
if (!err) {
cci_cc_data_contents_release (io_ccdata);
free (io_ccdata);
}
-
+
return err;
}
@@ -244,18 +244,18 @@ static cc_uint32 cci_cc_data_read (cc_data *io_ccdata,
cc_uint32 type = 0;
cc_uint32 length = 0;
char *data = NULL;
-
+
if (!io_stream) { err = cci_check_error (ccErrBadParam); }
if (!io_ccdata) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (io_stream, &type);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (io_stream, &length);
}
-
+
if (!err && length > 0) {
data = malloc (length);
if (!data) { err = cci_check_error (ccErrNoMem); }
@@ -264,16 +264,16 @@ static cc_uint32 cci_cc_data_read (cc_data *io_ccdata,
err = krb5int_ipc_stream_read (io_stream, data, length);
}
}
-
+
if (!err) {
io_ccdata->type = type;
io_ccdata->length = length;
io_ccdata->data = data;
data = NULL;
}
-
+
free (data);
-
+
return cci_check_error (err);
}
@@ -283,22 +283,22 @@ static cc_uint32 cci_cc_data_write (cc_data *in_ccdata,
k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
-
+
if (!io_stream) { err = cci_check_error (ccErrBadParam); }
if (!in_ccdata) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (io_stream, in_ccdata->type);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (io_stream, in_ccdata->length);
}
-
+
if (!err && in_ccdata->length > 0) {
err = krb5int_ipc_stream_write (io_stream, in_ccdata->data, in_ccdata->length);
}
-
+
return cci_check_error (err);
}
@@ -311,18 +311,18 @@ static cc_uint32 cci_cc_data_write (cc_data *in_ccdata,
static cc_uint32 cci_cc_data_array_release (cc_data **io_ccdata_array)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccdata_array) { err = ccErrBadParam; }
-
+
if (!err) {
cc_uint32 i;
-
+
for (i = 0; io_ccdata_array && io_ccdata_array[i]; i++) {
cci_cc_data_release (io_ccdata_array[i]);
}
- free (io_ccdata_array);
+ free (io_ccdata_array);
}
-
+
return err;
}
@@ -335,41 +335,41 @@ static cc_uint32 cci_cc_data_array_read (cc_data ***io_ccdata_array,
cc_uint32 count = 0;
cc_data **array = NULL;
cc_uint32 i;
-
+
if (!io_stream ) { err = cci_check_error (ccErrBadParam); }
if (!io_ccdata_array) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (io_stream, &count);
}
-
+
if (!err && count > 0) {
array = malloc ((count + 1) * sizeof (*array));
- if (array) {
+ if (array) {
for (i = 0; i <= count; i++) { array[i] = NULL; }
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
for (i = 0; !err && i < count; i++) {
array[i] = malloc (sizeof (cc_data));
if (!array[i]) { err = cci_check_error (ccErrNoMem); }
-
+
if (!err) {
err = cci_cc_data_read (array[i], io_stream);
}
}
}
-
+
if (!err) {
*io_ccdata_array = array;
array = NULL;
}
-
+
cci_cc_data_array_release (array);
-
+
return cci_check_error (err);
}
@@ -380,24 +380,24 @@ static cc_uint32 cci_cc_data_array_write (cc_data **in_ccdata_array,
{
cc_int32 err = ccNoError;
cc_uint32 count = 0;
-
+
if (!io_stream) { err = cci_check_error (ccErrBadParam); }
/* in_ccdata_array may be NULL */
-
+
if (!err) {
for (count = 0; in_ccdata_array && in_ccdata_array[count]; count++);
-
+
err = krb5int_ipc_stream_write_uint32 (io_stream, count);
}
-
+
if (!err) {
cc_uint32 i;
-
+
for (i = 0; !err && i < count; i++) {
err = cci_cc_data_write (in_ccdata_array[i], io_stream);
- }
+ }
}
-
+
return cci_check_error (err);
}
@@ -411,7 +411,7 @@ cc_credentials_v5_t cci_credentials_v5_initializer = {
NULL,
NULL,
{ 0, 0, NULL },
- 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
NULL,
{ 0, 0, NULL },
{ 0, 0, NULL },
@@ -423,9 +423,9 @@ cc_credentials_v5_t cci_credentials_v5_initializer = {
static cc_uint32 cci_credentials_v5_release (cc_credentials_v5_t *io_v5creds)
{
cc_int32 err = ccNoError;
-
+
if (!io_v5creds) { err = ccErrBadParam; }
-
+
if (!err) {
free (io_v5creds->client);
free (io_v5creds->server);
@@ -434,9 +434,9 @@ static cc_uint32 cci_credentials_v5_release (cc_credentials_v5_t *io_v5creds)
cci_cc_data_contents_release (&io_v5creds->ticket);
cci_cc_data_contents_release (&io_v5creds->second_ticket);
cci_cc_data_array_release (io_v5creds->authdata);
- free (io_v5creds);
+ free (io_v5creds);
}
-
+
return err;
}
@@ -447,78 +447,78 @@ static cc_uint32 cci_credentials_v5_read (cc_credentials_v5_t **out_v5creds,
{
cc_int32 err = ccNoError;
cc_credentials_v5_t *v5creds = NULL;
-
+
if (!io_stream ) { err = cci_check_error (ccErrBadParam); }
if (!out_v5creds) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
v5creds = malloc (sizeof (*v5creds));
- if (v5creds) {
+ if (v5creds) {
*v5creds = cci_credentials_v5_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (io_stream, &v5creds->client);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (io_stream, &v5creds->server);
}
-
+
if (!err) {
err = cci_cc_data_read (&v5creds->keyblock, io_stream);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (io_stream, &v5creds->authtime);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (io_stream, &v5creds->starttime);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (io_stream, &v5creds->endtime);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (io_stream, &v5creds->renew_till);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (io_stream, &v5creds->is_skey);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (io_stream, &v5creds->ticket_flags);
}
-
+
if (!err) {
err = cci_cc_data_array_read (&v5creds->addresses, io_stream);
}
-
+
if (!err) {
err = cci_cc_data_read (&v5creds->ticket, io_stream);
}
-
+
if (!err) {
err = cci_cc_data_read (&v5creds->second_ticket, io_stream);
}
-
+
if (!err) {
err = cci_cc_data_array_read (&v5creds->authdata, io_stream);
}
-
+
if (!err) {
*out_v5creds = v5creds;
v5creds = NULL;
}
-
+
cci_credentials_v5_release (v5creds);
-
+
return cci_check_error (err);
}
@@ -528,63 +528,63 @@ static cc_uint32 cci_credentials_v5_write (cc_credentials_v5_t *in_v5creds,
k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
-
+
if (!io_stream ) { err = cci_check_error (ccErrBadParam); }
if (!in_v5creds) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (io_stream, in_v5creds->client);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (io_stream, in_v5creds->server);
}
-
+
if (!err) {
err = cci_cc_data_write (&in_v5creds->keyblock, io_stream);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (io_stream, in_v5creds->authtime);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (io_stream, in_v5creds->starttime);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (io_stream, in_v5creds->endtime);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (io_stream, in_v5creds->renew_till);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (io_stream, in_v5creds->is_skey);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (io_stream, in_v5creds->ticket_flags);
}
-
+
if (!err) {
err = cci_cc_data_array_write (in_v5creds->addresses, io_stream);
}
-
+
if (!err) {
err = cci_cc_data_write (&in_v5creds->ticket, io_stream);
}
-
+
if (!err) {
err = cci_cc_data_write (&in_v5creds->second_ticket, io_stream);
}
-
+
if (!err) {
err = cci_cc_data_array_write (in_v5creds->authdata, io_stream);
}
-
-
+
+
return cci_check_error (err);
}
@@ -597,9 +597,9 @@ static cc_uint32 cci_credentials_v5_write (cc_credentials_v5_t *in_v5creds,
cc_uint32 cci_credentials_union_release (cc_credentials_union *io_cred_union)
{
cc_int32 err = ccNoError;
-
+
if (!io_cred_union) { err = ccErrBadParam; }
-
+
if (!err) {
if (io_cred_union->version == cc_credentials_v4) {
cci_credentials_v4_release (io_cred_union->credentials.credentials_v4);
@@ -608,7 +608,7 @@ cc_uint32 cci_credentials_union_release (cc_credentials_union *io_cred_union)
}
free (io_cred_union);
}
-
+
return err;
}
@@ -619,41 +619,41 @@ cc_uint32 cci_credentials_union_read (cc_credentials_union **out_credentials_uni
{
cc_int32 err = ccNoError;
cc_credentials_union *credentials_union = NULL;
-
+
if (!io_stream ) { err = cci_check_error (ccErrBadParam); }
if (!out_credentials_union) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
credentials_union = calloc (1, sizeof (*credentials_union));
if (!credentials_union) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (io_stream, &credentials_union->version);
}
-
+
if (!err) {
if (credentials_union->version == cc_credentials_v4) {
err = cci_credentials_v4_read (&credentials_union->credentials.credentials_v4,
io_stream);
-
+
} else if (credentials_union->version == cc_credentials_v5) {
err = cci_credentials_v5_read (&credentials_union->credentials.credentials_v5,
io_stream);
-
-
+
+
} else {
err = ccErrBadCredentialsVersion;
}
}
-
+
if (!err) {
*out_credentials_union = credentials_union;
credentials_union = NULL;
}
-
+
if (credentials_union) { cci_credentials_union_release (credentials_union); }
-
+
return cci_check_error (err);
}
@@ -663,29 +663,29 @@ cc_uint32 cci_credentials_union_write (const cc_credentials_union *in_credential
k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
-
+
if (!io_stream ) { err = cci_check_error (ccErrBadParam); }
if (!in_credentials_union) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (io_stream, in_credentials_union->version);
}
-
+
if (!err) {
if (in_credentials_union->version == cc_credentials_v4) {
err = cci_credentials_v4_write (in_credentials_union->credentials.credentials_v4,
io_stream);
-
+
} else if (in_credentials_union->version == cc_credentials_v5) {
err = cci_credentials_v5_write (in_credentials_union->credentials.credentials_v5,
io_stream);
-
+
} else {
err = ccErrBadCredentialsVersion;
}
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -699,7 +699,7 @@ cc_credentials_v5_compat cci_credentials_v5_compat_initializer = {
NULL,
NULL,
{ 0, 0, NULL },
- 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
NULL,
{ 0, 0, NULL },
{ 0, 0, NULL },
@@ -711,14 +711,14 @@ cc_credentials_v5_compat cci_credentials_v5_compat_initializer = {
cc_uint32 cci_cred_union_release (cred_union *io_cred_union)
{
cc_int32 err = ccNoError;
-
+
if (!io_cred_union) { err = ccErrBadParam; }
-
+
if (!err) {
if (io_cred_union->cred_type == CC_CRED_V4) {
memset (io_cred_union->cred.pV4Cred, 0, sizeof (cc_credentials_v4_compat));
free (io_cred_union->cred.pV4Cred);
-
+
} else if (io_cred_union->cred_type == CC_CRED_V5) {
free (io_cred_union->cred.pV5Cred->client);
free (io_cred_union->cred.pV5Cred->server);
@@ -727,11 +727,11 @@ cc_uint32 cci_cred_union_release (cred_union *io_cred_union)
cci_cc_data_contents_release (&io_cred_union->cred.pV5Cred->ticket);
cci_cc_data_contents_release (&io_cred_union->cred.pV5Cred->second_ticket);
cci_cc_data_array_release (io_cred_union->cred.pV5Cred->authdata);
- free (io_cred_union->cred.pV5Cred);
+ free (io_cred_union->cred.pV5Cred);
}
free (io_cred_union);
}
-
+
return err;
}
@@ -742,28 +742,28 @@ static cc_uint32 cci_cc_data_copy_contents (cc_data *io_ccdata,
{
cc_int32 err = ccNoError;
char *data = NULL;
-
+
if (!io_ccdata) { err = cci_check_error (ccErrBadParam); }
if (!in_ccdata) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err && in_ccdata->length > 0) {
data = malloc (in_ccdata->length);
if (data) {
memcpy (data, in_ccdata->data, in_ccdata->length);
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
io_ccdata->type = in_ccdata->type;
io_ccdata->length = in_ccdata->length;
io_ccdata->data = data;
data = NULL;
}
-
+
free (data);
-
+
return cci_check_error (err);
}
@@ -776,40 +776,40 @@ static cc_uint32 cci_cc_data_array_copy (cc_data ***io_ccdata_array,
cc_uint32 count = 0;
cc_data **array = NULL;
cc_uint32 i;
-
+
if (!io_ccdata_array) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
for (count = 0; in_ccdata_array && in_ccdata_array[count]; count++);
}
-
+
if (!err && count > 0) {
array = malloc ((count + 1) * sizeof (*array));
- if (array) {
+ if (array) {
for (i = 0; i <= count; i++) { array[i] = NULL; }
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
for (i = 0; !err && i < count; i++) {
array[i] = malloc (sizeof (cc_data));
if (!array[i]) { err = cci_check_error (ccErrNoMem); }
-
+
if (!err) {
err = cci_cc_data_copy_contents (array[i], in_ccdata_array[i]);
}
}
}
-
+
if (!err) {
*io_ccdata_array = array;
array = NULL;
}
-
+
cci_cc_data_array_release (array);
-
+
return cci_check_error (err);
}
@@ -820,28 +820,28 @@ cc_uint32 cci_credentials_union_to_cred_union (const cc_credentials_union *in_c
{
cc_int32 err = ccNoError;
cred_union *compat_cred_union = NULL;
-
+
if (!in_credentials_union) { err = cci_check_error (ccErrBadParam); }
if (!out_cred_union ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
compat_cred_union = calloc (1, sizeof (*compat_cred_union));
if (!compat_cred_union) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
if (in_credentials_union->version == cc_credentials_v4) {
cc_credentials_v4_compat *compat_v4creds = NULL;
-
+
compat_v4creds = malloc (sizeof (*compat_v4creds));
if (!compat_v4creds) { err = cci_check_error (ccErrNoMem); }
-
+
if (!err) {
cc_credentials_v4_t *v4creds = in_credentials_union->credentials.credentials_v4;
-
+
compat_cred_union->cred_type = CC_CRED_V4;
compat_cred_union->cred.pV4Cred = compat_v4creds;
-
+
compat_v4creds->kversion = v4creds->version;
strncpy (compat_v4creds->principal, v4creds->principal, KRB_NAME_SZ+1);
strncpy (compat_v4creds->principal_instance, v4creds->principal_instance, KRB_INSTANCE_SZ+1);
@@ -858,60 +858,60 @@ cc_uint32 cci_credentials_union_to_cred_union (const cc_credentials_union *in_c
memcpy (compat_v4creds->ticket, v4creds->ticket, MAX_V4_CRED_LEN);
compat_v4creds->oops = 0;
}
-
+
} else if (in_credentials_union->version == cc_credentials_v5) {
cc_credentials_v5_t *v5creds = in_credentials_union->credentials.credentials_v5;
cc_credentials_v5_compat *compat_v5creds = NULL;
-
+
compat_v5creds = malloc (sizeof (*compat_v5creds));
- if (compat_v5creds) {
+ if (compat_v5creds) {
*compat_v5creds = cci_credentials_v5_compat_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
-
+
if (!err) {
- if (!v5creds->client) {
+ if (!v5creds->client) {
err = cci_check_error (ccErrBadParam);
} else {
compat_v5creds->client = strdup (v5creds->client);
if (!compat_v5creds->client) { err = cci_check_error (ccErrNoMem); }
}
}
-
+
if (!err) {
- if (!v5creds->server) {
+ if (!v5creds->server) {
err = cci_check_error (ccErrBadParam);
} else {
compat_v5creds->server = strdup (v5creds->server);
if (!compat_v5creds->server) { err = cci_check_error (ccErrNoMem); }
}
}
-
+
if (!err) {
err = cci_cc_data_copy_contents (&compat_v5creds->keyblock, &v5creds->keyblock);
}
-
+
if (!err) {
err = cci_cc_data_array_copy (&compat_v5creds->addresses, v5creds->addresses);
}
-
+
if (!err) {
err = cci_cc_data_copy_contents (&compat_v5creds->ticket, &v5creds->ticket);
}
-
+
if (!err) {
err = cci_cc_data_copy_contents (&compat_v5creds->second_ticket, &v5creds->second_ticket);
}
-
+
if (!err) {
err = cci_cc_data_array_copy (&compat_v5creds->authdata, v5creds->authdata);
}
-
+
if (!err) {
compat_cred_union->cred_type = CC_CRED_V5;
compat_cred_union->cred.pV5Cred = compat_v5creds;
-
+
compat_v5creds->keyblock = v5creds->keyblock;
compat_v5creds->authtime = v5creds->authtime;
compat_v5creds->starttime = v5creds->starttime;
@@ -923,15 +923,15 @@ cc_uint32 cci_credentials_union_to_cred_union (const cc_credentials_union *in_c
} else {
err = cci_check_error (ccErrBadCredentialsVersion);
}
- }
-
+ }
+
if (!err) {
*out_cred_union = compat_cred_union;
compat_cred_union = NULL;
}
-
+
if (compat_cred_union) { cci_cred_union_release (compat_cred_union); }
-
+
return cci_check_error (err);
}
@@ -942,29 +942,29 @@ cc_uint32 cci_cred_union_to_credentials_union (const cred_union *in_cred_un
{
cc_int32 err = ccNoError;
cc_credentials_union *creds_union = NULL;
-
+
if (!in_cred_union ) { err = cci_check_error (ccErrBadParam); }
if (!out_credentials_union) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
creds_union = calloc (1, sizeof (*creds_union));
if (!creds_union) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
if (in_cred_union->cred_type == CC_CRED_V4) {
cc_credentials_v4_compat *compat_v4creds = in_cred_union->cred.pV4Cred;
cc_credentials_v4_t *v4creds = NULL;
-
+
if (!err) {
v4creds = malloc (sizeof (*v4creds));
if (!v4creds) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
creds_union->version = cc_credentials_v4;
creds_union->credentials.credentials_v4 = v4creds;
-
+
v4creds->version = compat_v4creds->kversion;
strncpy (v4creds->principal, compat_v4creds->principal, KRB_NAME_SZ);
strncpy (v4creds->principal_instance, compat_v4creds->principal_instance, KRB_INSTANCE_SZ);
@@ -980,62 +980,62 @@ cc_uint32 cci_cred_union_to_credentials_union (const cred_union *in_cred_un
v4creds->ticket_size = compat_v4creds->ticket_sz;
memcpy (v4creds->ticket, compat_v4creds->ticket, MAX_V4_CRED_LEN);
}
-
+
} else if (in_cred_union->cred_type == CC_CRED_V5) {
cc_credentials_v5_compat *compat_v5creds = in_cred_union->cred.pV5Cred;
cc_credentials_v5_t *v5creds = NULL;
-
+
if (!err) {
v5creds = malloc (sizeof (*v5creds));
- if (v5creds) {
+ if (v5creds) {
*v5creds = cci_credentials_v5_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
- if (!compat_v5creds->client) {
+ if (!compat_v5creds->client) {
err = cci_check_error (ccErrBadParam);
} else {
v5creds->client = strdup (compat_v5creds->client);
if (!v5creds->client) { err = cci_check_error (ccErrNoMem); }
}
}
-
+
if (!err) {
- if (!compat_v5creds->server) {
+ if (!compat_v5creds->server) {
err = cci_check_error (ccErrBadParam);
} else {
v5creds->server = strdup (compat_v5creds->server);
if (!v5creds->server) { err = cci_check_error (ccErrNoMem); }
}
}
-
+
if (!err) {
err = cci_cc_data_copy_contents (&v5creds->keyblock, &compat_v5creds->keyblock);
}
-
+
if (!err) {
err = cci_cc_data_array_copy (&v5creds->addresses, compat_v5creds->addresses);
}
-
+
if (!err) {
err = cci_cc_data_copy_contents (&v5creds->ticket, &compat_v5creds->ticket);
}
-
+
if (!err) {
err = cci_cc_data_copy_contents (&v5creds->second_ticket, &compat_v5creds->second_ticket);
}
-
+
if (!err) {
err = cci_cc_data_array_copy (&v5creds->authdata, compat_v5creds->authdata);
}
-
+
if (!err) {
creds_union->version = cc_credentials_v5;
creds_union->credentials.credentials_v5 = v5creds;
-
+
v5creds->authtime = compat_v5creds->authtime;
v5creds->starttime = compat_v5creds->starttime;
v5creds->endtime = compat_v5creds->endtime;
@@ -1043,73 +1043,73 @@ cc_uint32 cci_cred_union_to_credentials_union (const cred_union *in_cred_un
v5creds->is_skey = compat_v5creds->is_skey;
v5creds->ticket_flags = compat_v5creds->ticket_flags;
}
-
+
} else {
err = cci_check_error (ccErrBadCredentialsVersion);
}
- }
-
+ }
+
if (!err) {
*out_credentials_union = creds_union;
creds_union = NULL;
}
-
+
if (creds_union) { cci_credentials_union_release (creds_union); }
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
cc_uint32 cci_cred_union_compare_to_credentials_union (const cred_union *in_cred_union_compat,
const cc_credentials_union *in_credentials_union,
- cc_uint32 *out_equal)
+ cc_uint32 *out_equal)
{
cc_int32 err = ccNoError;
cc_uint32 equal = 0;
-
+
if (!in_cred_union_compat) { err = cci_check_error (ccErrBadParam); }
if (!in_credentials_union) { err = cci_check_error (ccErrBadParam); }
if (!out_equal ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- if (in_cred_union_compat->cred_type == CC_CRED_V4 &&
+ if (in_cred_union_compat->cred_type == CC_CRED_V4 &&
in_credentials_union->version == cc_credentials_v4) {
cc_credentials_v4_compat *old_creds_v4 = in_cred_union_compat->cred.pV4Cred;
cc_credentials_v4_t *new_creds_v4 = in_credentials_union->credentials.credentials_v4;
-
+
if (old_creds_v4 && new_creds_v4 &&
- !strcmp (old_creds_v4->principal,
+ !strcmp (old_creds_v4->principal,
new_creds_v4->principal) &&
- !strcmp (old_creds_v4->principal_instance,
+ !strcmp (old_creds_v4->principal_instance,
new_creds_v4->principal_instance) &&
- !strcmp (old_creds_v4->service,
+ !strcmp (old_creds_v4->service,
new_creds_v4->service) &&
- !strcmp (old_creds_v4->service_instance,
+ !strcmp (old_creds_v4->service_instance,
new_creds_v4->service_instance) &&
!strcmp (old_creds_v4->realm, new_creds_v4->realm) &&
- (old_creds_v4->issue_date == (long) new_creds_v4->issue_date)) {
+ (old_creds_v4->issue_date == (long) new_creds_v4->issue_date)) {
equal = 1;
}
-
- } else if (in_cred_union_compat->cred_type == CC_CRED_V5 &&
+
+ } else if (in_cred_union_compat->cred_type == CC_CRED_V5 &&
in_credentials_union->version == cc_credentials_v5) {
cc_credentials_v5_compat *old_creds_v5 = in_cred_union_compat->cred.pV5Cred;
cc_credentials_v5_t *new_creds_v5 = in_credentials_union->credentials.credentials_v5;
-
+
/* Really should use krb5_parse_name and krb5_principal_compare */
if (old_creds_v5 && new_creds_v5 &&
!strcmp (old_creds_v5->client, new_creds_v5->client) &&
!strcmp (old_creds_v5->server, new_creds_v5->server) &&
- (old_creds_v5->starttime == new_creds_v5->starttime)) {
+ (old_creds_v5->starttime == new_creds_v5->starttime)) {
equal = 1;
}
}
}
-
+
if (!err) {
*out_equal = equal;
}
-
+
return cci_check_error (err);
}
diff --git a/src/ccapi/common/cci_debugging.c b/src/ccapi/common/cci_debugging.c
index 4545b40..d6b9c62 100644
--- a/src/ccapi/common/cci_debugging.c
+++ b/src/ccapi/common/cci_debugging.c
@@ -29,18 +29,18 @@
/* ------------------------------------------------------------------------ */
-cc_int32 _cci_check_error (cc_int32 in_error,
- const char *in_function,
- const char *in_file,
+cc_int32 _cci_check_error (cc_int32 in_error,
+ const char *in_function,
+ const char *in_file,
int in_line)
{
/* Do not log for flow control errors or when there is no error at all */
if (in_error != ccNoError && in_error != ccIteratorEnd) {
- cci_debug_printf ("%s() got %d at %s: %d", in_function,
+ cci_debug_printf ("%s() got %d at %s: %d", in_function,
in_error, in_file, in_line);
}
-
- return in_error;
+
+ return in_error;
}
/* ------------------------------------------------------------------------ */
@@ -48,7 +48,7 @@ cc_int32 _cci_check_error (cc_int32 in_error,
void cci_debug_printf (const char *in_format, ...)
{
va_list args;
-
+
va_start (args, in_format);
cci_os_debug_vprintf (in_format, args);
va_end (args);
diff --git a/src/ccapi/common/cci_debugging.h b/src/ccapi/common/cci_debugging.h
index 8875e1a..aa2f149 100644
--- a/src/ccapi/common/cci_debugging.h
+++ b/src/ccapi/common/cci_debugging.h
@@ -29,9 +29,9 @@
#include "cci_types.h"
-cc_int32 _cci_check_error (cc_int32 in_err,
- const char *in_function,
- const char *in_file,
+cc_int32 _cci_check_error (cc_int32 in_err,
+ const char *in_function,
+ const char *in_file,
int in_line);
#define cci_check_error(err) _cci_check_error(err, __FUNCTION__, __FILE__, __LINE__)
diff --git a/src/ccapi/common/cci_identifier.c b/src/ccapi/common/cci_identifier.c
index a027c70..f1cc0cf 100644
--- a/src/ccapi/common/cci_identifier.c
+++ b/src/ccapi/common/cci_identifier.c
@@ -37,9 +37,9 @@ struct cci_identifier_d cci_identifier_initializer = { NULL, NULL };
#define cci_uninitialized_server_id "NEEDS_SYNC"
#define cci_uninitialized_object_id "NEEDS_SYNC"
-struct cci_identifier_d cci_identifier_uninitialized_d = {
- cci_uninitialized_server_id,
- cci_uninitialized_object_id
+struct cci_identifier_d cci_identifier_uninitialized_d = {
+ cci_uninitialized_server_id,
+ cci_uninitialized_object_id
};
const cci_identifier_t cci_identifier_uninitialized = &cci_identifier_uninitialized_d;
@@ -58,37 +58,37 @@ static cc_int32 cci_identifier_alloc (cci_identifier_t *out_identifier,
{
cc_int32 err = ccNoError;
cci_identifier_t identifier = NULL;
-
+
if (!out_identifier) { err = cci_check_error (ccErrBadParam); }
if (!in_server_id ) { err = cci_check_error (ccErrBadParam); }
if (!in_object_id ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
identifier = malloc (sizeof (*identifier));
- if (identifier) {
+ if (identifier) {
*identifier = cci_identifier_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
identifier->server_id = strdup (in_server_id);
- if (!identifier->server_id) { err = cci_check_error (ccErrNoMem); }
+ if (!identifier->server_id) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
identifier->object_id = strdup (in_object_id);
- if (!identifier->object_id) { err = cci_check_error (ccErrNoMem); }
+ if (!identifier->object_id) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
*out_identifier = identifier;
identifier = NULL; /* take ownership */
}
-
+
cci_identifier_release (identifier);
-
+
return cci_check_error (err);
}
@@ -99,18 +99,18 @@ cc_int32 cci_identifier_new (cci_identifier_t *out_identifier,
{
cc_int32 err = ccNoError;
cci_uuid_string_t object_id = NULL;
-
+
if (!out_identifier) { err = cci_check_error (ccErrBadParam); }
if (!in_server_id ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_os_identifier_new_uuid (&object_id);
}
-
+
if (!err) {
err = cci_identifier_alloc (out_identifier, in_server_id, object_id);
}
-
+
if (object_id) { free (object_id); }
return cci_check_error (err);
@@ -125,13 +125,13 @@ cc_int32 cci_identifier_copy (cci_identifier_t *out_identifier,
if (!out_identifier) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = cci_identifier_alloc (out_identifier,
+ err = cci_identifier_alloc (out_identifier,
in_identifier->server_id,
in_identifier->object_id);
}
-
+
return cci_check_error (err);
}
@@ -140,14 +140,14 @@ cc_int32 cci_identifier_copy (cci_identifier_t *out_identifier,
cc_int32 cci_identifier_release (cci_identifier_t in_identifier)
{
cc_int32 err = ccNoError;
-
+
/* Do not free the static "uninitialized" identifier */
if (!err && in_identifier && in_identifier != cci_identifier_uninitialized) {
free (in_identifier->server_id);
free (in_identifier->object_id);
free (in_identifier);
}
-
+
return cci_check_error (err);
}
@@ -162,19 +162,19 @@ cc_int32 cci_identifier_compare (cci_identifier_t in_identifier,
cc_uint32 *out_equal)
{
cc_int32 err = ccNoError;
-
+
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!in_compare_to_identifier) { err = cci_check_error (ccErrBadParam); }
if (!out_equal ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- *out_equal = (!strcmp (in_identifier->object_id,
+ *out_equal = (!strcmp (in_identifier->object_id,
in_compare_to_identifier->object_id) &&
- !strcmp (in_identifier->server_id,
+ !strcmp (in_identifier->server_id,
in_compare_to_identifier->server_id));
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -184,17 +184,17 @@ cc_int32 cci_identifier_is_for_server (cci_identifier_t in_identifier,
cc_uint32 *out_is_for_server)
{
cc_int32 err = ccNoError;
-
+
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!in_server_id ) { err = cci_check_error (ccErrBadParam); }
if (!out_is_for_server) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
*out_is_for_server = (!strcmp (in_identifier->server_id, in_server_id) ||
!strcmp (in_identifier->server_id, cci_uninitialized_server_id));
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -204,17 +204,17 @@ cc_int32 cci_identifier_compare_server_id (cci_identifier_t in_identifier,
cc_uint32 *out_equal_server_id)
{
cc_int32 err = ccNoError;
-
+
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!in_compare_to_identifier) { err = cci_check_error (ccErrBadParam); }
if (!out_equal_server_id ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- *out_equal_server_id = (!strcmp (in_identifier->server_id,
+ *out_equal_server_id = (!strcmp (in_identifier->server_id,
in_compare_to_identifier->server_id));
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -223,16 +223,16 @@ cc_int32 cci_identifier_is_initialized (cci_identifier_t in_identifier,
cc_uint32 *out_is_initialized)
{
cc_int32 err = ccNoError;
-
+
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_is_initialized) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- *out_is_initialized = (strcmp (in_identifier->server_id,
+ *out_is_initialized = (strcmp (in_identifier->server_id,
cci_uninitialized_server_id) != 0);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -247,25 +247,25 @@ cc_uint32 cci_identifier_read (cci_identifier_t *out_identifier,
cc_int32 err = ccNoError;
cci_uuid_string_t server_id = NULL;
cci_uuid_string_t object_id = NULL;
-
+
if (!out_identifier) { err = cci_check_error (ccErrBadParam); }
if (!io_stream ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (io_stream, &server_id);
}
if (!err) {
err = krb5int_ipc_stream_read_string (io_stream, &object_id);
- }
-
+ }
+
if (!err) {
err = cci_identifier_alloc (out_identifier, server_id, object_id);
}
-
+
krb5int_ipc_stream_free_string (server_id);
krb5int_ipc_stream_free_string (object_id);
-
+
return cci_check_error (err);
}
@@ -275,17 +275,17 @@ cc_uint32 cci_identifier_write (cci_identifier_t in_identifier,
k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
-
+
if (!in_identifier) { err = cci_check_error (ccErrBadParam); }
if (!io_stream ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (io_stream, in_identifier->server_id);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (io_stream, in_identifier->object_id);
}
-
+
return cci_check_error (err);
}
diff --git a/src/ccapi/common/cci_message.c b/src/ccapi/common/cci_message.c
index 0e12c0d..af1f961 100644
--- a/src/ccapi/common/cci_message.c
+++ b/src/ccapi/common/cci_message.c
@@ -31,27 +31,27 @@
cc_int32 cci_message_invalid_object_err (enum cci_msg_id_t in_request_name)
{
cc_int32 err = ccNoError;
-
+
if (in_request_name > cci_context_first_msg_id &&
in_request_name < cci_context_last_msg_id) {
err = ccErrInvalidContext;
-
+
} else if (in_request_name > cci_ccache_first_msg_id &&
in_request_name < cci_ccache_last_msg_id) {
err = ccErrInvalidCCache;
-
+
} else if (in_request_name > cci_ccache_iterator_first_msg_id &&
in_request_name < cci_ccache_iterator_last_msg_id) {
err = ccErrInvalidCCacheIterator;
-
+
} else if (in_request_name > cci_credentials_iterator_first_msg_id &&
in_request_name < cci_credentials_iterator_last_msg_id) {
err = ccErrInvalidCredentialsIterator;
-
+
} else {
err = ccErrBadInternalMessage;
}
-
+
return cci_check_error (err);
}
@@ -63,28 +63,28 @@ cc_int32 cci_message_new_request_header (k5_ipc_stream *out_request,
{
cc_int32 err = ccNoError;
k5_ipc_stream request = NULL;
-
+
if (!out_request) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_request_name);
}
-
+
if (!err) {
err = cci_identifier_write (in_identifier, request);
}
-
+
if (!err) {
*out_request = request;
request = NULL;
}
-
+
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -97,27 +97,27 @@ cc_int32 cci_message_read_request_header (k5_ipc_stream in_request,
cc_int32 err = ccNoError;
cc_uint32 request_name;
cci_identifier_t identifier = NULL;
-
+
if (!in_request ) { err = cci_check_error (ccErrBadParam); }
if (!out_request_name) { err = cci_check_error (ccErrBadParam); }
if (!out_identifier ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request, &request_name);
}
-
+
if (!err) {
err = cci_identifier_read (&identifier, in_request);
}
-
+
if (!err) {
*out_request_name = request_name;
*out_identifier = identifier;
identifier = NULL; /* take ownership */
}
-
+
cci_identifier_release (identifier);
-
+
return cci_check_error (err);
}
@@ -128,24 +128,24 @@ cc_int32 cci_message_new_reply_header (k5_ipc_stream *out_reply,
{
cc_int32 err = ccNoError;
k5_ipc_stream reply = NULL;
-
+
if (!out_reply) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&reply);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_int32 (reply, in_error);
}
-
+
if (!err) {
*out_reply = reply;
reply = NULL;
}
-
+
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
@@ -156,18 +156,18 @@ cc_int32 cci_message_read_reply_header (k5_ipc_stream in_reply,
{
cc_int32 err = ccNoError;
cc_int32 reply_err = 0;
-
+
if (!in_reply ) { err = cci_check_error (ccErrBadParam); }
if (!out_reply_error) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_int32 (in_reply, &reply_err);
}
-
+
if (!err) {
*out_reply_error = reply_err;
}
-
+
return cci_check_error (err);
}
@@ -177,38 +177,38 @@ cc_int32 cci_message_read_reply_header (k5_ipc_stream in_reply,
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_read_time (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_read_time (k5_ipc_stream io_stream,
cc_time_t *out_time)
{
int32_t err = 0;
int64_t t = 0;
-
+
if (!io_stream) { err = cci_check_error (ccErrBadParam); }
if (!out_time ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_int64 (io_stream, &t);
}
-
+
if (!err) {
*out_time = t;
}
-
+
return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
-uint32_t krb5int_ipc_stream_write_time (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_write_time (k5_ipc_stream io_stream,
cc_time_t in_time)
{
int32_t err = 0;
-
+
if (!io_stream) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_int64 (io_stream, in_time);
}
-
+
return cci_check_error (err);
}
diff --git a/src/ccapi/common/cci_message.h b/src/ccapi/common/cci_message.h
index 8c1795b..01085ac 100644
--- a/src/ccapi/common/cci_message.h
+++ b/src/ccapi/common/cci_message.h
@@ -45,9 +45,9 @@ cc_int32 cci_message_new_reply_header (k5_ipc_stream *out_reply,
cc_int32 cci_message_read_reply_header (k5_ipc_stream in_reply,
cc_int32 *out_reply_error);
-uint32_t krb5int_ipc_stream_read_time (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_read_time (k5_ipc_stream io_stream,
cc_time_t *out_time);
-uint32_t krb5int_ipc_stream_write_time (k5_ipc_stream io_stream,
+uint32_t krb5int_ipc_stream_write_time (k5_ipc_stream io_stream,
cc_time_t in_time);
#endif /* CCI_MESSAGE_H */
diff --git a/src/ccapi/common/cci_types.h b/src/ccapi/common/cci_types.h
index 43f7100..c304633 100644
--- a/src/ccapi/common/cci_types.h
+++ b/src/ccapi/common/cci_types.h
@@ -38,7 +38,7 @@ typedef struct cci_identifier_d *cci_identifier_t;
enum cci_msg_id_t {
/* cc_context_t */
cci_context_first_msg_id,
-
+
cci_context_unused_release_msg_id, /* Unused. Handle for old clients. */
cci_context_sync_msg_id,
cci_context_get_change_time_msg_id,
@@ -52,12 +52,12 @@ enum cci_msg_id_t {
cci_context_new_ccache_iterator_msg_id,
cci_context_lock_msg_id,
cci_context_unlock_msg_id,
-
+
cci_context_last_msg_id,
-
+
/* cc_ccache_t */
cci_ccache_first_msg_id,
-
+
cci_ccache_destroy_msg_id,
cci_ccache_set_default_msg_id,
cci_ccache_get_credentials_version_msg_id,
@@ -76,28 +76,28 @@ enum cci_msg_id_t {
cci_ccache_get_kdc_time_offset_msg_id,
cci_ccache_set_kdc_time_offset_msg_id,
cci_ccache_clear_kdc_time_offset_msg_id,
-
+
cci_ccache_last_msg_id,
-
+
/* cc_ccache_iterator_t */
cci_ccache_iterator_first_msg_id,
-
+
cci_ccache_iterator_release_msg_id,
cci_ccache_iterator_next_msg_id,
cci_ccache_iterator_clone_msg_id,
-
+
cci_ccache_iterator_last_msg_id,
-
+
/* cc_credentials_iterator_t */
cci_credentials_iterator_first_msg_id,
-
+
cci_credentials_iterator_release_msg_id,
cci_credentials_iterator_next_msg_id,
cci_credentials_iterator_clone_msg_id,
-
+
cci_credentials_iterator_last_msg_id,
-
+
cci_max_msg_id /* must be last! */
-};
+};
#endif /* CCI_TYPES_H */
diff --git a/src/ccapi/common/mac/cci_os_identifier.c b/src/ccapi/common/mac/cci_os_identifier.c
index 5f3d065..e87e400 100644
--- a/src/ccapi/common/mac/cci_os_identifier.c
+++ b/src/ccapi/common/mac/cci_os_identifier.c
@@ -39,42 +39,41 @@ cc_int32 cci_os_identifier_new_uuid (cci_uuid_string_t *out_uuid_string)
CFStringRef uuid_stringref = NULL;
CFStringEncoding encoding = kCFStringEncodingUTF8;
CFIndex length = 0;
-
+
if (!out_uuid_string) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
uuid = CFUUIDCreate (kCFAllocatorDefault);
if (!uuid) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
- uuid_stringref = CFUUIDCreateString (kCFAllocatorDefault, uuid);
+ uuid_stringref = CFUUIDCreateString (kCFAllocatorDefault, uuid);
if (!uuid_stringref) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
- length = CFStringGetMaximumSizeForEncoding (CFStringGetLength (uuid_stringref),
+ length = CFStringGetMaximumSizeForEncoding (CFStringGetLength (uuid_stringref),
encoding) + 1;
-
+
uuid_string = malloc (length);
if (!uuid_string) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
if (!CFStringGetCString (uuid_stringref, uuid_string, length, encoding)) {
err = cci_check_error (ccErrNoMem);
- }
+ }
}
-
+
if (!err) {
*out_uuid_string = uuid_string;
uuid_string = NULL; /* take ownership */
}
-
+
if (uuid_string ) { free (uuid_string); }
if (uuid_stringref) { CFRelease (uuid_stringref); }
if (uuid ) { CFRelease (uuid); }
-
+
return cci_check_error (err);
}
-
diff --git a/src/ccapi/common/win/OldCC/ccutils.c b/src/ccapi/common/win/OldCC/ccutils.c
index cf881cd..220b1d1 100644
--- a/src/ccapi/common/win/OldCC/ccutils.c
+++ b/src/ccapi/common/win/OldCC/ccutils.c
@@ -57,7 +57,7 @@ BOOL isNT() {
bIsNT = FALSE;
break;
}
-
+
if (!bSupportedVersion) {
cci_debug_printf("%s Running on an unsupported version of Windows", __FUNCTION__);
status = 1;
@@ -104,7 +104,7 @@ HANDLE createThreadEvent(char* uuid, char* suffix) {
}
#if 0
cci_debug_printf("%s event_name:%s", __FUNCTION__, event_name);
-#endif
+#endif
if (!status) {
hEvent = CreateEvent(psa, FALSE, FALSE, event_name);
if (!hEvent) status = cci_check_error(GetLastError());
@@ -112,7 +112,7 @@ HANDLE createThreadEvent(char* uuid, char* suffix) {
if (!status) ResetEvent(hEvent);
-
+
if (event_name) free(event_name);
if (isNT()) free(sa.lpSecurityDescriptor);
@@ -137,4 +137,4 @@ HANDLE openThreadEvent(char* uuid, char* suffix) {
if (event_name) free(event_name);
return hEvent;
- } \ No newline at end of file
+ }
diff --git a/src/ccapi/common/win/cci_os_debugging.c b/src/ccapi/common/win/cci_os_debugging.c
index 6e6a715..5a8c9e7 100644
--- a/src/ccapi/common/win/cci_os_debugging.c
+++ b/src/ccapi/common/win/cci_os_debugging.c
@@ -24,7 +24,7 @@
* or implied warranty.
*/
-#include <stdio.h>
+#include <stdio.h>
#include <stdarg.h>
#include "cci_os_debugging.h"
diff --git a/src/ccapi/common/win/tls.c b/src/ccapi/common/win/tls.c
index 5e0e11d..60c8ea1 100644
--- a/src/ccapi/common/win/tls.c
+++ b/src/ccapi/common/win/tls.c
@@ -73,15 +73,15 @@ char* tspdata_getUUID (const struct tspdata* p) {return p->_
RPC_ASYNC_STATE* tspdata_getRpcAState (const struct tspdata* p) {return p->_rpcState;}
BOOL WINAPI PutTspData(DWORD dwTlsIndex, struct tspdata* dw) {
- LPVOID lpvData;
- struct tspdata** pData; // The stored memory pointer
+ LPVOID lpvData;
+ struct tspdata** pData; // The stored memory pointer
// Retrieve a data pointer for the current thread:
- lpvData = TlsGetValue(dwTlsIndex);
+ lpvData = TlsGetValue(dwTlsIndex);
// If NULL, allocate memory for the TLS slot for this thread:
if (lpvData == NULL) {
- lpvData = (LPVOID) LocalAlloc(LPTR, sizeof(struct tspdata));
+ lpvData = (LPVOID) LocalAlloc(LPTR, sizeof(struct tspdata));
if (lpvData == NULL) return FALSE;
if (!TlsSetValue(dwTlsIndex, lpvData)) return FALSE;
}
@@ -95,12 +95,10 @@ BOOL WINAPI PutTspData(DWORD dwTlsIndex, struct tspdata* dw) {
}
BOOL WINAPI GetTspData(DWORD dwTlsIndex, struct tspdata** pdw) {
- struct tspdata* pData; // The stored memory pointer
+ struct tspdata* pData; // The stored memory pointer
- pData = (struct tspdata*)TlsGetValue(dwTlsIndex);
+ pData = (struct tspdata*)TlsGetValue(dwTlsIndex);
if (pData == NULL) return FALSE;
(*pdw) = pData;
return TRUE;
}
-
-
diff --git a/src/ccapi/common/win/tls.h b/src/ccapi/common/win/tls.h
index 32854f0..d688ed2 100644
--- a/src/ccapi/common/win/tls.h
+++ b/src/ccapi/common/win/tls.h
@@ -37,7 +37,7 @@
#define UUID_SIZE 128
-/* The client code can be run in any client thread.
+/* The client code can be run in any client thread.
The thread-specific data is defined here.
*/
diff --git a/src/ccapi/common/win/win-utils.c b/src/ccapi/common/win/win-utils.c
index f60ee3b..3795ca5 100644
--- a/src/ccapi/common/win/win-utils.c
+++ b/src/ccapi/common/win/win-utils.c
@@ -52,18 +52,18 @@ char* clientEndpoint(const char* UUID) {
strncat(_clientEndpoint, UUID, UUID_SIZE);
// cci_debug_printf("%s returning %s", __FUNCTION__, _clientEndpoint);
return _clientEndpoint;
- }
+ }
char* serverEndpoint(const char* user) {
char* _serverEndpoint = (char*)malloc(strlen(user) + strlen(serverPrefix) + 2);
strcpy(_serverEndpoint, serverPrefix);
strncat(_serverEndpoint, user, UUID_SIZE);
return _serverEndpoint;
- }
+ }
char* timestamp() {
SYSTEMTIME _stime;
GetSystemTime(&_stime);
GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, &_stime, "HH:mm:ss", _ts, sizeof(_ts)-1);
return _ts;
- } \ No newline at end of file
+ }
diff --git a/src/ccapi/lib/ccapi_ccache.c b/src/ccapi/lib/ccapi_ccache.c
index ec64c44..9104c8e 100644
--- a/src/ccapi/lib/ccapi_ccache.c
+++ b/src/ccapi/lib/ccapi_ccache.c
@@ -45,14 +45,14 @@ typedef struct cci_ccache_d {
/* ------------------------------------------------------------------------ */
-struct cci_ccache_d cci_ccache_initializer = {
- NULL
- VECTOR_FUNCTIONS_INITIALIZER,
+struct cci_ccache_d cci_ccache_initializer = {
+ NULL
+ VECTOR_FUNCTIONS_INITIALIZER,
NULL,
0
};
-cc_ccache_f cci_ccache_f_initializer = {
+cc_ccache_f cci_ccache_f_initializer = {
ccapi_ccache_release,
ccapi_ccache_destroy,
ccapi_ccache_set_default,
@@ -82,39 +82,39 @@ cc_int32 cci_ccache_new (cc_ccache_t *out_ccache,
{
cc_int32 err = ccNoError;
cci_ccache_t ccache = NULL;
-
+
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier) { err = cci_check_error (ccErrBadParam); }
if (!err) {
ccache = malloc (sizeof (*ccache));
- if (ccache) {
+ if (ccache) {
*ccache = cci_ccache_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
ccache->functions = malloc (sizeof (*ccache->functions));
- if (ccache->functions) {
+ if (ccache->functions) {
*ccache->functions = cci_ccache_f_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = cci_identifier_copy (&ccache->identifier, in_identifier);
}
-
+
if (!err) {
*out_ccache = (cc_ccache_t) ccache;
ccache = NULL; /* take ownership */
}
-
+
ccapi_ccache_release ((cc_ccache_t) ccache);
-
+
return cci_check_error (err);
}
@@ -125,14 +125,14 @@ cc_int32 cci_ccache_write (cc_ccache_t in_ccache,
{
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) in_ccache;
-
+
if (!in_ccache) { err = cci_check_error (ccErrBadParam); }
if (!in_stream) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_identifier_write (ccache->identifier, in_stream);
}
-
+
return cci_check_error (err);
}
@@ -146,16 +146,16 @@ cc_int32 ccapi_ccache_release (cc_ccache_t io_ccache)
{
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
-
+
if (!io_ccache) { err = ccErrBadParam; }
-
+
if (!err) {
cci_identifier_release (ccache->identifier);
-
+
free ((char *) ccache->functions);
free (ccache);
}
-
+
return err;
}
@@ -165,20 +165,20 @@ cc_int32 ccapi_ccache_destroy (cc_ccache_t io_ccache)
{
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
-
+
if (!io_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_destroy_msg_id,
ccache->identifier,
NULL,
NULL);
}
-
+
if (!err) {
err = ccapi_ccache_release (io_ccache);
}
-
+
return cci_check_error (err);
}
@@ -188,16 +188,16 @@ cc_int32 ccapi_ccache_set_default (cc_ccache_t io_ccache)
{
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
-
+
if (!io_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_set_default_msg_id,
ccache->identifier,
NULL,
NULL);
}
-
+
return cci_check_error (err);
}
@@ -209,23 +209,23 @@ cc_int32 ccapi_ccache_get_credentials_version (cc_ccache_t in_ccache,
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) in_ccache;
k5_ipc_stream reply = NULL;
-
+
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_credentials_version) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_get_credentials_version_msg_id,
ccache->identifier,
NULL,
&reply);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (reply, out_credentials_version);
}
-
+
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
@@ -238,28 +238,28 @@ cc_int32 ccapi_ccache_get_name (cc_ccache_t in_ccache,
cci_ccache_t ccache = (cci_ccache_t) in_ccache;
k5_ipc_stream reply = NULL;
char *name = NULL;
-
+
if (!in_ccache) { err = cci_check_error (ccErrBadParam); }
if (!out_name ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_get_name_msg_id,
ccache->identifier,
NULL,
&reply);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (reply, &name);
}
-
+
if (!err) {
err = cci_string_new (out_name, name);
}
-
+
krb5int_ipc_stream_release (reply);
krb5int_ipc_stream_free_string (name);
-
+
return cci_check_error (err);
}
@@ -274,37 +274,37 @@ cc_int32 ccapi_ccache_get_principal (cc_ccache_t in_ccache,
k5_ipc_stream request = NULL;
k5_ipc_stream reply = NULL;
char *principal = NULL;
-
+
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_principal) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_credentials_version);
}
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_get_principal_msg_id,
ccache->identifier,
request,
&reply);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (reply, &principal);
}
-
+
if (!err) {
err = cci_string_new (out_principal, principal);
}
-
+
krb5int_ipc_stream_release (request);
krb5int_ipc_stream_release (reply);
krb5int_ipc_stream_free_string (principal);
-
+
return cci_check_error (err);
}
@@ -317,18 +317,18 @@ cc_int32 ccapi_ccache_set_principal (cc_ccache_t io_ccache,
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
k5_ipc_stream request = NULL;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_principal) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_credentials_version);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (request, in_principal);
}
@@ -339,7 +339,7 @@ cc_int32 ccapi_ccache_set_principal (cc_ccache_t io_ccache,
request,
NULL);
}
-
+
krb5int_ipc_stream_release (request);
return cci_check_error (err);
@@ -353,27 +353,27 @@ cc_int32 ccapi_ccache_store_credentials (cc_ccache_t io_ccache,
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
k5_ipc_stream request = NULL;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_credentials_union) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = cci_credentials_union_write (in_credentials_union, request);
}
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_store_credentials_msg_id,
ccache->identifier,
request,
NULL);
}
-
+
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -385,27 +385,27 @@ cc_int32 ccapi_ccache_remove_credentials (cc_ccache_t io_ccache,
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
k5_ipc_stream request = NULL;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_credentials) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = cci_credentials_write (in_credentials, request);
}
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_remove_credentials_msg_id,
ccache->identifier,
request,
NULL);
}
-
+
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -418,25 +418,25 @@ cc_int32 ccapi_ccache_new_credentials_iterator (cc_ccache_t in_cc
cci_ccache_t ccache = (cci_ccache_t) in_ccache;
k5_ipc_stream reply = NULL;
cci_identifier_t identifier = NULL;
-
+
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_new_credentials_iterator_msg_id,
ccache->identifier,
NULL,
&reply);
}
-
+
if (!err) {
err = cci_identifier_read (&identifier, reply);
}
-
+
if (!err) {
err = cci_credentials_iterator_new (out_credentials_iterator, identifier);
}
-
+
krb5int_ipc_stream_release (reply);
cci_identifier_release (identifier);
@@ -454,25 +454,25 @@ cc_int32 ccapi_ccache_move (cc_ccache_t io_source_ccache,
cci_ccache_t source_ccache = (cci_ccache_t) io_source_ccache;
cci_ccache_t destination_ccache = (cci_ccache_t) io_destination_ccache;
k5_ipc_stream request = NULL;
-
+
if (!io_source_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_destination_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = cci_identifier_write (source_ccache->identifier, request);
}
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_move_msg_id,
destination_ccache->identifier,
request,
NULL);
}
-
+
krb5int_ipc_stream_release (request);
return cci_check_error (err);
@@ -487,30 +487,30 @@ cc_int32 ccapi_ccache_lock (cc_ccache_t io_ccache,
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
k5_ipc_stream request = NULL;
-
+
if (!io_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_lock_type);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_block);
}
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_lock_msg_id,
ccache->identifier,
request,
NULL);
}
-
+
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -520,16 +520,16 @@ cc_int32 ccapi_ccache_unlock (cc_ccache_t io_ccache)
{
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
-
+
if (!io_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_unlock_msg_id,
ccache->identifier,
NULL,
NULL);
}
-
+
return cci_check_error (err);
}
@@ -541,21 +541,21 @@ cc_int32 ccapi_ccache_get_last_default_time (cc_ccache_t in_ccache,
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) in_ccache;
k5_ipc_stream reply = NULL;
-
+
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_last_default_time) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_get_last_default_time_msg_id,
ccache->identifier,
NULL,
&reply);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (reply, out_last_default_time);
}
-
+
krb5int_ipc_stream_release (reply);
return cci_check_error (err);
@@ -569,23 +569,23 @@ cc_int32 ccapi_ccache_get_change_time (cc_ccache_t in_ccache,
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) in_ccache;
k5_ipc_stream reply = NULL;
-
+
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_change_time) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_get_change_time_msg_id,
ccache->identifier,
NULL,
&reply);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (reply, out_change_time);
}
-
+
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
@@ -597,31 +597,31 @@ cc_int32 ccapi_ccache_wait_for_change (cc_ccache_t in_ccache)
cci_ccache_t ccache = (cci_ccache_t) in_ccache;
k5_ipc_stream request = NULL;
k5_ipc_stream reply = NULL;
-
+
if (!in_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (request, ccache->last_wait_for_change_time);
}
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_wait_for_change_msg_id,
ccache->identifier,
- request,
+ request,
&reply);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (reply, &ccache->last_wait_for_change_time);
- }
-
+ }
+
krb5int_ipc_stream_release (request);
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
@@ -634,17 +634,17 @@ cc_int32 ccapi_ccache_compare (cc_ccache_t in_ccache,
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) in_ccache;
cci_ccache_t compare_to_ccache = (cci_ccache_t) in_compare_to_ccache;
-
+
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_compare_to_ccache) { err = cci_check_error (ccErrBadParam); }
if (!out_equal ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = cci_identifier_compare (ccache->identifier,
+ err = cci_identifier_compare (ccache->identifier,
compare_to_ccache->identifier,
out_equal);
}
-
+
return cci_check_error (err);
}
@@ -658,14 +658,14 @@ cc_int32 ccapi_ccache_get_kdc_time_offset (cc_ccache_t in_ccache,
cci_ccache_t ccache = (cci_ccache_t) in_ccache;
k5_ipc_stream request = NULL;
k5_ipc_stream reply = NULL;
-
+
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_time_offset) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_credentials_version);
}
@@ -676,14 +676,14 @@ cc_int32 ccapi_ccache_get_kdc_time_offset (cc_ccache_t in_ccache,
request,
&reply);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (reply, out_time_offset);
}
-
+
krb5int_ipc_stream_release (request);
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
@@ -696,30 +696,30 @@ cc_int32 ccapi_ccache_set_kdc_time_offset (cc_ccache_t io_ccache,
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
k5_ipc_stream request = NULL;
-
+
if (!io_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_credentials_version);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (request, in_time_offset);
}
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_set_kdc_time_offset_msg_id,
ccache->identifier,
request,
NULL);
}
-
+
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -731,26 +731,26 @@ cc_int32 ccapi_ccache_clear_kdc_time_offset (cc_ccache_t io_ccache,
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
k5_ipc_stream request = NULL;
-
+
if (!io_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_credentials_version);
}
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_clear_kdc_time_offset_msg_id,
ccache->identifier,
request,
NULL);
}
-
+
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -765,14 +765,14 @@ cc_int32 cci_ccache_get_compat_version (cc_ccache_t in_ccache,
{
cc_int32 err = ccNoError;
cci_ccache_t ccache = (cci_ccache_t) in_ccache;
-
+
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_compat_version) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
*out_compat_version = ccache->compat_version;
}
-
+
return cci_check_error (err);
}
@@ -785,10 +785,10 @@ cc_int32 cci_ccache_set_compat_version (cc_ccache_t io_ccache,
cci_ccache_t ccache = (cci_ccache_t) io_ccache;
if (!io_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
ccache->compat_version = in_compat_version;
}
-
+
return cci_check_error (err);
}
diff --git a/src/ccapi/lib/ccapi_ccache_iterator.c b/src/ccapi/lib/ccapi_ccache_iterator.c
index 0df9e0f..aa10e1e 100644
--- a/src/ccapi/lib/ccapi_ccache_iterator.c
+++ b/src/ccapi/lib/ccapi_ccache_iterator.c
@@ -41,14 +41,14 @@ typedef struct cci_ccache_iterator_d {
/* ------------------------------------------------------------------------ */
-struct cci_ccache_iterator_d cci_ccache_iterator_initializer = {
- NULL
- VECTOR_FUNCTIONS_INITIALIZER,
+struct cci_ccache_iterator_d cci_ccache_iterator_initializer = {
+ NULL
+ VECTOR_FUNCTIONS_INITIALIZER,
NULL,
NULL
};
-cc_ccache_iterator_f cci_ccache_iterator_f_initializer = {
+cc_ccache_iterator_f cci_ccache_iterator_f_initializer = {
ccapi_ccache_iterator_release,
ccapi_ccache_iterator_next,
ccapi_ccache_iterator_clone
@@ -64,36 +64,36 @@ cc_int32 cci_ccache_iterator_new (cc_ccache_iterator_t *out_ccache_iterator,
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
ccache_iterator = malloc (sizeof (*ccache_iterator));
- if (ccache_iterator) {
+ if (ccache_iterator) {
*ccache_iterator = cci_ccache_iterator_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
ccache_iterator->functions = malloc (sizeof (*ccache_iterator->functions));
- if (ccache_iterator->functions) {
+ if (ccache_iterator->functions) {
*ccache_iterator->functions = cci_ccache_iterator_f_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = cci_identifier_copy (&ccache_iterator->identifier, in_identifier);
}
-
+
if (!err) {
*out_ccache_iterator = (cc_ccache_iterator_t) ccache_iterator;
ccache_iterator = NULL; /* take ownership */
}
-
+
ccapi_ccache_iterator_release ((cc_ccache_iterator_t) ccache_iterator);
-
+
return cci_check_error (err);
}
@@ -104,14 +104,14 @@ cc_int32 cci_ccache_iterator_write (cc_ccache_iterator_t in_ccache_iterator,
{
cc_int32 err = ccNoError;
cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) in_ccache_iterator;
-
+
if (!in_ccache_iterator) { err = cci_check_error (ccErrBadParam); }
if (!in_stream ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_identifier_write (ccache_iterator->identifier, in_stream);
}
-
+
return cci_check_error (err);
}
@@ -121,35 +121,35 @@ cc_int32 ccapi_ccache_iterator_release (cc_ccache_iterator_t io_ccache_iterator)
{
cc_int32 err = ccNoError;
cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) io_ccache_iterator;
-
+
if (!io_ccache_iterator) { err = ccErrBadParam; }
-
+
if (!err) {
cc_uint32 initialized = 0;
-
+
err = cci_identifier_is_initialized (ccache_iterator->identifier,
&initialized);
-
+
if (!err && initialized) {
err = cci_ipc_send (cci_ccache_iterator_release_msg_id,
ccache_iterator->identifier,
NULL,
NULL);
if (err) {
- cci_debug_printf ("%s: cci_ipc_send failed with error %d",
+ cci_debug_printf ("%s: cci_ipc_send failed with error %d",
__FUNCTION__, err);
err = ccNoError;
}
}
}
-
+
if (!err) {
free ((char *) ccache_iterator->functions);
cci_identifier_release (ccache_iterator->identifier);
free (ccache_iterator->saved_ccache_name);
free (ccache_iterator);
}
-
+
return err;
}
@@ -162,10 +162,10 @@ cc_int32 ccapi_ccache_iterator_next (cc_ccache_iterator_t in_ccache_iterator,
cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) in_ccache_iterator;
k5_ipc_stream reply = NULL;
cci_identifier_t identifier = NULL;
-
+
if (!in_ccache_iterator) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
cc_uint32 initialized = 0;
@@ -177,25 +177,25 @@ cc_int32 ccapi_ccache_iterator_next (cc_ccache_iterator_t in_ccache_iterator,
err = cci_check_error (ccIteratorEnd);
}
}
-
+
if (!err) {
err = cci_ipc_send (cci_ccache_iterator_next_msg_id,
ccache_iterator->identifier,
NULL,
&reply);
}
-
+
if (!err) {
err = cci_identifier_read (&identifier, reply);
}
-
+
if (!err) {
err = cci_ccache_new (out_ccache, identifier);
}
-
+
krb5int_ipc_stream_release (reply);
cci_identifier_release (identifier);
-
+
return cci_check_error (err);
}
@@ -209,10 +209,10 @@ cc_int32 ccapi_ccache_iterator_clone (cc_ccache_iterator_t in_ccache_iterator,
k5_ipc_stream reply = NULL;
cc_uint32 initialized = 0;
cci_identifier_t identifier = NULL;
-
+
if (!in_ccache_iterator ) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_identifier_is_initialized (ccache_iterator->identifier,
&initialized);
@@ -224,7 +224,7 @@ cc_int32 ccapi_ccache_iterator_clone (cc_ccache_iterator_t in_ccache_iterator,
ccache_iterator->identifier,
NULL,
&reply);
-
+
if (!err) {
err = cci_identifier_read (&identifier, reply);
}
@@ -234,14 +234,14 @@ cc_int32 ccapi_ccache_iterator_clone (cc_ccache_iterator_t in_ccache_iterator,
identifier = cci_identifier_uninitialized;
}
}
-
+
if (!err) {
err = cci_ccache_iterator_new (out_ccache_iterator, identifier);
}
cci_identifier_release (identifier);
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
@@ -252,14 +252,14 @@ cc_int32 cci_ccache_iterator_get_saved_ccache_name (cc_ccache_iterator_t in_cc
{
cc_int32 err = ccNoError;
cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) in_ccache_iterator;
-
+
if (!in_ccache_iterator ) { err = cci_check_error (ccErrBadParam); }
if (!out_saved_ccache_name) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
*out_saved_ccache_name = ccache_iterator->saved_ccache_name;
}
-
+
return cci_check_error (err);
}
@@ -271,22 +271,22 @@ cc_int32 cci_ccache_iterator_set_saved_ccache_name (cc_ccache_iterator_t io_cca
cc_int32 err = ccNoError;
cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) io_ccache_iterator;
char *new_saved_ccache_name = NULL;
-
+
if (!io_ccache_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err && in_saved_ccache_name) {
new_saved_ccache_name = strdup (in_saved_ccache_name);
if (!new_saved_ccache_name) { err = ccErrNoMem; }
}
-
+
if (!err) {
free (ccache_iterator->saved_ccache_name);
-
+
ccache_iterator->saved_ccache_name = new_saved_ccache_name;
new_saved_ccache_name = NULL; /* take ownership */
}
-
+
free (new_saved_ccache_name);
-
+
return cci_check_error (err);
}
diff --git a/src/ccapi/lib/ccapi_context.c b/src/ccapi/lib/ccapi_context.c
index 9b1d05d..da8aa59 100644
--- a/src/ccapi/lib/ccapi_context.c
+++ b/src/ccapi/lib/ccapi_context.c
@@ -49,15 +49,15 @@ typedef struct cci_context_d {
/* ------------------------------------------------------------------------ */
-struct cci_context_d cci_context_initializer = {
- NULL
+struct cci_context_d cci_context_initializer = {
+ NULL
VECTOR_FUNCTIONS_INITIALIZER,
NULL,
0,
0
};
-cc_context_f cci_context_f_initializer = {
+cc_context_f cci_context_f_initializer = {
ccapi_context_release,
ccapi_context_get_change_time,
ccapi_context_get_default_ccache_name,
@@ -73,7 +73,7 @@ cc_context_f cci_context_f_initializer = {
ccapi_context_wait_for_change
};
-static cc_int32 cci_context_sync (cci_context_t in_context,
+static cc_int32 cci_context_sync (cci_context_t in_context,
cc_uint32 in_launch);
#ifdef TARGET_OS_MAC
@@ -88,19 +88,19 @@ MAKE_FINI_FUNCTION(cci_thread_fini);
static int cci_thread_init (void)
{
cc_int32 err = ccNoError;
-
+
if (!err) {
err = cci_context_change_time_thread_init ();
}
-
+
if (!err) {
err = cci_ipc_thread_init ();
}
-
+
if (!err) {
add_error_table (&et_CAPI_error_table);
}
-
+
return err;
}
@@ -111,7 +111,7 @@ static void cci_thread_fini (void)
if (!INITIALIZER_RAN (cci_thread_init) || PROGRAM_EXITING ()) {
return;
}
-
+
remove_error_table(&et_CAPI_error_table);
cci_context_change_time_thread_fini ();
cci_ipc_thread_fini ();
@@ -132,64 +132,64 @@ cc_int32 cc_initialize (cc_context_t *out_context,
cc_int32 err = ccNoError;
cci_context_t context = NULL;
static char *vendor_string = "MIT Kerberos CCAPI";
-
+
if (!out_context) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = CALL_INIT_FUNCTION (cci_thread_init);
}
-
+
if (!err) {
- switch (in_version) {
- case ccapi_version_2:
+ switch (in_version) {
+ case ccapi_version_2:
case ccapi_version_3:
case ccapi_version_4:
case ccapi_version_5:
case ccapi_version_6:
case ccapi_version_7:
break;
-
- default:
+
+ default:
err = ccErrBadAPIVersion;
break;
}
}
-
+
if (!err) {
context = malloc (sizeof (*context));
- if (context) {
+ if (context) {
*context = cci_context_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
context->functions = malloc (sizeof (*context->functions));
- if (context->functions) {
+ if (context->functions) {
*context->functions = cci_context_f_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
context->identifier = cci_identifier_uninitialized;
*out_context = (cc_context_t) context;
context = NULL; /* take ownership */
-
+
if (out_supported_version) {
*out_supported_version = ccapi_version_max;
}
-
+
if (out_vendor) {
*out_vendor = vendor_string;
}
}
-
+
ccapi_context_release ((cc_context_t) context);
-
+
return cci_check_error (err);
}
@@ -198,30 +198,30 @@ cc_int32 cc_initialize (cc_context_t *out_context,
#endif
/* ------------------------------------------------------------------------ */
-/*
- * Currently does not need to talk to the server since the server must
- * handle cleaning up resources from crashed clients anyway.
- *
- * NOTE: if server communication is ever added here, make sure that
+/*
+ * Currently does not need to talk to the server since the server must
+ * handle cleaning up resources from crashed clients anyway.
+ *
+ * NOTE: if server communication is ever added here, make sure that
* krb5_stdcc_shutdown calls an internal function which does not talk to the
- * server. krb5_stdcc_shutdown is called from thread fini functions and may
- * crash talking to the server depending on what order the OS calls the fini
- * functions (ie: if the ipc layer fini function is called first).
+ * server. krb5_stdcc_shutdown is called from thread fini functions and may
+ * crash talking to the server depending on what order the OS calls the fini
+ * functions (ie: if the ipc layer fini function is called first).
*/
cc_int32 ccapi_context_release (cc_context_t in_context)
{
cc_int32 err = ccNoError;
cci_context_t context = (cci_context_t) in_context;
-
+
if (!in_context) { err = ccErrBadParam; }
-
+
if (!err) {
cci_identifier_release (context->identifier);
free (context->functions);
free (context);
}
-
+
return err;
}
@@ -233,10 +233,10 @@ cc_int32 ccapi_context_get_change_time (cc_context_t in_context,
cc_int32 err = ccNoError;
cci_context_t context = (cci_context_t) in_context;
k5_ipc_stream reply = NULL;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!out_change_time) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_context_sync (context, 0);
}
@@ -246,25 +246,25 @@ cc_int32 ccapi_context_get_change_time (cc_context_t in_context,
context->identifier,
NULL, &reply);
}
-
+
if (!err && krb5int_ipc_stream_size (reply) > 0) {
cc_time_t change_time = 0;
-
+
/* got a response from the server */
err = krb5int_ipc_stream_read_time (reply, &change_time);
-
+
if (!err) {
err = cci_context_change_time_update (context->identifier,
change_time);
}
}
-
+
if (!err) {
err = cci_context_change_time_get (out_change_time);
}
-
+
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
@@ -276,13 +276,13 @@ cc_int32 ccapi_context_wait_for_change (cc_context_t in_context)
cci_context_t context = (cci_context_t) in_context;
k5_ipc_stream request = NULL;
k5_ipc_stream reply = NULL;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (request, context->last_wait_for_change_time);
}
@@ -290,18 +290,18 @@ cc_int32 ccapi_context_wait_for_change (cc_context_t in_context)
if (!err) {
err = cci_context_sync (context, 1);
}
-
+
if (!err) {
err = cci_ipc_send (cci_context_wait_for_change_msg_id,
context->identifier,
- request,
+ request,
&reply);
}
if (!err) {
err = krb5int_ipc_stream_read_time (reply, &context->last_wait_for_change_time);
}
-
+
krb5int_ipc_stream_release (request);
krb5int_ipc_stream_release (reply);
@@ -318,26 +318,26 @@ cc_int32 ccapi_context_get_default_ccache_name (cc_context_t in_context,
k5_ipc_stream reply = NULL;
char *reply_name = NULL;
char *name = NULL;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!out_name ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_context_sync (context, 0);
}
-
+
if (!err) {
err = cci_ipc_send_no_launch (cci_context_get_default_ccache_name_msg_id,
context->identifier,
NULL,
&reply);
}
-
+
if (!err) {
if (krb5int_ipc_stream_size (reply) > 0) {
/* got a response from the server */
err = krb5int_ipc_stream_read_string (reply, &reply_name);
-
+
if (!err) {
name = reply_name;
}
@@ -345,14 +345,14 @@ cc_int32 ccapi_context_get_default_ccache_name (cc_context_t in_context,
name = k_cci_context_initial_ccache_name;
}
}
-
+
if (!err) {
err = cci_string_new (out_name, name);
}
-
+
krb5int_ipc_stream_release (reply);
krb5int_ipc_stream_free_string (reply_name);
-
+
return cci_check_error (err);
}
@@ -367,46 +367,46 @@ cc_int32 ccapi_context_open_ccache (cc_context_t in_context,
k5_ipc_stream request = NULL;
k5_ipc_stream reply = NULL;
cci_identifier_t identifier = NULL;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!in_name ) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (request, in_name);
}
-
+
if (!err) {
err = cci_context_sync (context, 0);
}
-
+
if (!err) {
err = cci_ipc_send_no_launch (cci_context_open_ccache_msg_id,
context->identifier,
request,
&reply);
}
-
+
if (!err && !(krb5int_ipc_stream_size (reply) > 0)) {
err = ccErrCCacheNotFound;
}
-
+
if (!err) {
err = cci_identifier_read (&identifier, reply);
}
-
+
if (!err) {
err = cci_ccache_new (out_ccache, identifier);
}
-
+
cci_identifier_release (identifier);
krb5int_ipc_stream_release (reply);
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -419,36 +419,36 @@ cc_int32 ccapi_context_open_default_ccache (cc_context_t in_context,
cci_context_t context = (cci_context_t) in_context;
k5_ipc_stream reply = NULL;
cci_identifier_t identifier = NULL;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_context_sync (context, 0);
}
-
+
if (!err) {
err = cci_ipc_send_no_launch (cci_context_open_default_ccache_msg_id,
context->identifier,
NULL,
&reply);
}
-
+
if (!err && !(krb5int_ipc_stream_size (reply) > 0)) {
err = ccErrCCacheNotFound;
}
-
+
if (!err) {
err = cci_identifier_read (&identifier, reply);
}
-
+
if (!err) {
err = cci_ccache_new (out_ccache, identifier);
}
-
+
cci_identifier_release (identifier);
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
@@ -457,7 +457,7 @@ cc_int32 ccapi_context_open_default_ccache (cc_context_t in_context,
cc_int32 ccapi_context_create_ccache (cc_context_t in_context,
const char *in_name,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache)
{
cc_int32 err = ccNoError;
@@ -465,51 +465,51 @@ cc_int32 ccapi_context_create_ccache (cc_context_t in_context,
k5_ipc_stream request = NULL;
k5_ipc_stream reply = NULL;
cci_identifier_t identifier = NULL;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!in_name ) { err = cci_check_error (ccErrBadParam); }
if (!in_principal) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (request, in_name);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_cred_vers);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (request, in_principal);
}
-
+
if (!err) {
err = cci_context_sync (context, 1);
}
-
+
if (!err) {
err = cci_ipc_send (cci_context_create_ccache_msg_id,
context->identifier,
request,
&reply);
}
-
+
if (!err) {
err = cci_identifier_read (&identifier, reply);
}
-
+
if (!err) {
err = cci_ccache_new (out_ccache, identifier);
}
-
+
cci_identifier_release (identifier);
krb5int_ipc_stream_release (reply);
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -517,7 +517,7 @@ cc_int32 ccapi_context_create_ccache (cc_context_t in_context,
cc_int32 ccapi_context_create_default_ccache (cc_context_t in_context,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache)
{
cc_int32 err = ccNoError;
@@ -525,46 +525,46 @@ cc_int32 ccapi_context_create_default_ccache (cc_context_t in_context,
k5_ipc_stream request = NULL;
k5_ipc_stream reply = NULL;
cci_identifier_t identifier = NULL;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!in_principal) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_cred_vers);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (request, in_principal);
}
-
+
if (!err) {
err = cci_context_sync (context, 1);
}
-
+
if (!err) {
err = cci_ipc_send (cci_context_create_default_ccache_msg_id,
context->identifier,
request,
&reply);
}
-
+
if (!err) {
err = cci_identifier_read (&identifier, reply);
}
-
+
if (!err) {
err = cci_ccache_new (out_ccache, identifier);
}
-
+
cci_identifier_release (identifier);
krb5int_ipc_stream_release (reply);
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -572,7 +572,7 @@ cc_int32 ccapi_context_create_default_ccache (cc_context_t in_context,
cc_int32 ccapi_context_create_new_ccache (cc_context_t in_context,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache)
{
cc_int32 err = ccNoError;
@@ -580,46 +580,46 @@ cc_int32 ccapi_context_create_new_ccache (cc_context_t in_context,
k5_ipc_stream request = NULL;
k5_ipc_stream reply = NULL;
cci_identifier_t identifier = NULL;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!in_principal) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_cred_vers);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (request, in_principal);
}
-
+
if (!err) {
err = cci_context_sync (context, 1);
}
-
+
if (!err) {
err = cci_ipc_send (cci_context_create_new_ccache_msg_id,
context->identifier,
request,
&reply);
}
-
+
if (!err) {
err = cci_identifier_read (&identifier, reply);
}
-
+
if (!err) {
err = cci_ccache_new (out_ccache, identifier);
}
-
+
cci_identifier_release (identifier);
krb5int_ipc_stream_release (reply);
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -632,21 +632,21 @@ cc_int32 ccapi_context_new_ccache_iterator (cc_context_t in_context,
cci_context_t context = (cci_context_t) in_context;
k5_ipc_stream reply = NULL;
cci_identifier_t identifier = NULL;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!out_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_context_sync (context, 0);
}
-
+
if (!err) {
err = cci_ipc_send_no_launch (cci_context_new_ccache_iterator_msg_id,
context->identifier,
NULL,
&reply);
}
-
+
if (!err) {
if (krb5int_ipc_stream_size (reply) > 0) {
err = cci_identifier_read (&identifier, reply);
@@ -654,7 +654,7 @@ cc_int32 ccapi_context_new_ccache_iterator (cc_context_t in_context,
identifier = cci_identifier_uninitialized;
}
}
-
+
if (!err) {
err = cci_ccache_iterator_new (out_iterator, identifier);
}
@@ -674,34 +674,34 @@ cc_int32 ccapi_context_lock (cc_context_t in_context,
cc_int32 err = ccNoError;
cci_context_t context = (cci_context_t) in_context;
k5_ipc_stream request = NULL;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&request);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_lock_type);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (request, in_block);
}
-
+
if (!err) {
err = cci_context_sync (context, 1);
}
-
+
if (!err) {
err = cci_ipc_send (cci_context_lock_msg_id,
context->identifier,
request,
NULL);
}
-
+
krb5int_ipc_stream_release (request);
-
+
return cci_check_error (err);
}
@@ -711,20 +711,20 @@ cc_int32 ccapi_context_unlock (cc_context_t in_context)
{
cc_int32 err = ccNoError;
cci_context_t context = (cci_context_t) in_context;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_context_sync (context, 1);
}
-
+
if (!err) {
err = cci_ipc_send (cci_context_unlock_msg_id,
context->identifier,
NULL,
NULL);
}
-
+
return cci_check_error (err);
}
@@ -737,27 +737,27 @@ cc_int32 ccapi_context_compare (cc_context_t in_context,
cc_int32 err = ccNoError;
cci_context_t context = (cci_context_t) in_context;
cci_context_t compare_to_context = (cci_context_t) in_compare_to_context;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!in_compare_to_context) { err = cci_check_error (ccErrBadParam); }
if (!out_equal ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_context_sync (context, 0);
}
-
+
if (!err) {
err = cci_context_sync (compare_to_context, 0);
}
-
+
if (!err) {
- /* If both contexts can't talk to the server, then
+ /* If both contexts can't talk to the server, then
* we assume they are equivalent */
- err = cci_identifier_compare (context->identifier,
+ err = cci_identifier_compare (context->identifier,
compare_to_context->identifier,
out_equal);
}
-
+
return cci_check_error (err);
}
@@ -767,16 +767,16 @@ cc_int32 ccapi_context_compare (cc_context_t in_context,
/* ------------------------------------------------------------------------ */
-static cc_int32 cci_context_sync (cci_context_t in_context,
+static cc_int32 cci_context_sync (cci_context_t in_context,
cc_uint32 in_launch)
{
cc_int32 err = ccNoError;
cci_context_t context = (cci_context_t) in_context;
k5_ipc_stream reply = NULL;
cci_identifier_t new_identifier = NULL;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
/* Use the uninitialized identifier because we may be talking */
/* to a different server which would reject our identifier and */
@@ -793,7 +793,7 @@ static cc_int32 cci_context_sync (cci_context_t in_context,
&reply);
}
}
-
+
if (!err) {
if (krb5int_ipc_stream_size (reply) > 0) {
err = cci_identifier_read (&new_identifier, reply);
@@ -801,7 +801,7 @@ static cc_int32 cci_context_sync (cci_context_t in_context,
new_identifier = cci_identifier_uninitialized;
}
}
-
+
if (!err) {
cc_uint32 equal = 0;
@@ -815,20 +815,19 @@ static cc_int32 cci_context_sync (cci_context_t in_context,
new_identifier = NULL; /* take ownership */
}
}
-
+
if (!err && context->synchronized) {
err = cci_context_change_time_sync (context->identifier);
}
-
+
if (!err && !context->synchronized) {
/* Keep state about whether this is the first call to avoid always */
/* modifying the global change time on the context's first ipc call. */
context->synchronized = 1;
}
-
+
cci_identifier_release (new_identifier);
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
-
diff --git a/src/ccapi/lib/ccapi_context.h b/src/ccapi/lib/ccapi_context.h
index 564f49d..8bc2e36 100644
--- a/src/ccapi/lib/ccapi_context.h
+++ b/src/ccapi/lib/ccapi_context.h
@@ -29,7 +29,7 @@
#include "cci_common.h"
-/* Used for freeing ccapi context in thread fini calls
+/* Used for freeing ccapi context in thread fini calls
* Does not tell the server you are exiting. */
cc_int32 cci_context_destroy (cc_context_t in_context);
@@ -53,17 +53,17 @@ cc_int32 ccapi_context_open_default_ccache (cc_context_t in_context,
cc_int32 ccapi_context_create_ccache (cc_context_t in_context,
const char *in_name,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache);
cc_int32 ccapi_context_create_default_ccache (cc_context_t in_context,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache);
cc_int32 ccapi_context_create_new_ccache (cc_context_t in_context,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache);
cc_int32 ccapi_context_new_ccache_iterator (cc_context_t in_context,
diff --git a/src/ccapi/lib/ccapi_context_change_time.c b/src/ccapi/lib/ccapi_context_change_time.c
index 4efc7db..602ab26 100644
--- a/src/ccapi/lib/ccapi_context_change_time.c
+++ b/src/ccapi/lib/ccapi_context_change_time.c
@@ -60,27 +60,27 @@ static cc_int32 cci_context_change_time_update_identifier (cci_identifier_t in_
cc_uint32 server_ids_match = 0;
cc_uint32 old_server_running = 0;
cc_uint32 new_server_running = 0;
-
+
if (!in_new_identifier) { err = cci_check_error (err); }
-
+
if (!err && !g_change_time_identifer) {
g_change_time_identifer = cci_identifier_uninitialized;
}
-
+
if (!err) {
err = cci_identifier_compare_server_id (g_change_time_identifer,
in_new_identifier,
&server_ids_match);
}
-
+
if (!err && out_old_server_running) {
err = cci_identifier_is_initialized (g_change_time_identifer, &old_server_running);
}
-
+
if (!err && out_new_server_running) {
err = cci_identifier_is_initialized (in_new_identifier, &new_server_running);
}
-
+
if (!err && !server_ids_match) {
cci_identifier_t new_change_time_identifer = NULL;
@@ -94,14 +94,14 @@ static cc_int32 cci_context_change_time_update_identifier (cci_identifier_t in_
g_change_time_identifer = new_change_time_identifer;
}
}
-
+
if (!err) {
if (out_server_ids_match ) { *out_server_ids_match = server_ids_match; }
if (out_old_server_running) { *out_old_server_running = old_server_running; }
if (out_new_server_running) { *out_new_server_running = new_server_running; }
}
-
-
+
+
return cci_check_error (err);
}
@@ -114,14 +114,14 @@ static cc_int32 cci_context_change_time_update_identifier (cci_identifier_t in_
cc_int32 cci_context_change_time_get (cc_time_t *out_change_time)
{
cc_int32 err = ccNoError;
-
+
err = k5_mutex_lock (&g_change_time_mutex);
-
+
if (!err) {
*out_change_time = g_change_time + g_change_time_offset;
- k5_mutex_unlock (&g_change_time_mutex);
+ k5_mutex_unlock (&g_change_time_mutex);
}
-
+
return err;
}
@@ -132,25 +132,25 @@ cc_int32 cci_context_change_time_update (cci_identifier_t in_identifier,
{
cc_int32 err = ccNoError;
cc_int32 lock_err = err = k5_mutex_lock (&g_change_time_mutex);
-
+
if (!err) {
if (!in_identifier) { err = cci_check_error (err); }
}
-
+
if (!err) {
if (g_change_time < in_new_change_time) {
/* Only update if it increases the time. May be a different server. */
g_change_time = in_new_change_time;
- cci_debug_printf ("%s: setting change time to %d",
+ cci_debug_printf ("%s: setting change time to %d",
__FUNCTION__, in_new_change_time);
}
}
-
+
if (!err) {
err = cci_context_change_time_update_identifier (in_identifier,
NULL, NULL, NULL);
}
-
+
if (!lock_err) {
k5_mutex_unlock (&g_change_time_mutex);
}
@@ -167,43 +167,43 @@ cc_int32 cci_context_change_time_sync (cci_identifier_t in_new_identifier)
cc_uint32 server_ids_match = 0;
cc_uint32 server_was_running = 0;
cc_uint32 server_is_running = 0;
-
+
if (!err) {
if (!in_new_identifier) { err = cci_check_error (err); }
}
-
+
if (!err) {
err = cci_context_change_time_update_identifier (in_new_identifier,
&server_ids_match,
&server_was_running,
&server_is_running);
}
-
- if (!err && !server_ids_match) {
+
+ if (!err && !server_ids_match) {
/* Increment the change time so callers re-read */
- g_change_time_offset++;
-
+ g_change_time_offset++;
+
/* If the server died, absorb the offset */
if (server_was_running && !server_is_running) {
cc_time_t now = time (NULL);
-
+
g_change_time += g_change_time_offset;
g_change_time_offset = 0;
-
+
/* Make sure the change time increases, ideally with the current time */
g_change_time = (g_change_time < now) ? now : g_change_time;
}
-
+
cci_debug_printf ("%s noticed server changed ("
"server_was_running = %d; server_is_running = %d; "
- "g_change_time = %d; g_change_time_offset = %d",
- __FUNCTION__, server_was_running, server_is_running,
- g_change_time, g_change_time_offset);
+ "g_change_time = %d; g_change_time_offset = %d",
+ __FUNCTION__, server_was_running, server_is_running,
+ g_change_time, g_change_time_offset);
}
-
+
if (!lock_err) {
k5_mutex_unlock (&g_change_time_mutex);
}
-
+
return err;
}
diff --git a/src/ccapi/lib/ccapi_credentials.c b/src/ccapi/lib/ccapi_credentials.c
index 6a3b4cb..c94b551 100644
--- a/src/ccapi/lib/ccapi_credentials.c
+++ b/src/ccapi/lib/ccapi_credentials.c
@@ -41,14 +41,14 @@ typedef struct cci_credentials_d {
/* ------------------------------------------------------------------------ */
-struct cci_credentials_d cci_credentials_initializer = {
- NULL,
- NULL
- VECTOR_FUNCTIONS_INITIALIZER,
+struct cci_credentials_d cci_credentials_initializer = {
+ NULL,
+ NULL
+ VECTOR_FUNCTIONS_INITIALIZER,
NULL
};
-cc_credentials_f cci_credentials_f_initializer = {
+cc_credentials_f cci_credentials_f_initializer = {
ccapi_credentials_release,
ccapi_credentials_compare
};
@@ -65,43 +65,43 @@ cc_int32 cci_credentials_read (cc_credentials_t *out_credentials,
{
cc_int32 err = ccNoError;
cci_credentials_t credentials = NULL;
-
+
if (!out_credentials) { err = cci_check_error (ccErrBadParam); }
if (!in_stream ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
credentials = malloc (sizeof (*credentials));
- if (credentials) {
+ if (credentials) {
*credentials = cci_credentials_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
credentials->functions = malloc (sizeof (*credentials->functions));
- if (credentials->functions) {
+ if (credentials->functions) {
*credentials->functions = cci_credentials_f_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = cci_identifier_read (&credentials->identifier, in_stream);
}
-
+
if (!err) {
err = cci_credentials_union_read (&credentials->data, in_stream);
}
-
+
if (!err) {
*out_credentials = (cc_credentials_t) credentials;
credentials = NULL; /* take ownership */
}
-
+
if (credentials) { ccapi_credentials_release ((cc_credentials_t) credentials); }
-
+
return cci_check_error (err);
}
@@ -112,14 +112,14 @@ cc_int32 cci_credentials_write (cc_credentials_t in_credentials,
{
cc_int32 err = ccNoError;
cci_credentials_t credentials = (cci_credentials_t) in_credentials;
-
+
if (!in_credentials) { err = cci_check_error (ccErrBadParam); }
if (!in_stream ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_identifier_write (credentials->identifier, in_stream);
}
-
+
return cci_check_error (err);
}
@@ -132,17 +132,17 @@ cc_int32 ccapi_credentials_compare (cc_credentials_t in_credentials,
cc_int32 err = ccNoError;
cci_credentials_t credentials = (cci_credentials_t) in_credentials;
cci_credentials_t compare_to_credentials = (cci_credentials_t) in_compare_to_credentials;
-
+
if (!in_credentials ) { err = cci_check_error (ccErrBadParam); }
if (!in_compare_to_credentials) { err = cci_check_error (ccErrBadParam); }
if (!out_equal ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = cci_identifier_compare (credentials->identifier,
+ err = cci_identifier_compare (credentials->identifier,
compare_to_credentials->identifier,
out_equal);
}
-
+
return cci_check_error (err);
}
@@ -152,15 +152,15 @@ cc_int32 ccapi_credentials_release (cc_credentials_t io_credentials)
{
cc_int32 err = ccNoError;
cci_credentials_t credentials = (cci_credentials_t) io_credentials;
-
+
if (!io_credentials) { err = ccErrBadParam; }
-
+
if (!err) {
cci_credentials_union_release (credentials->data);
free ((char *) credentials->functions);
cci_identifier_release (credentials->identifier);
free (credentials);
}
-
+
return err;
}
diff --git a/src/ccapi/lib/ccapi_credentials_iterator.c b/src/ccapi/lib/ccapi_credentials_iterator.c
index 59ffc7c..0ff6148 100644
--- a/src/ccapi/lib/ccapi_credentials_iterator.c
+++ b/src/ccapi/lib/ccapi_credentials_iterator.c
@@ -41,14 +41,14 @@ typedef struct cci_credentials_iterator_d {
/* ------------------------------------------------------------------------ */
-struct cci_credentials_iterator_d cci_credentials_iterator_initializer = {
- NULL
- VECTOR_FUNCTIONS_INITIALIZER,
+struct cci_credentials_iterator_d cci_credentials_iterator_initializer = {
+ NULL
+ VECTOR_FUNCTIONS_INITIALIZER,
NULL,
0
};
-cc_credentials_iterator_f cci_credentials_iterator_f_initializer = {
+cc_credentials_iterator_f cci_credentials_iterator_f_initializer = {
ccapi_credentials_iterator_release,
ccapi_credentials_iterator_next,
ccapi_credentials_iterator_clone
@@ -61,39 +61,39 @@ cc_int32 cci_credentials_iterator_new (cc_credentials_iterator_t *out_credential
{
cc_int32 err = ccNoError;
cci_credentials_iterator_t credentials_iterator = NULL;
-
+
if (!out_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
credentials_iterator = malloc (sizeof (*credentials_iterator));
- if (credentials_iterator) {
+ if (credentials_iterator) {
*credentials_iterator = cci_credentials_iterator_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
credentials_iterator->functions = malloc (sizeof (*credentials_iterator->functions));
- if (credentials_iterator->functions) {
+ if (credentials_iterator->functions) {
*credentials_iterator->functions = cci_credentials_iterator_f_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = cci_identifier_copy (&credentials_iterator->identifier, in_identifier);
}
-
+
if (!err) {
*out_credentials_iterator = (cc_credentials_iterator_t) credentials_iterator;
credentials_iterator = NULL; /* take ownership */
}
-
+
if (credentials_iterator) { ccapi_credentials_iterator_release ((cc_credentials_iterator_t) credentials_iterator); }
-
+
return cci_check_error (err);
}
@@ -104,14 +104,14 @@ cc_int32 cci_credentials_iterator_write (cc_credentials_iterator_t in_credential
{
cc_int32 err = ccNoError;
cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) in_credentials_iterator;
-
+
if (!in_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
if (!in_stream ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_identifier_write (credentials_iterator->identifier, in_stream);
}
-
+
return cci_check_error (err);
}
@@ -121,16 +121,16 @@ cc_int32 ccapi_credentials_iterator_release (cc_credentials_iterator_t io_creden
{
cc_int32 err = ccNoError;
cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) io_credentials_iterator;
-
+
if (!io_credentials_iterator) { err = ccErrBadParam; }
-
+
if (!err) {
err = cci_ipc_send (cci_credentials_iterator_release_msg_id,
credentials_iterator->identifier,
NULL,
NULL);
if (err) {
- cci_debug_printf ("%s: cci_ipc_send failed with error %d",
+ cci_debug_printf ("%s: cci_ipc_send failed with error %d",
__FUNCTION__, err);
err = ccNoError;
}
@@ -141,7 +141,7 @@ cc_int32 ccapi_credentials_iterator_release (cc_credentials_iterator_t io_creden
cci_identifier_release (credentials_iterator->identifier);
free (credentials_iterator);
}
-
+
return err;
}
@@ -153,23 +153,23 @@ cc_int32 ccapi_credentials_iterator_next (cc_credentials_iterator_t in_credenti
cc_int32 err = ccNoError;
cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) in_credentials_iterator;
k5_ipc_stream reply = NULL;
-
+
if (!in_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
if (!out_credentials ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ipc_send (cci_credentials_iterator_next_msg_id,
credentials_iterator->identifier,
NULL,
&reply);
}
-
+
if (!err) {
err = cci_credentials_read (out_credentials, reply);
}
-
+
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
@@ -182,28 +182,28 @@ cc_int32 ccapi_credentials_iterator_clone (cc_credentials_iterator_t in_credent
cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) in_credentials_iterator;
k5_ipc_stream reply = NULL;
cci_identifier_t identifier = NULL;
-
+
if (!in_credentials_iterator ) { err = cci_check_error (ccErrBadParam); }
if (!out_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ipc_send (cci_credentials_iterator_next_msg_id,
credentials_iterator->identifier,
NULL,
&reply);
}
-
+
if (!err) {
err = cci_identifier_read (&identifier, reply);
}
-
+
if (!err) {
err = cci_credentials_iterator_new (out_credentials_iterator, identifier);
}
-
+
krb5int_ipc_stream_release (reply);
cci_identifier_release (identifier);
-
+
return cci_check_error (err);
}
@@ -218,14 +218,14 @@ cc_int32 cci_credentials_iterator_get_compat_version (cc_credentials_iterator_t
{
cc_int32 err = ccNoError;
cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) in_credentials_iterator;
-
+
if (!in_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
if (!out_compat_version ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
*out_compat_version = credentials_iterator->compat_version;
}
-
+
return cci_check_error (err);
}
@@ -236,12 +236,12 @@ cc_int32 cci_credentials_iterator_set_compat_version (cc_credentials_iterator_t
{
cc_int32 err = ccNoError;
cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) io_credentials_iterator;
-
+
if (!io_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
credentials_iterator->compat_version = in_compat_version;
}
-
+
return cci_check_error (err);
}
diff --git a/src/ccapi/lib/ccapi_ipc.c b/src/ccapi/lib/ccapi_ipc.c
index 8d8b2d2..54b5faa 100644
--- a/src/ccapi/lib/ccapi_ipc.c
+++ b/src/ccapi/lib/ccapi_ipc.c
@@ -53,23 +53,23 @@ static cc_int32 _cci_ipc_send (enum cci_msg_id_t in_request_name,
k5_ipc_stream request = NULL;
k5_ipc_stream reply = NULL;
cc_int32 reply_error = 0;
-
+
if (!in_identifier) { err = cci_check_error (ccErrBadParam); }
/* in_request_data may be NULL */
/* out_reply_data may be NULL */
-
+
if (!err) {
err = cci_message_new_request_header (&request,
in_request_name,
in_identifier);
}
-
+
if (!err && in_request_data) {
- err = krb5int_ipc_stream_write (request,
- krb5int_ipc_stream_data (in_request_data),
+ err = krb5int_ipc_stream_write (request,
+ krb5int_ipc_stream_data (in_request_data),
krb5int_ipc_stream_size (in_request_data));
}
-
+
if (!err) {
err = cci_os_ipc (in_launch_server, request, &reply);
@@ -77,19 +77,19 @@ static cc_int32 _cci_ipc_send (enum cci_msg_id_t in_request_name,
err = cci_message_read_reply_header (reply, &reply_error);
}
}
-
- if (!err && reply_error) {
+
+ if (!err && reply_error) {
err = reply_error;
}
-
+
if (!err && out_reply_data) {
*out_reply_data = reply;
reply = NULL; /* take ownership */
}
-
+
krb5int_ipc_stream_release (request);
krb5int_ipc_stream_release (reply);
-
+
return cci_check_error (err);
}
diff --git a/src/ccapi/lib/ccapi_string.c b/src/ccapi/lib/ccapi_string.c
index 4f4db6f..d0386c3 100644
--- a/src/ccapi/lib/ccapi_string.c
+++ b/src/ccapi/lib/ccapi_string.c
@@ -28,13 +28,13 @@
/* ------------------------------------------------------------------------ */
-cc_string_d cci_string_d_initializer = {
- NULL,
- NULL
+cc_string_d cci_string_d_initializer = {
+ NULL,
+ NULL
VECTOR_FUNCTIONS_INITIALIZER };
-cc_string_f cci_string_f_initializer = {
- ccapi_string_release
+cc_string_f cci_string_f_initializer = {
+ ccapi_string_release
};
/* ------------------------------------------------------------------------ */
@@ -44,43 +44,43 @@ cc_int32 cci_string_new (cc_string_t *out_string,
{
cc_int32 err = ccNoError;
cc_string_t string = NULL;
-
+
if (!out_string) { err = cci_check_error (ccErrBadParam); }
if (!in_cstring) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
string = malloc (sizeof (*string));
- if (string) {
+ if (string) {
*string = cci_string_d_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
if (!err) {
string->functions = malloc (sizeof (*string->functions));
- if (string->functions) {
+ if (string->functions) {
*((cc_string_f *) string->functions) = cci_string_f_initializer;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
string->data = strdup (in_cstring);
- if (!string->data) {
- err = cci_check_error (ccErrNoMem);
+ if (!string->data) {
+ err = cci_check_error (ccErrNoMem);
}
-
+
}
-
+
if (!err) {
*out_string = string;
string = NULL; /* take ownership */
}
-
+
if (string) { ccapi_string_release (string); }
-
+
return cci_check_error (err);
}
@@ -89,14 +89,14 @@ cc_int32 cci_string_new (cc_string_t *out_string,
cc_int32 ccapi_string_release (cc_string_t in_string)
{
cc_int32 err = ccNoError;
-
+
if (!in_string) { err = ccErrBadParam; }
-
+
if (!err) {
free ((char *) in_string->data);
free ((char *) in_string->functions);
free (in_string);
}
-
+
return err;
}
diff --git a/src/ccapi/lib/ccapi_v2.c b/src/ccapi/lib/ccapi_v2.c
index 0810048..04edd86 100644
--- a/src/ccapi/lib/ccapi_v2.c
+++ b/src/ccapi/lib/ccapi_v2.c
@@ -38,47 +38,47 @@ infoNC infoNC_initializer = { NULL, NULL, CC_CRED_UNKNOWN };
/* ------------------------------------------------------------------------ */
static cc_int32 cci_remap_version (cc_int32 in_v2_version,
- cc_uint32 *out_v3_version)
+ cc_uint32 *out_v3_version)
{
cc_result err = ccNoError;
-
+
if (!out_v3_version) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
if (in_v2_version == CC_CRED_V4) {
*out_v3_version = cc_credentials_v4;
-
- } else if (in_v2_version == CC_CRED_V5) {
+
+ } else if (in_v2_version == CC_CRED_V5) {
*out_v3_version = cc_credentials_v5;
-
+
} else {
err = ccErrBadCredentialsVersion;
}
}
-
+
return cci_check_error (err);
-}
+}
/* ------------------------------------------------------------------------ */
-static cc_result _cci_remap_error (cc_result in_error,
- const char *in_function,
- const char *in_file,
- int in_line)
+static cc_result _cci_remap_error (cc_result in_error,
+ const char *in_function,
+ const char *in_file,
+ int in_line)
{
_cci_check_error (in_error, in_function, in_file, in_line);
-
+
if (in_error >= CC_NOERROR && in_error <= CC_ERR_CRED_VERSION) {
return in_error;
}
-
+
switch (in_error) {
case ccNoError:
return CC_NOERROR;
-
+
case ccIteratorEnd:
return CC_END;
-
+
case ccErrBadParam:
case ccErrContextNotFound:
case ccErrInvalidContext:
@@ -88,42 +88,42 @@ static cc_result _cci_remap_error (cc_result in_error,
case ccErrInvalidLock:
case ccErrBadLockType:
return CC_BAD_PARM;
-
+
case ccErrNoMem:
return CC_NOMEM;
-
+
case ccErrInvalidCCache:
case ccErrCCacheNotFound:
return CC_NO_EXIST;
-
+
case ccErrCredentialsNotFound:
return CC_NOTFOUND;
-
+
case ccErrBadName:
return CC_BADNAME;
-
+
case ccErrBadCredentialsVersion:
return CC_ERR_CRED_VERSION;
-
+
case ccErrBadAPIVersion:
return CC_BAD_API_VERSION;
-
+
case ccErrContextLocked:
case ccErrContextUnlocked:
case ccErrCCacheLocked:
case ccErrCCacheUnlocked:
return CC_LOCKED;
-
+
case ccErrServerUnavailable:
case ccErrServerInsecure:
case ccErrServerCantBecomeUID:
case ccErrBadInternalMessage:
case ccErrClientNotFound:
return CC_IO;
-
+
case ccErrNotImplemented:
return CC_NOT_SUPP;
-
+
default:
cci_debug_printf ("%s(): Unhandled error", __FUNCTION__);
return CC_BAD_PARM;
@@ -138,37 +138,37 @@ static cc_result _cci_remap_error (cc_result in_error,
/* ------------------------------------------------------------------------ */
-cc_result cc_shutdown (apiCB **io_context)
+cc_result cc_shutdown (apiCB **io_context)
{
cc_result err = ccNoError;
-
+
if (!io_context) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccapi_context_release (*io_context);
}
-
+
if (!err) {
*io_context = NULL;
}
-
+
return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_get_change_time (apiCB *in_context,
- cc_time_t *out_change_time)
+ cc_time_t *out_change_time)
{
cc_result err = ccNoError;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!out_change_time) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccapi_context_get_change_time (in_context, out_change_time);
}
-
+
return cci_remap_error (err);
}
@@ -181,86 +181,86 @@ cc_result cc_get_NC_info (apiCB *in_context,
infoNC **info = NULL;
cc_uint64 count = 0; /* Preflight the size */
cc_uint64 i;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!out_info ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
ccache_cit *iterator = NULL;
-
+
err = cc_seq_fetch_NCs_begin (in_context, &iterator);
-
+
while (!err) {
ccache_p *ccache = NULL;
-
+
err = cc_seq_fetch_NCs_next (in_context, &ccache, iterator);
-
+
if (!err) { count++; }
-
+
if (ccache) { cc_close (in_context, &ccache); }
}
if (err == CC_END) { err = CC_NOERROR; }
-
+
if (!err) {
err = cc_seq_fetch_NCs_end (in_context, &iterator);
- }
+ }
}
-
+
if (!err) {
info = malloc (sizeof (*info) * (count + 1));
- if (info) {
+ if (info) {
for (i = 0; i < count + 1; i++) { info[i] = NULL; }
- } else {
- err = cci_check_error (CC_NOMEM);
+ } else {
+ err = cci_check_error (CC_NOMEM);
}
}
-
+
if (!err) {
ccache_cit *iterator = NULL;
-
+
err = cc_seq_fetch_NCs_begin (in_context, &iterator);
-
+
for (i = 0; !err && i < count; i++) {
ccache_p *ccache = NULL;
-
+
err = cc_seq_fetch_NCs_next (in_context, &ccache, iterator);
-
+
if (!err) {
info[i] = malloc (sizeof (*info[i]));
- if (info[i]) {
- *info[i] = infoNC_initializer;
+ if (info[i]) {
+ *info[i] = infoNC_initializer;
} else {
- err = cci_check_error (CC_NOMEM);
+ err = cci_check_error (CC_NOMEM);
}
}
-
+
if (!err) {
err = cc_get_name (in_context, ccache, &info[i]->name);
}
-
+
if (!err) {
err = cc_get_principal (in_context, ccache, &info[i]->principal);
}
-
+
if (!err) {
err = cc_get_cred_version (in_context, ccache, &info[i]->vers);
}
-
+
if (ccache) { cc_close (in_context, &ccache); }
}
-
+
if (!err) {
err = cc_seq_fetch_NCs_end (in_context, &iterator);
}
}
-
+
if (!err) {
*out_info = info;
info = NULL;
}
-
+
if (info) { cc_free_NC_info (in_context, &info); }
-
+
return cci_check_error (err);
}
@@ -274,17 +274,17 @@ cc_int32 cc_open (apiCB *in_context,
const char *in_name,
cc_int32 in_version,
cc_uint32 in_flags,
- ccache_p **out_ccache)
-{
+ ccache_p **out_ccache)
+{
cc_result err = ccNoError;
cc_ccache_t ccache = NULL;
cc_uint32 compat_version;
cc_uint32 real_version;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!in_name ) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_remap_version (in_version, &compat_version);
}
@@ -292,15 +292,15 @@ cc_int32 cc_open (apiCB *in_context,
if (!err) {
err = ccapi_context_open_ccache (in_context, in_name, &ccache);
}
-
+
/* We must not allow a CCAPI v2 caller to open a v5-only ccache
- as a v4 ccache and vice versa. Allowing that would break
+ as a v4 ccache and vice versa. Allowing that would break
(valid) assumptions made by CCAPI v2 callers. */
-
+
if (!err) {
err = ccapi_ccache_get_credentials_version (ccache, &real_version);
- }
-
+ }
+
if (!err) {
/* check the version and set up the ccache to use it */
if (compat_version & real_version) {
@@ -309,16 +309,16 @@ cc_int32 cc_open (apiCB *in_context,
err = ccErrBadCredentialsVersion;
}
}
-
+
if (!err) {
*out_ccache = ccache;
ccache = NULL;
}
-
+
if (ccache) { ccapi_ccache_release (ccache); }
-
+
return cci_remap_error (err);
-}
+}
/* ------------------------------------------------------------------------ */
@@ -327,78 +327,78 @@ cc_result cc_create (apiCB *in_context,
const char *in_principal,
cc_int32 in_version,
cc_uint32 in_flags,
- ccache_p **out_ccache)
+ ccache_p **out_ccache)
{
cc_result err = ccNoError;
cc_ccache_t ccache = NULL;
cc_uint32 compat_version;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!in_name ) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_remap_version (in_version, &compat_version);
}
-
+
if (!err) {
err = ccapi_context_create_ccache (in_context, in_name, compat_version,
in_principal, &ccache);
}
-
+
if (!err) {
err = cci_ccache_set_compat_version (ccache, compat_version);
}
-
+
if (!err) {
*out_ccache = ccache;
ccache = NULL;
}
-
+
if (ccache) { ccapi_ccache_release (ccache); }
-
+
return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_close (apiCB *in_context,
- ccache_p **io_ccache)
+ ccache_p **io_ccache)
{
cc_result err = ccNoError;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccapi_ccache_release (*io_ccache);
}
-
+
if (!err) {
*io_ccache = NULL;
}
-
+
return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_destroy (apiCB *in_context,
- ccache_p **io_ccache)
+ ccache_p **io_ccache)
{
cc_result err = ccNoError;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccapi_ccache_destroy (*io_ccache);
}
-
+
if (!err) {
*io_ccache = NULL;
}
-
+
return cci_remap_error (err);
}
@@ -406,63 +406,63 @@ cc_result cc_destroy (apiCB *in_context,
cc_result cc_get_name (apiCB *in_context,
ccache_p *in_ccache,
- char **out_name)
+ char **out_name)
{
cc_result err = ccNoError;
cc_string_t name = NULL;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_name ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccapi_ccache_get_name (in_ccache, &name);
}
-
+
if (!err) {
char *string = strdup (name->data);
- if (string) {
+ if (string) {
*out_name = string;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (name) { ccapi_string_release (name); }
-
- return cci_remap_error (err);
+
+ return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_get_cred_version (apiCB *in_context,
ccache_p *in_ccache,
- cc_int32 *out_version)
+ cc_int32 *out_version)
{
cc_result err = ccNoError;
cc_uint32 compat_version;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_version) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ccache_get_compat_version (in_ccache, &compat_version);
}
-
+
if (!err) {
if (compat_version == cc_credentials_v4) {
*out_version = CC_CRED_V4;
-
- } else if (compat_version == cc_credentials_v5) {
+
+ } else if (compat_version == cc_credentials_v5) {
*out_version = CC_CRED_V5;
-
+
} else {
err = ccErrBadCredentialsVersion;
}
}
-
- return cci_remap_error (err);
+
+ return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -470,16 +470,16 @@ cc_result cc_get_cred_version (apiCB *in_context,
cc_result cc_set_principal (apiCB *in_context,
ccache_p *io_ccache,
cc_int32 in_version,
- char *in_principal)
+ char *in_principal)
{
cc_result err = ccNoError;
cc_uint32 version;
cc_uint32 compat_version;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_principal) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_remap_version (in_version, &version);
}
@@ -487,75 +487,75 @@ cc_result cc_set_principal (apiCB *in_context,
if (!err) {
err = cci_ccache_get_compat_version (io_ccache, &compat_version);
}
-
+
if (!err && version != compat_version) {
err = cci_check_error (ccErrBadCredentialsVersion);
}
-
+
if (!err) {
err = ccapi_ccache_set_principal (io_ccache, version, in_principal);
}
-
- return cci_remap_error (err);
+
+ return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_get_principal (apiCB *in_context,
ccache_p *in_ccache,
- char **out_principal)
+ char **out_principal)
{
cc_result err = ccNoError;
cc_uint32 compat_version;
cc_string_t principal = NULL;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_principal) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_ccache_get_compat_version (in_ccache, &compat_version);
}
-
+
if (!err) {
err = ccapi_ccache_get_principal (in_ccache, compat_version, &principal);
}
-
+
if (!err) {
char *string = strdup (principal->data);
- if (string) {
+ if (string) {
*out_principal = string;
- } else {
- err = cci_check_error (ccErrNoMem);
+ } else {
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (principal) { ccapi_string_release (principal); }
-
- return cci_remap_error (err);
+
+ return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_store (apiCB *in_context,
ccache_p *io_ccache,
- cred_union in_credentials)
+ cred_union in_credentials)
{
cc_result err = ccNoError;
cc_credentials_union *creds_union = NULL;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_cred_union_to_credentials_union (&in_credentials,
&creds_union);
}
-
+
if (!err) {
err = ccapi_ccache_store_credentials (io_ccache, creds_union);
}
-
+
if (creds_union) { cci_credentials_union_release (creds_union); }
return cci_remap_error (err);
}
@@ -564,39 +564,39 @@ cc_result cc_store (apiCB *in_context,
cc_result cc_remove_cred (apiCB *in_context,
ccache_p *in_ccache,
- cred_union in_credentials)
+ cred_union in_credentials)
{
cc_result err = ccNoError;
cc_credentials_iterator_t iterator = NULL;
cc_uint32 found = 0;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccapi_ccache_new_credentials_iterator (in_ccache, &iterator);
}
-
+
while (!err && !found) {
cc_credentials_t creds = NULL;
-
+
err = ccapi_credentials_iterator_next (iterator, &creds);
-
+
if (!err) {
- err = cci_cred_union_compare_to_credentials_union (&in_credentials,
+ err = cci_cred_union_compare_to_credentials_union (&in_credentials,
creds->data,
&found);
}
-
+
if (!err && found) {
err = ccapi_ccache_remove_credentials (in_ccache, creds);
}
-
+
ccapi_credentials_release (creds);
}
if (err == ccIteratorEnd) { err = cci_check_error (ccErrCredentialsNotFound); }
-
- return cci_remap_error (err);
+
+ return cci_remap_error (err);
}
#if TARGET_OS_MAC
@@ -606,25 +606,25 @@ cc_result cc_remove_cred (apiCB *in_context,
/* ------------------------------------------------------------------------ */
cc_result cc_seq_fetch_NCs_begin (apiCB *in_context,
- ccache_cit **out_iterator)
+ ccache_cit **out_iterator)
{
cc_result err = ccNoError;
cc_ccache_iterator_t iterator = NULL;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!out_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccapi_context_new_ccache_iterator (in_context, &iterator);
}
-
+
if (!err) {
*out_iterator = (ccache_cit *) iterator;
iterator = NULL; /* take ownership */
}
-
+
if (iterator) { ccapi_ccache_iterator_release (iterator); }
-
+
return cci_remap_error (err);
}
@@ -632,17 +632,17 @@ cc_result cc_seq_fetch_NCs_begin (apiCB *in_context,
cc_result cc_seq_fetch_NCs_next (apiCB *in_context,
ccache_p **out_ccache,
- ccache_cit *in_iterator)
+ ccache_cit *in_iterator)
{
cc_result err = ccNoError;
cc_ccache_iterator_t iterator = (cc_ccache_iterator_t) in_iterator;
cc_ccache_t ccache = NULL;
const char *saved_ccache_name;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
/* CCache iterators need to return some ccaches twice (when v3 ccache has
* two kinds of credentials). To do that, we return such ccaches twice
* v4 first, then v5. */
@@ -651,82 +651,82 @@ cc_result cc_seq_fetch_NCs_next (apiCB *in_context,
err = cci_ccache_iterator_get_saved_ccache_name (iterator,
&saved_ccache_name);
}
-
+
if (!err) {
if (saved_ccache_name) {
- err = ccapi_context_open_ccache (in_context, saved_ccache_name,
+ err = ccapi_context_open_ccache (in_context, saved_ccache_name,
&ccache);
-
+
if (!err) {
err = cci_ccache_set_compat_version (ccache, cc_credentials_v5);
}
-
+
if (!err) {
err = cci_ccache_iterator_set_saved_ccache_name (iterator, NULL);
}
-
+
} else {
cc_uint32 version = 0;
-
+
err = ccapi_ccache_iterator_next (iterator, &ccache);
-
+
if (!err) {
err = ccapi_ccache_get_credentials_version (ccache, &version);
}
-
+
if (!err) {
if (version == cc_credentials_v4_v5) {
cc_string_t name = NULL;
-
+
err = cci_ccache_set_compat_version (ccache, cc_credentials_v4);
-
- if (!err) {
+
+ if (!err) {
err = ccapi_ccache_get_name (ccache, &name);
- }
-
+ }
+
if (!err) {
- err = cci_ccache_iterator_set_saved_ccache_name (iterator,
+ err = cci_ccache_iterator_set_saved_ccache_name (iterator,
name->data);
}
-
+
if (name) { ccapi_string_release (name); }
-
+
} else {
err = cci_ccache_set_compat_version (ccache, version);
}
}
}
}
-
+
if (!err) {
*out_ccache = ccache;
ccache = NULL; /* take ownership */
}
-
+
if (ccache) { ccapi_ccache_release (ccache); }
-
+
return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_seq_fetch_NCs_end (apiCB *in_context,
- ccache_cit **io_iterator)
+ ccache_cit **io_iterator)
{
cc_result err = ccNoError;
cc_ccache_iterator_t iterator = (cc_ccache_iterator_t) *io_iterator;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!io_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccapi_ccache_iterator_release (iterator);
}
-
+
if (!err) {
*io_iterator = NULL;
}
-
+
return cci_remap_error (err);
}
@@ -738,38 +738,38 @@ cc_result cc_seq_fetch_NCs_end (apiCB *in_context,
cc_result cc_seq_fetch_creds_begin (apiCB *in_context,
const ccache_p *in_ccache,
- ccache_cit **out_iterator)
+ ccache_cit **out_iterator)
{
cc_result err = ccNoError;
cc_credentials_iterator_t iterator = NULL;
cc_uint32 compat_version;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!out_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = cci_ccache_get_compat_version ((cc_ccache_t) in_ccache,
+ err = cci_ccache_get_compat_version ((cc_ccache_t) in_ccache,
&compat_version);
}
-
+
if (!err) {
- err = ccapi_ccache_new_credentials_iterator ((cc_ccache_t) in_ccache,
+ err = ccapi_ccache_new_credentials_iterator ((cc_ccache_t) in_ccache,
&iterator);
}
-
+
if (!err) {
- err = cci_credentials_iterator_set_compat_version (iterator,
+ err = cci_credentials_iterator_set_compat_version (iterator,
compat_version);
}
-
+
if (!err) {
*out_iterator = (ccache_cit *) iterator;
iterator = NULL; /* take ownership */
}
-
+
if (iterator) { ccapi_credentials_iterator_release (iterator); }
-
+
return cci_remap_error (err);
}
@@ -777,58 +777,58 @@ cc_result cc_seq_fetch_creds_begin (apiCB *in_context,
cc_result cc_seq_fetch_creds_next (apiCB *in_context,
cred_union **out_creds,
- ccache_cit *in_iterator)
+ ccache_cit *in_iterator)
{
cc_result err = ccNoError;
cc_credentials_iterator_t iterator = (cc_credentials_iterator_t) in_iterator;
cc_uint32 compat_version;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!out_creds ) { err = cci_check_error (ccErrBadParam); }
if (!in_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = cci_credentials_iterator_get_compat_version (iterator,
+ err = cci_credentials_iterator_get_compat_version (iterator,
&compat_version);
}
while (!err) {
cc_credentials_t credentials = NULL;
-
+
err = ccapi_credentials_iterator_next (iterator, &credentials);
-
+
if (!err && (credentials->data->version & compat_version)) {
/* got the next credentials for the correct version */
- err = cci_credentials_union_to_cred_union (credentials->data,
+ err = cci_credentials_union_to_cred_union (credentials->data,
out_creds);
break;
}
-
+
if (credentials) { ccapi_credentials_release (credentials); }
}
-
+
return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_seq_fetch_creds_end (apiCB *in_context,
- ccache_cit **io_iterator)
+ ccache_cit **io_iterator)
{
cc_result err = ccNoError;
cc_credentials_iterator_t iterator = (cc_credentials_iterator_t) *io_iterator;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!io_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccapi_credentials_iterator_release (iterator);
}
-
+
if (!err) {
*io_iterator = NULL;
}
-
+
return cci_remap_error (err);
}
@@ -839,80 +839,80 @@ cc_result cc_seq_fetch_creds_end (apiCB *in_context,
/* ------------------------------------------------------------------------ */
cc_result cc_free_principal (apiCB *in_context,
- char **io_principal)
+ char **io_principal)
{
cc_result err = ccNoError;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!io_principal) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
free (*io_principal);
*io_principal = NULL;
}
-
+
return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_free_name (apiCB *in_context,
- char **io_name)
-{
+ char **io_name)
+{
cc_result err = ccNoError;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!io_name ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
free (*io_name);
*io_name = NULL;
}
-
+
return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_free_creds (apiCB *in_context,
- cred_union **io_credentials)
+ cred_union **io_credentials)
{
cc_result err = ccNoError;
-
+
if (!in_context ) { err = cci_check_error (ccErrBadParam); }
if (!io_credentials) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_cred_union_release (*io_credentials);
- if (!err) { *io_credentials = NULL; }
+ if (!err) { *io_credentials = NULL; }
}
-
+
return cci_remap_error (err);
}
/* ------------------------------------------------------------------------ */
cc_result cc_free_NC_info (apiCB *in_context,
- infoNC ***io_info)
-{
+ infoNC ***io_info)
+{
cc_result err = ccNoError;
-
+
if (!in_context) { err = cci_check_error (ccErrBadParam); }
if (!io_info ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err && *io_info) {
infoNC **data = *io_info;
int i;
-
+
for (i = 0; data[i] != NULL; i++) {
cc_free_principal (in_context, &data[i]->principal);
cc_free_name (in_context, &data[i]->name);
free (data[i]);
}
free (data);
-
+
*io_info = NULL;
}
-
+
return cci_remap_error (err);
}
diff --git a/src/ccapi/lib/mac/ccapi_vector.c b/src/ccapi/lib/mac/ccapi_vector.c
index ea749c0..3893bc9 100644
--- a/src/ccapi/lib/mac/ccapi_vector.c
+++ b/src/ccapi/lib/mac/ccapi_vector.c
@@ -173,7 +173,7 @@ cc_int32 __cc_context_open_default_ccache_vector (cc_context_t in_context,
cc_int32 __cc_context_create_ccache_vector (cc_context_t in_context,
const char *in_name,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache)
{
cc_int32 err = ccNoError;
@@ -188,7 +188,7 @@ cc_int32 __cc_context_create_ccache_vector (cc_context_t in_context,
cc_int32 __cc_context_create_default_ccache_vector (cc_context_t in_context,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache)
{
cc_int32 err = ccNoError;
@@ -202,7 +202,7 @@ cc_int32 __cc_context_create_default_ccache_vector (cc_context_t in_context,
cc_int32 __cc_context_create_new_ccache_vector (cc_context_t in_context,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache)
{
cc_int32 err = ccNoError;
@@ -632,7 +632,7 @@ cc_int32 __cc_seq_fetch_NCs_begin_vector (apiCB *in_context,
cc_int32 __cc_seq_fetch_NCs_next_vector (apiCB *in_context,
ccache_p **out_ccache,
- ccache_cit *in_iterator)
+ ccache_cit *in_iterator)
{
cc_int32 err = ccNoError;
cci_swap_context_functions (in_context);
@@ -660,7 +660,7 @@ cc_int32 __cc_seq_fetch_NCs_end_vector (apiCB *in_context,
cc_int32 __cc_get_name_vector (apiCB *in_context,
ccache_p *in_ccache,
- char **out_name)
+ char **out_name)
{
cc_int32 err = ccNoError;
cci_swap_context_functions (in_context);
@@ -675,7 +675,7 @@ cc_int32 __cc_get_name_vector (apiCB *in_context,
cc_int32 __cc_get_cred_version_vector (apiCB *in_context,
ccache_p *in_ccache,
- cc_int32 *out_version)
+ cc_int32 *out_version)
{
cc_int32 err = ccNoError;
cci_swap_context_functions (in_context);
@@ -691,7 +691,7 @@ cc_int32 __cc_get_cred_version_vector (apiCB *in_context,
cc_int32 __cc_set_principal_vector (apiCB *in_context,
ccache_p *io_ccache,
cc_int32 in_version,
- char *in_principal)
+ char *in_principal)
{
cc_int32 err = ccNoError;
cci_swap_context_functions (in_context);
@@ -736,7 +736,7 @@ cc_int32 __cc_store_vector (apiCB *in_context,
cc_int32 __cc_remove_cred_vector (apiCB *in_context,
ccache_p *in_ccache,
- cred_union in_credentials)
+ cred_union in_credentials)
{
cc_int32 err = ccNoError;
cci_swap_context_functions (in_context);
@@ -751,7 +751,7 @@ cc_int32 __cc_remove_cred_vector (apiCB *in_context,
cc_int32 __cc_seq_fetch_creds_begin_vector (apiCB *in_context,
const ccache_p *in_ccache,
- ccache_cit **out_iterator)
+ ccache_cit **out_iterator)
{
cc_int32 err = ccNoError;
cci_swap_context_functions (in_context);
@@ -766,7 +766,7 @@ cc_int32 __cc_seq_fetch_creds_begin_vector (apiCB *in_context,
cc_int32 __cc_seq_fetch_creds_next_vector (apiCB *in_context,
cred_union **out_creds,
- ccache_cit *in_iterator)
+ ccache_cit *in_iterator)
{
cc_int32 err = ccNoError;
cci_swap_context_functions (in_context);
@@ -780,7 +780,7 @@ cc_int32 __cc_seq_fetch_creds_next_vector (apiCB *in_context,
/* ------------------------------------------------------------------------ */
cc_int32 __cc_seq_fetch_creds_end_vector (apiCB *in_context,
- ccache_cit **io_iterator)
+ ccache_cit **io_iterator)
{
cc_int32 err = ccNoError;
cci_swap_context_functions (in_context);
@@ -793,7 +793,7 @@ cc_int32 __cc_seq_fetch_creds_end_vector (apiCB *in_context,
/* ------------------------------------------------------------------------ */
cc_int32 __cc_free_principal_vector (apiCB *in_context,
- char **io_principal)
+ char **io_principal)
{
cc_int32 err = ccNoError;
cci_swap_context_functions (in_context);
@@ -805,7 +805,7 @@ cc_int32 __cc_free_principal_vector (apiCB *in_context,
/* ------------------------------------------------------------------------ */
cc_int32 __cc_free_name_vector (apiCB *in_context,
- char **io_name)
+ char **io_name)
{
cc_int32 err = ccNoError;
cci_swap_context_functions (in_context);
diff --git a/src/ccapi/lib/mac/ccapi_vector.h b/src/ccapi/lib/mac/ccapi_vector.h
index 80840f1..4bce9a3 100644
--- a/src/ccapi/lib/mac/ccapi_vector.h
+++ b/src/ccapi/lib/mac/ccapi_vector.h
@@ -52,17 +52,17 @@ cc_int32 __cc_context_open_default_ccache_vector (cc_context_t in_context,
cc_int32 __cc_context_create_ccache_vector (cc_context_t in_context,
const char *in_name,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache);
cc_int32 __cc_context_create_default_ccache_vector (cc_context_t in_context,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache);
cc_int32 __cc_context_create_new_ccache_vector (cc_context_t in_context,
cc_uint32 in_cred_vers,
- const char *in_principal,
+ const char *in_principal,
cc_ccache_t *out_ccache);
cc_int32 __cc_context_new_ccache_iterator_vector (cc_context_t in_context,
@@ -174,23 +174,23 @@ cc_int32 __cc_seq_fetch_NCs_begin_vector (apiCB *in_context,
cc_int32 __cc_seq_fetch_NCs_next_vector (apiCB *in_context,
ccache_p **out_ccache,
- ccache_cit *in_iterator);
+ ccache_cit *in_iterator);
cc_int32 __cc_seq_fetch_NCs_end_vector (apiCB *in_context,
ccache_cit **io_iterator);
cc_int32 __cc_get_name_vector (apiCB *in_context,
ccache_p *in_ccache,
- char **out_name);
+ char **out_name);
cc_int32 __cc_get_cred_version_vector (apiCB *in_context,
ccache_p *in_ccache,
- cc_int32 *out_version);
+ cc_int32 *out_version);
cc_int32 __cc_set_principal_vector (apiCB *in_context,
ccache_p *io_ccache,
cc_int32 in_version,
- char *in_principal);
+ char *in_principal);
cc_int32 __cc_get_principal_vector (apiCB *in_context,
ccache_p *in_ccache,
@@ -202,24 +202,24 @@ cc_int32 __cc_store_vector (apiCB *in_context,
cc_int32 __cc_remove_cred_vector (apiCB *in_context,
ccache_p *in_ccache,
- cred_union in_credentials);
+ cred_union in_credentials);
cc_int32 __cc_seq_fetch_creds_begin_vector (apiCB *in_context,
const ccache_p *in_ccache,
- ccache_cit **out_iterator);
+ ccache_cit **out_iterator);
cc_int32 __cc_seq_fetch_creds_next_vector (apiCB *in_context,
cred_union **out_creds,
- ccache_cit *in_iterator);
+ ccache_cit *in_iterator);
cc_int32 __cc_seq_fetch_creds_end_vector (apiCB *in_context,
- ccache_cit **io_iterator);
+ ccache_cit **io_iterator);
cc_int32 __cc_free_principal_vector (apiCB *in_context,
- char **io_principal);
+ char **io_principal);
cc_int32 __cc_free_name_vector (apiCB *in_context,
- char **io_name);
+ char **io_name);
cc_int32 __cc_free_creds_vector (apiCB *in_context,
cred_union **io_credentials);
diff --git a/src/ccapi/lib/win/OldCC/ccapi.h b/src/ccapi/lib/win/OldCC/ccapi.h
index c40bd11..8251277 100644
--- a/src/ccapi/lib/win/OldCC/ccapi.h
+++ b/src/ccapi/lib/win/OldCC/ccapi.h
@@ -1,5 +1,3 @@
-
-
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
@@ -9,8 +7,8 @@
/* Compiler settings for ccapi.idl:
Oic, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, oldnames
- error checks: allocation ref bounds_check enum stub_data
- VC __declspec() decoration level:
+ error checks: allocation ref bounds_check enum stub_data
+ VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
@@ -34,20 +32,20 @@
#pragma once
#endif
-/* Forward Declarations */
+/* Forward Declarations */
#ifdef __cplusplus
extern "C"{
-#endif
+#endif
void * __RPC_USER MIDL_user_allocate(size_t);
-void __RPC_USER MIDL_user_free( void * );
+void __RPC_USER MIDL_user_free( void * );
#ifndef __ccapi_INTERFACE_DEFINED__
#define __ccapi_INTERFACE_DEFINED__
/* interface ccapi */
-/* [implicit_handle][unique][version][uuid] */
+/* [implicit_handle][unique][version][uuid] */
typedef /* [context_handle] */ struct opaque_handle_CTX *HCTX;
@@ -157,17 +155,17 @@ typedef struct _CRED_UNION
/* [switch_is] */ CRED_PTR_UNION cred;
} CRED_UNION;
-CC_INT32 rcc_initialize(
+CC_INT32 rcc_initialize(
/* [out] */ HCTX *pctx);
-CC_INT32 rcc_shutdown(
+CC_INT32 rcc_shutdown(
/* [out][in] */ HCTX *pctx);
-CC_INT32 rcc_get_change_time(
+CC_INT32 rcc_get_change_time(
/* [in] */ HCTX ctx,
/* [out] */ CC_TIME_T *time);
-CC_INT32 rcc_create(
+CC_INT32 rcc_create(
/* [in] */ HCTX ctx,
/* [string][in] */ const CC_CHAR *name,
/* [string][in] */ const CC_CHAR *principal,
@@ -175,85 +173,85 @@ CC_INT32 rcc_create(
/* [in] */ CC_UINT32 flags,
/* [out] */ HCACHE *pcache);
-CC_INT32 rcc_open(
+CC_INT32 rcc_open(
/* [in] */ HCTX ctx,
/* [string][in] */ const CC_CHAR *name,
/* [in] */ CC_INT32 vers,
/* [in] */ CC_UINT32 flags,
/* [out] */ HCACHE *pcache);
-CC_INT32 rcc_close(
+CC_INT32 rcc_close(
/* [out][in] */ HCACHE *pcache);
-CC_INT32 rcc_destroy(
+CC_INT32 rcc_destroy(
/* [out][in] */ HCACHE *pcache);
-CC_INT32 rcc_seq_fetch_NCs_begin(
+CC_INT32 rcc_seq_fetch_NCs_begin(
/* [in] */ HCTX ctx,
/* [out] */ HCACHE_ITER *piter);
-CC_INT32 rcc_seq_fetch_NCs_end(
+CC_INT32 rcc_seq_fetch_NCs_end(
/* [out][in] */ HCACHE_ITER *piter);
-CC_INT32 rcc_seq_fetch_NCs_next(
+CC_INT32 rcc_seq_fetch_NCs_next(
/* [in] */ HCACHE_ITER iter,
/* [out] */ HCACHE *pcache);
-CC_INT32 rcc_seq_fetch_NCs(
+CC_INT32 rcc_seq_fetch_NCs(
/* [in] */ HCTX ctx,
/* [out][in] */ HCACHE_ITER *piter,
/* [out] */ HCACHE *pcache);
-CC_INT32 rcc_get_NC_info(
+CC_INT32 rcc_get_NC_info(
/* [in] */ HCTX ctx,
/* [out] */ NC_INFO_LIST **info_list);
-CC_INT32 rcc_get_name(
+CC_INT32 rcc_get_name(
/* [in] */ HCACHE cache,
/* [string][out] */ CC_CHAR **name);
-CC_INT32 rcc_set_principal(
+CC_INT32 rcc_set_principal(
/* [in] */ HCACHE cache,
/* [in] */ CC_INT32 vers,
/* [string][in] */ const CC_CHAR *principal);
-CC_INT32 rcc_get_principal(
+CC_INT32 rcc_get_principal(
/* [in] */ HCACHE cache,
/* [string][out] */ CC_CHAR **principal);
-CC_INT32 rcc_get_cred_version(
+CC_INT32 rcc_get_cred_version(
/* [in] */ HCACHE cache,
/* [out] */ CC_INT32 *vers);
-CC_INT32 rcc_lock_request(
+CC_INT32 rcc_lock_request(
/* [in] */ HCACHE cache,
/* [in] */ CC_INT32 lock_type);
-CC_INT32 rcc_store(
+CC_INT32 rcc_store(
/* [in] */ HCACHE cache,
/* [in] */ CRED_UNION cred);
-CC_INT32 rcc_remove_cred(
+CC_INT32 rcc_remove_cred(
/* [in] */ HCACHE cache,
/* [in] */ CRED_UNION cred);
-CC_INT32 rcc_seq_fetch_creds(
+CC_INT32 rcc_seq_fetch_creds(
/* [in] */ HCACHE cache,
/* [out][in] */ HCRED_ITER *piter,
/* [out] */ CRED_UNION **cred);
-CC_INT32 rcc_seq_fetch_creds_begin(
+CC_INT32 rcc_seq_fetch_creds_begin(
/* [in] */ HCACHE cache,
/* [out] */ HCRED_ITER *piter);
-CC_INT32 rcc_seq_fetch_creds_end(
+CC_INT32 rcc_seq_fetch_creds_end(
/* [out][in] */ HCRED_ITER *piter);
-CC_INT32 rcc_seq_fetch_creds_next(
+CC_INT32 rcc_seq_fetch_creds_next(
/* [in] */ HCRED_ITER iter,
/* [out] */ CRED_UNION **cred);
-CC_UINT32 Connect(
+CC_UINT32 Connect(
/* [string][in] */ CC_CHAR *name);
void Shutdown( void);
@@ -280,5 +278,3 @@ void __RPC_USER HCRED_ITER_rundown( HCRED_ITER );
#endif
#endif
-
-
diff --git a/src/ccapi/lib/win/ccs_reply_proc.c b/src/ccapi/lib/win/ccs_reply_proc.c
index b3ef3f7..4ac8940 100644
--- a/src/ccapi/lib/win/ccs_reply_proc.c
+++ b/src/ccapi/lib/win/ccs_reply_proc.c
@@ -52,7 +52,7 @@ void ccs_rpc_request_reply(
#if 0
cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid);
#endif
- if (!status) {
+ if (!status) {
status = krb5int_ipc_stream_new (&stream); /* Create a stream for the request data */
}
diff --git a/src/ccapi/lib/win/dllmain.h b/src/ccapi/lib/win/dllmain.h
index abf6afd..a43262d 100644
--- a/src/ccapi/lib/win/dllmain.h
+++ b/src/ccapi/lib/win/dllmain.h
@@ -29,7 +29,7 @@
#include "windows.h"
-#ifdef __cplusplus // If used by C++ code,
+#ifdef __cplusplus // If used by C++ code,
extern "C" { // we need to export the C interface
#endif
@@ -39,4 +39,4 @@ DWORD GetTlsIndex();
}
#endif
-#endif _dll_h \ No newline at end of file
+#endif _dll_h
diff --git a/src/ccapi/server/ccs_array.c b/src/ccapi/server/ccs_array.c
index d5dd4ad..c5fb4f3 100644
--- a/src/ccapi/server/ccs_array.c
+++ b/src/ccapi/server/ccs_array.c
@@ -31,7 +31,7 @@
static cc_int32 ccs_client_object_release (cci_array_object_t io_client)
{
- return cci_check_error (ccs_client_release ((ccs_client_t) io_client));
+ return cci_check_error (ccs_client_release ((ccs_client_t) io_client));
}
/* ------------------------------------------------------------------------ */
@@ -88,7 +88,7 @@ cc_int32 ccs_client_array_remove (ccs_client_array_t io_array,
static cc_int32 ccs_lock_object_release (cci_array_object_t io_lock)
{
- return cci_check_error (ccs_lock_release ((ccs_lock_t) io_lock));
+ return cci_check_error (ccs_lock_release ((ccs_lock_t) io_lock));
}
/* ------------------------------------------------------------------------ */
@@ -154,7 +154,7 @@ cc_int32 ccs_lock_array_move (ccs_lock_array_t io_array,
static cc_int32 ccs_callback_object_release (cci_array_object_t io_callback)
{
- return cci_check_error (ccs_callback_release ((ccs_callback_t) io_callback));
+ return cci_check_error (ccs_callback_release ((ccs_callback_t) io_callback));
}
/* ------------------------------------------------------------------------ */
@@ -286,7 +286,7 @@ cc_uint64 ccs_iteratorref_array_count (ccs_iteratorref_array_t in_array)
ccs_generic_list_iterator_t ccs_iteratorref_array_object_at_index (ccs_iteratorref_array_t io_array,
cc_uint64 in_position)
{
- return (ccs_generic_list_iterator_t) cci_array_object_at_index (io_array,
+ return (ccs_generic_list_iterator_t) cci_array_object_at_index (io_array,
in_position);
}
@@ -296,8 +296,8 @@ cc_int32 ccs_iteratorref_array_insert (ccs_iteratorref_array_t io_array,
ccs_generic_list_iterator_t in_iterator,
cc_uint64 in_position)
{
- return cci_array_insert (io_array,
- (cci_array_object_t) in_iterator,
+ return cci_array_insert (io_array,
+ (cci_array_object_t) in_iterator,
in_position);
}
diff --git a/src/ccapi/server/ccs_cache_collection.c b/src/ccapi/server/ccs_cache_collection.c
index 2137e81..c96a75b 100644
--- a/src/ccapi/server/ccs_cache_collection.c
+++ b/src/ccapi/server/ccs_cache_collection.c
@@ -45,48 +45,48 @@ cc_int32 ccs_cache_collection_new (ccs_cache_collection_t *out_cache_collection)
{
cc_int32 err = ccNoError;
ccs_cache_collection_t cache_collection = NULL;
-
+
if (!out_cache_collection) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
cache_collection = malloc (sizeof (*cache_collection));
- if (cache_collection) {
+ if (cache_collection) {
*cache_collection = ccs_cache_collection_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = ccs_server_new_identifier (&cache_collection->identifier);
}
-
+
if (!err) {
err = ccs_lock_state_new (&cache_collection->lock_state,
ccErrInvalidContext,
ccErrContextLocked,
ccErrContextUnlocked);
}
-
+
if (!err) {
err = ccs_ccache_list_new (&cache_collection->ccaches);
}
-
+
if (!err) {
err = ccs_callback_array_new (&cache_collection->change_callbacks);
}
-
+
if (!err) {
err = ccs_cache_collection_changed (cache_collection);
}
-
+
if (!err) {
*out_cache_collection = cache_collection;
cache_collection = NULL;
}
-
+
ccs_cache_collection_release (cache_collection);
-
+
return cci_check_error (err);
}
@@ -95,7 +95,7 @@ cc_int32 ccs_cache_collection_new (ccs_cache_collection_t *out_cache_collection)
cc_int32 ccs_cache_collection_release (ccs_cache_collection_t io_cache_collection)
{
cc_int32 err = ccNoError;
-
+
if (!err && io_cache_collection) {
cci_identifier_release (io_cache_collection->identifier);
ccs_lock_state_release (io_cache_collection->lock_state);
@@ -103,7 +103,7 @@ cc_int32 ccs_cache_collection_release (ccs_cache_collection_t io_cache_collectio
ccs_callback_array_release (io_cache_collection->change_callbacks);
free (io_cache_collection);
}
-
+
return cci_check_error (err);
}
@@ -114,17 +114,17 @@ cc_int32 ccs_cache_collection_compare_identifier (ccs_cache_collection_t in_cac
cc_uint32 *out_equal)
{
cc_int32 err = ccNoError;
-
+
if (!in_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_equal ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = cci_identifier_compare (in_cache_collection->identifier,
- in_identifier,
+ err = cci_identifier_compare (in_cache_collection->identifier,
+ in_identifier,
out_equal);
}
-
+
return cci_check_error (err);
}
@@ -138,19 +138,19 @@ cc_int32 ccs_cache_collection_changed (ccs_cache_collection_t io_cache_collectio
{
cc_int32 err = ccNoError;
k5_ipc_stream reply_data = NULL;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!err) {
cc_time_t now = time (NULL);
-
+
if (io_cache_collection->last_changed_time < now) {
io_cache_collection->last_changed_time = now;
} else {
io_cache_collection->last_changed_time++;
}
}
-
+
if (!err) {
err = krb5int_ipc_stream_new (&reply_data);
}
@@ -158,17 +158,17 @@ cc_int32 ccs_cache_collection_changed (ccs_cache_collection_t io_cache_collectio
if (!err) {
err = krb5int_ipc_stream_write_time (reply_data, io_cache_collection->last_changed_time);
}
-
+
if (!err) {
/* Loop over callbacks sending messages to them */
cc_uint64 i;
cc_uint64 count = ccs_callback_array_count (io_cache_collection->change_callbacks);
-
+
for (i = 0; !err && i < count; i++) {
ccs_callback_t callback = ccs_callback_array_object_at_index (io_cache_collection->change_callbacks, i);
-
+
err = ccs_callback_reply_to_client (callback, reply_data);
-
+
if (!err) {
cci_debug_printf ("%s: Removing callback reference %p.", __FUNCTION__, callback);
err = ccs_callback_array_remove (io_cache_collection->change_callbacks, i);
@@ -176,13 +176,13 @@ cc_int32 ccs_cache_collection_changed (ccs_cache_collection_t io_cache_collectio
}
}
}
-
+
if (!err) {
err = ccs_os_notify_cache_collection_changed (io_cache_collection);
}
-
+
krb5int_ipc_stream_release (reply_data);
-
+
return cci_check_error (err);
}
@@ -192,19 +192,19 @@ static cc_int32 ccs_cache_collection_invalidate_change_callback (ccs_callback_ow
ccs_callback_t in_callback)
{
cc_int32 err = ccNoError;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_callback ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
/* Remove callback */
ccs_cache_collection_t cache_collection = (ccs_cache_collection_t) io_cache_collection;
cc_uint64 i;
cc_uint64 count = ccs_callback_array_count (cache_collection->change_callbacks);
-
+
for (i = 0; !err && i < count; i++) {
ccs_callback_t callback = ccs_callback_array_object_at_index (cache_collection->change_callbacks, i);
-
+
if (callback == in_callback) {
cci_debug_printf ("%s: Removing callback reference %p.", __FUNCTION__, callback);
err = ccs_callback_array_remove (cache_collection->change_callbacks, i);
@@ -212,7 +212,7 @@ static cc_int32 ccs_cache_collection_invalidate_change_callback (ccs_callback_ow
}
}
}
-
+
return cci_check_error (err);
}
@@ -228,27 +228,27 @@ static cc_int32 ccs_cache_collection_find_ccache_by_name (ccs_cache_collection_t
{
cc_int32 err = ccNoError;
ccs_ccache_list_iterator_t iterator = NULL;
-
+
if (!in_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_name ) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_ccache_list_new_iterator (in_cache_collection->ccaches,
- CCS_PIPE_NULL,
+ err = ccs_ccache_list_new_iterator (in_cache_collection->ccaches,
+ CCS_PIPE_NULL,
&iterator);
}
-
+
while (!err) {
ccs_ccache_t ccache = NULL;
-
+
err = ccs_ccache_list_iterator_next (iterator, &ccache);
-
+
if (!err) {
cc_uint32 equal = 0;
-
+
err = ccs_ccache_compare_name (ccache, in_name, &equal);
-
+
if (!err && equal) {
*out_ccache = ccache;
break;
@@ -256,9 +256,9 @@ static cc_int32 ccs_cache_collection_find_ccache_by_name (ccs_cache_collection_t
}
}
if (err == ccIteratorEnd) { err = ccErrCCacheNotFound; }
-
+
if (iterator) { ccs_ccache_list_iterator_release (iterator); }
-
+
return cci_check_error (err);
}
@@ -273,16 +273,16 @@ cc_int32 ccs_cache_collection_find_ccache (ccs_cache_collection_t in_cache_coll
ccs_ccache_t *out_ccache)
{
cc_int32 err = ccNoError;
-
+
if (!in_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_ccache_list_find (in_cache_collection->ccaches,
in_identifier, out_ccache);
}
-
+
return cci_check_error (err);
}
@@ -294,28 +294,28 @@ cc_int32 ccs_ccache_collection_move_ccache (ccs_cache_collection_t io_cache_coll
{
cc_int32 err = ccNoError;
ccs_ccache_t source_ccache = NULL;
-
+
if (!io_cache_collection ) { err = cci_check_error (ccErrBadParam); }
if (!in_source_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!io_destination_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_cache_collection_find_ccache (io_cache_collection,
- in_source_identifier,
+ in_source_identifier,
&source_ccache);
}
-
+
if (!err) {
- err = ccs_ccache_swap_contents (source_ccache,
- io_destination_ccache,
+ err = ccs_ccache_swap_contents (source_ccache,
+ io_destination_ccache,
io_cache_collection);
}
-
+
if (!err) {
err = ccs_cache_collection_destroy_ccache (io_cache_collection,
in_source_identifier);
}
-
+
return cci_check_error (err);
}
@@ -326,16 +326,16 @@ cc_int32 ccs_cache_collection_destroy_ccache (ccs_cache_collection_t io_cache_c
{
cc_int32 err = ccNoError;
ccs_ccache_t ccache = NULL;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_cache_collection_find_ccache (io_cache_collection,
- in_identifier,
+ in_identifier,
&ccache);
}
-
+
if (!err) {
/* Notify before deletion because after deletion the ccache
* will no longer exist (and won't know about its clients) */
@@ -361,17 +361,17 @@ cc_int32 ccs_cache_collection_find_ccache_iterator (ccs_cache_collection_t in_c
ccs_ccache_iterator_t *out_ccache_iterator)
{
cc_int32 err = ccNoError;
-
+
if (!in_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_ccache_list_find_iterator (in_cache_collection->ccaches,
in_identifier,
out_ccache_iterator);
}
-
+
return cci_check_error (err);
}
@@ -388,36 +388,36 @@ cc_int32 ccs_cache_collection_find_credentials_iterator (ccs_cache_collection_t
{
cc_int32 err = ccNoError;
ccs_ccache_list_iterator_t iterator = NULL;
-
+
if (!in_cache_collection ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_ccache_list_new_iterator (in_cache_collection->ccaches,
- CCS_PIPE_NULL,
+ err = ccs_ccache_list_new_iterator (in_cache_collection->ccaches,
+ CCS_PIPE_NULL,
&iterator);
}
-
+
while (!err) {
ccs_ccache_t ccache = NULL;
-
+
err = ccs_ccache_list_iterator_next (iterator, &ccache);
-
+
if (!err) {
- cc_int32 terr = ccs_ccache_find_credentials_iterator (ccache,
+ cc_int32 terr = ccs_ccache_find_credentials_iterator (ccache,
in_identifier,
out_credentials_iterator);
- if (!terr) {
+ if (!terr) {
*out_ccache = ccache;
- break;
+ break;
}
}
}
if (err == ccIteratorEnd) { err = cci_check_error (ccErrInvalidCredentialsIterator); }
-
+
if (iterator) { ccs_ccache_list_iterator_release (iterator); }
-
+
return cci_check_error (err);
}
@@ -433,27 +433,27 @@ static cc_int32 ccs_cache_collection_get_next_unique_ccache_name (ccs_cache_coll
cc_int32 err = ccNoError;
cc_uint64 count = 0;
char *name = NULL;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!out_name ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_cache_collection_list_count (io_cache_collection->ccaches, &count);
}
-
+
if (!err) {
if (count > 0) {
while (!err) {
int ret = asprintf (&name, "%lld", io_cache_collection->next_unique_name++);
if (ret < 0 || !name) { err = cci_check_error (ccErrNoMem); }
-
+
if (!err) {
ccs_ccache_t ccache = NULL; /* temporary to hold ccache pointer */
- err = ccs_cache_collection_find_ccache_by_name (io_cache_collection,
+ err = ccs_cache_collection_find_ccache_by_name (io_cache_collection,
name, &ccache);
}
-
- if (err == ccErrCCacheNotFound) {
+
+ if (err == ccErrCCacheNotFound) {
err = ccNoError;
break; /* found a unique one */
}
@@ -463,9 +463,9 @@ static cc_int32 ccs_cache_collection_get_next_unique_ccache_name (ccs_cache_coll
if (!name) { err = cci_check_error (ccErrNoMem); }
}
}
-
+
if (!err) {
- *out_name = name;
+ *out_name = name;
name = NULL;
}
@@ -476,86 +476,86 @@ static cc_int32 ccs_cache_collection_get_next_unique_ccache_name (ccs_cache_coll
/* ------------------------------------------------------------------------ */
-static cc_int32 ccs_cache_collection_get_default_ccache (ccs_cache_collection_t in_cache_collection,
+static cc_int32 ccs_cache_collection_get_default_ccache (ccs_cache_collection_t in_cache_collection,
ccs_ccache_t *out_ccache)
{
cc_int32 err = ccNoError;
cc_uint64 count = 0;
-
+
if (!in_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_ccache_list_count (in_cache_collection->ccaches, &count);
}
-
+
if (!err) {
if (count > 0) {
/* First ccache is the default */
ccs_ccache_list_iterator_t iterator = NULL;
-
+
err = ccs_ccache_list_new_iterator (in_cache_collection->ccaches,
- CCS_PIPE_NULL,
+ CCS_PIPE_NULL,
&iterator);
-
+
if (!err) {
err = ccs_ccache_list_iterator_next (iterator, out_ccache);
}
-
+
ccs_ccache_list_iterator_release (iterator);
-
+
} else {
err = cci_check_error (ccErrCCacheNotFound);
}
}
-
+
return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
-cc_int32 ccs_cache_collection_set_default_ccache (ccs_cache_collection_t io_cache_collection,
+cc_int32 ccs_cache_collection_set_default_ccache (ccs_cache_collection_t io_cache_collection,
cci_identifier_t in_identifier)
{
cc_int32 err = ccNoError;
ccs_ccache_t old_default = NULL;
ccs_ccache_t new_default = NULL;
cc_uint32 equal = 0;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_cache_collection_get_default_ccache (io_cache_collection,
+ err = ccs_cache_collection_get_default_ccache (io_cache_collection,
&old_default);
}
-
+
if (!err) {
err = ccs_ccache_compare_identifier (old_default, in_identifier, &equal);
}
-
-
+
+
if (!err && !equal) {
err = ccs_ccache_list_push_front (io_cache_collection->ccaches,
in_identifier);
-
+
if (!err) {
err = ccs_ccache_notify_default_state_changed (old_default,
io_cache_collection,
0 /* no longer default */);
}
-
+
if (!err) {
- err = ccs_cache_collection_get_default_ccache (io_cache_collection,
+ err = ccs_cache_collection_get_default_ccache (io_cache_collection,
&new_default);
}
-
+
if (!err) {
err = ccs_ccache_notify_default_state_changed (new_default,
io_cache_collection,
1 /* now default */);
}
-
+
if (!err) {
err = ccs_cache_collection_changed (io_cache_collection);
}
@@ -576,16 +576,16 @@ static cc_int32 ccs_cache_collection_sync (ccs_cache_collection_t io_cache_colle
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_identifier_write (io_cache_collection->identifier, io_reply_data);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -595,16 +595,16 @@ static cc_int32 ccs_cache_collection_get_change_time (ccs_cache_collection_t io_
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (io_reply_data, io_cache_collection->last_changed_time);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -619,27 +619,27 @@ static cc_int32 ccs_cache_collection_wait_for_change (ccs_pipe_t in
cc_int32 err = ccNoError;
cc_time_t last_wait_for_change_time = 0;
cc_uint32 will_block = 0;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_reply_pipe )) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!out_will_block ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (in_request_data, &last_wait_for_change_time);
}
-
+
if (!err) {
if (last_wait_for_change_time < io_cache_collection->last_changed_time) {
err = krb5int_ipc_stream_write_time (io_reply_data, io_cache_collection->last_changed_time);
-
+
} else {
ccs_callback_t callback = NULL;
- err = ccs_callback_new (&callback,
- ccErrInvalidContext,
- in_client_pipe,
+ err = ccs_callback_new (&callback,
+ ccErrInvalidContext,
+ in_client_pipe,
in_reply_pipe,
(ccs_callback_owner_t) io_cache_collection,
ccs_cache_collection_invalidate_change_callback);
@@ -648,19 +648,19 @@ static cc_int32 ccs_cache_collection_wait_for_change (ccs_pipe_t in
err = ccs_callback_array_insert (io_cache_collection->change_callbacks, callback,
ccs_callback_array_count (io_cache_collection->change_callbacks));
if (!err) { callback = NULL; /* take ownership */ }
-
+
will_block = 1;
}
ccs_callback_release (callback);
}
}
-
+
if (!err) {
*out_will_block = will_block;
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -671,31 +671,31 @@ static cc_int32 ccs_cache_collection_get_default_ccache_name (ccs_cache_collecti
{
cc_int32 err = ccNoError;
cc_uint64 count = 0;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_cache_collection_list_count (io_cache_collection->ccaches, &count);
}
-
+
if (!err) {
if (count > 0) {
ccs_ccache_t ccache = NULL;
err = ccs_cache_collection_get_default_ccache (io_cache_collection, &ccache);
-
+
if (!err) {
err = ccs_ccache_write_name (ccache, io_reply_data);
}
} else {
- err = krb5int_ipc_stream_write_string (io_reply_data,
+ err = krb5int_ipc_stream_write_string (io_reply_data,
k_cci_context_initial_ccache_name);
}
}
- return cci_check_error (err);
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -707,27 +707,27 @@ static cc_int32 ccs_cache_collection_open_ccache (ccs_cache_collection_t io_cach
cc_int32 err = ccNoError;
char *name = NULL;
ccs_ccache_t ccache = NULL;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (in_request_data, &name);
}
-
+
if (!err) {
err = ccs_cache_collection_find_ccache_by_name (io_cache_collection,
name, &ccache);
}
-
+
if (!err) {
err = ccs_ccache_write (ccache, io_reply_data);
}
-
+
krb5int_ipc_stream_free_string (name);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -738,21 +738,21 @@ static cc_int32 ccs_cache_collection_open_default_ccache (ccs_cache_collection_t
{
cc_int32 err = ccNoError;
ccs_ccache_t ccache = NULL;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_cache_collection_get_default_ccache (io_cache_collection,
+ err = ccs_cache_collection_get_default_ccache (io_cache_collection,
&ccache);
}
-
+
if (!err) {
err = ccs_ccache_write (ccache, io_reply_data);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -766,49 +766,49 @@ static cc_int32 ccs_cache_collection_create_ccache (ccs_cache_collection_t io_ca
cc_uint32 cred_vers;
char *principal = NULL;
ccs_ccache_t ccache = NULL;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (in_request_data, &name);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &cred_vers);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (in_request_data, &principal);
}
-
+
if (!err) {
cc_int32 terr = ccs_cache_collection_find_ccache_by_name (io_cache_collection,
name,
&ccache);
-
+
if (!terr) {
err = ccs_ccache_reset (ccache, io_cache_collection, cred_vers, principal);
-
+
} else {
- err = ccs_ccache_new (&ccache, cred_vers, name, principal,
+ err = ccs_ccache_new (&ccache, cred_vers, name, principal,
io_cache_collection->ccaches);
}
}
-
+
if (!err) {
err = ccs_ccache_write (ccache, io_reply_data);
}
-
+
if (!err) {
err = ccs_cache_collection_changed (io_cache_collection);
}
-
+
krb5int_ipc_stream_free_string (name);
krb5int_ipc_stream_free_string (principal);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -821,52 +821,52 @@ static cc_int32 ccs_cache_collection_create_default_ccache (ccs_cache_collection
cc_uint32 cred_vers;
char *principal = NULL;
ccs_ccache_t ccache = NULL;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &cred_vers);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (in_request_data, &principal);
}
-
+
if (!err) {
err = ccs_cache_collection_get_default_ccache (io_cache_collection,
&ccache);
-
+
if (!err) {
err = ccs_ccache_reset (ccache, io_cache_collection, cred_vers, principal);
} else if (err == ccErrCCacheNotFound) {
char *name = NULL;
-
- err = ccs_cache_collection_get_next_unique_ccache_name (io_cache_collection,
+
+ err = ccs_cache_collection_get_next_unique_ccache_name (io_cache_collection,
&name);
-
+
if (!err) {
- err = ccs_ccache_new (&ccache, cred_vers, name, principal,
+ err = ccs_ccache_new (&ccache, cred_vers, name, principal,
io_cache_collection->ccaches);
}
-
+
free (name);
}
}
-
+
if (!err) {
err = ccs_ccache_write (ccache, io_reply_data);
}
-
+
if (!err) {
err = ccs_cache_collection_changed (io_cache_collection);
}
-
+
krb5int_ipc_stream_free_string (principal);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -880,41 +880,41 @@ static cc_int32 ccs_cache_collection_create_new_ccache (ccs_cache_collection_t i
char *principal = NULL;
char *name = NULL;
ccs_ccache_t ccache = NULL;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &cred_vers);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (in_request_data, &principal);
}
-
+
if (!err) {
- err = ccs_cache_collection_get_next_unique_ccache_name (io_cache_collection,
+ err = ccs_cache_collection_get_next_unique_ccache_name (io_cache_collection,
&name);
}
-
+
if (!err) {
- err = ccs_ccache_new (&ccache, cred_vers, name, principal,
+ err = ccs_ccache_new (&ccache, cred_vers, name, principal,
io_cache_collection->ccaches);
}
-
+
if (!err) {
err = ccs_ccache_write (ccache, io_reply_data);
}
-
+
if (!err) {
err = ccs_cache_collection_changed (io_cache_collection);
}
-
+
free (name);
krb5int_ipc_stream_free_string (principal);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -926,22 +926,22 @@ static cc_int32 ccs_cache_collection_new_ccache_iterator (ccs_cache_collection_
{
cc_int32 err = ccNoError;
ccs_ccache_iterator_t ccache_iterator = NULL;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_ccache_list_new_iterator (io_cache_collection->ccaches,
in_client_pipe,
&ccache_iterator);
}
-
+
if (!err) {
err = ccs_ccache_list_iterator_write (ccache_iterator, io_reply_data);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -956,28 +956,28 @@ static cc_int32 ccs_cache_collection_lock (ccs_pipe_t in_client_pip
cc_int32 err = ccNoError;
cc_uint32 lock_type;
cc_uint32 block;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!out_will_block ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &lock_type);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &block);
}
-
+
if (!err) {
- err = ccs_lock_state_add (io_cache_collection->lock_state,
- in_client_pipe, in_reply_pipe,
+ err = ccs_lock_state_add (io_cache_collection->lock_state,
+ in_client_pipe, in_reply_pipe,
lock_type, block, out_will_block);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -988,18 +988,18 @@ static cc_int32 ccs_cache_collection_unlock (ccs_pipe_t in_client_pi
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_lock_state_remove (io_cache_collection->lock_state,
+ err = ccs_lock_state_remove (io_cache_collection->lock_state,
in_client_pipe);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -1019,81 +1019,81 @@ static cc_int32 ccs_cache_collection_unlock (ccs_pipe_t in_client_pi
cc_int32 err = ccNoError;
cc_uint32 will_block = 0;
k5_ipc_stream reply_data = NULL;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!out_will_block ) { err = cci_check_error (ccErrBadParam); }
if (!out_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&reply_data);
}
-
+
if (!err) {
if (in_request_name == cci_context_unused_release_msg_id) {
/* Old release message. Do nothing. */
-
+
} else if (in_request_name == cci_context_sync_msg_id) {
err = ccs_cache_collection_sync (io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_context_get_change_time_msg_id) {
err = ccs_cache_collection_get_change_time (io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_context_wait_for_change_msg_id) {
- err = ccs_cache_collection_wait_for_change (in_client_pipe, in_reply_pipe,
+ err = ccs_cache_collection_wait_for_change (in_client_pipe, in_reply_pipe,
io_cache_collection,
in_request_data, reply_data,
&will_block);
-
+
} else if (in_request_name == cci_context_get_default_ccache_name_msg_id) {
err = ccs_cache_collection_get_default_ccache_name (io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_context_open_ccache_msg_id) {
err = ccs_cache_collection_open_ccache (io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_context_open_default_ccache_msg_id) {
err = ccs_cache_collection_open_default_ccache (io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_context_create_ccache_msg_id) {
err = ccs_cache_collection_create_ccache (io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_context_create_default_ccache_msg_id) {
err = ccs_cache_collection_create_default_ccache (io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_context_create_new_ccache_msg_id) {
err = ccs_cache_collection_create_new_ccache (io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_context_new_ccache_iterator_msg_id) {
err = ccs_cache_collection_new_ccache_iterator (io_cache_collection,
in_client_pipe,
- in_request_data,
+ in_request_data,
reply_data);
-
+
} else if (in_request_name == cci_context_lock_msg_id) {
- err = ccs_cache_collection_lock (in_client_pipe, in_reply_pipe,
+ err = ccs_cache_collection_lock (in_client_pipe, in_reply_pipe,
io_cache_collection,
- in_request_data,
+ in_request_data,
&will_block, reply_data);
-
+
} else if (in_request_name == cci_context_unlock_msg_id) {
err = ccs_cache_collection_unlock (in_client_pipe, io_cache_collection,
in_request_data, reply_data);
-
+
} else {
err = ccErrBadInternalMessage;
}
}
-
+
if (!err) {
*out_will_block = will_block;
if (!will_block) {
@@ -1103,8 +1103,8 @@ static cc_int32 ccs_cache_collection_unlock (ccs_pipe_t in_client_pi
*out_reply_data = NULL;
}
}
-
+
krb5int_ipc_stream_release (reply_data);
-
+
return cci_check_error (err);
}
diff --git a/src/ccapi/server/ccs_cache_collection.h b/src/ccapi/server/ccs_cache_collection.h
index f050796..53f9709 100644
--- a/src/ccapi/server/ccs_cache_collection.h
+++ b/src/ccapi/server/ccs_cache_collection.h
@@ -39,7 +39,7 @@ cc_int32 ccs_cache_collection_compare_identifier (ccs_cache_collection_t in_cac
cc_int32 ccs_cache_collection_changed (ccs_cache_collection_t io_cache_collection);
-cc_int32 ccs_cache_collection_set_default_ccache (ccs_cache_collection_t in_cache_collection,
+cc_int32 ccs_cache_collection_set_default_ccache (ccs_cache_collection_t in_cache_collection,
cci_identifier_t in_identifier);
cc_int32 ccs_cache_collection_find_ccache (ccs_cache_collection_t in_cache_collection,
diff --git a/src/ccapi/server/ccs_callback.c b/src/ccapi/server/ccs_callback.c
index 94e9d9b..499ba30 100644
--- a/src/ccapi/server/ccs_callback.c
+++ b/src/ccapi/server/ccs_callback.c
@@ -49,52 +49,52 @@ cc_int32 ccs_callback_new (ccs_callback_t *out_callback,
cc_int32 err = ccNoError;
ccs_callback_t callback = NULL;
ccs_client_t client = NULL;
-
+
if (!out_callback ) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); }
if (!in_owner ) { err = cci_check_error (ccErrBadParam); }
if (!in_owner_invalidate_function ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
callback = malloc (sizeof (*callback));
- if (callback) {
+ if (callback) {
*callback = ccs_callback_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = ccs_server_client_for_pipe (in_client_pipe, &client);
}
-
+
if (!err) {
err = ccs_pipe_copy (&callback->client_pipe, in_client_pipe);
}
-
+
if (!err) {
err = ccs_pipe_copy (&callback->reply_pipe, in_reply_pipe);
}
-
+
if (!err) {
callback->client_pipe = in_client_pipe;
callback->reply_pipe = in_reply_pipe;
callback->invalid_object_err = in_invalid_object_err;
callback->owner = in_owner;
callback->owner_invalidate = in_owner_invalidate_function;
-
+
err = ccs_client_add_callback (client, callback);
}
-
+
if (!err) {
*out_callback = callback;
callback = NULL;
}
-
+
ccs_callback_release (callback);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -102,34 +102,34 @@ cc_int32 ccs_callback_new (ccs_callback_t *out_callback,
cc_int32 ccs_callback_release (ccs_callback_t io_callback)
{
cc_int32 err = ccNoError;
-
+
if (!err && io_callback) {
ccs_client_t client = NULL;
if (io_callback->pending) {
- err = ccs_server_send_reply (io_callback->reply_pipe,
+ err = ccs_server_send_reply (io_callback->reply_pipe,
io_callback->invalid_object_err, NULL);
-
+
io_callback->pending = 0;
}
-
+
if (!err) {
err = ccs_server_client_for_pipe (io_callback->client_pipe, &client);
}
-
+
if (!err && client) {
/* if client object still has a reference to us, remove it */
err = ccs_client_remove_callback (client, io_callback);
}
-
+
if (!err) {
ccs_pipe_release (io_callback->client_pipe);
ccs_pipe_release (io_callback->reply_pipe);
free (io_callback);
}
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -137,19 +137,19 @@ cc_int32 ccs_callback_release (ccs_callback_t io_callback)
cc_int32 ccs_callback_invalidate (ccs_callback_t io_callback)
{
cc_int32 err = ccNoError;
-
+
if (!io_callback) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
io_callback->pending = 0; /* client is dead, don't try to talk to it */
if (io_callback->owner_invalidate) {
err = io_callback->owner_invalidate (io_callback->owner, io_callback);
} else {
- cci_debug_printf ("WARNING %s() unable to notify callback owner!",
+ cci_debug_printf ("WARNING %s() unable to notify callback owner!",
__FUNCTION__);
}
}
-
+
return cci_check_error (err);
}
@@ -159,28 +159,28 @@ cc_int32 ccs_callback_reply_to_client (ccs_callback_t io_callback,
k5_ipc_stream in_stream)
{
cc_int32 err = ccNoError;
-
+
if (!io_callback) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
if (io_callback->pending) {
cci_debug_printf ("%s: callback %p replying to client.", __FUNCTION__, io_callback);
err = ccs_server_send_reply (io_callback->reply_pipe, err, in_stream);
-
+
if (err) {
- cci_debug_printf ("WARNING %s() called on a lock belonging to a dead client!",
+ cci_debug_printf ("WARNING %s() called on a lock belonging to a dead client!",
__FUNCTION__);
}
-
+
io_callback->pending = 0;
} else {
- cci_debug_printf ("WARNING %s() called on non-pending callback!",
+ cci_debug_printf ("WARNING %s() called on non-pending callback!",
__FUNCTION__);
}
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -189,15 +189,15 @@ cc_uint32 ccs_callback_is_pending (ccs_callback_t in_callback,
cc_uint32 *out_pending)
{
cc_int32 err = ccNoError;
-
+
if (!in_callback) { err = cci_check_error (ccErrBadParam); }
if (!out_pending) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
*out_pending = in_callback->pending;
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -207,17 +207,17 @@ cc_int32 ccs_callback_is_for_client_pipe (ccs_callback_t in_callback,
cc_uint32 *out_is_for_client_pipe)
{
cc_int32 err = ccNoError;
-
+
if (!in_callback ) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!out_is_for_client_pipe ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_pipe_compare (in_callback->client_pipe, in_client_pipe,
+ err = ccs_pipe_compare (in_callback->client_pipe, in_client_pipe,
out_is_for_client_pipe);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
@@ -227,13 +227,13 @@ cc_int32 ccs_callback_client_pipe (ccs_callback_t in_callback,
ccs_pipe_t *out_client_pipe)
{
cc_int32 err = ccNoError;
-
+
if (!in_callback ) { err = cci_check_error (ccErrBadParam); }
if (!out_client_pipe) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
*out_client_pipe = in_callback->client_pipe;
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
diff --git a/src/ccapi/server/ccs_ccache.c b/src/ccapi/server/ccs_ccache.c
index d766234..c1e91bc 100644
--- a/src/ccapi/server/ccs_ccache.c
+++ b/src/ccapi/server/ccs_ccache.c
@@ -56,43 +56,43 @@ cc_int32 ccs_ccache_new (ccs_ccache_t *out_ccache,
{
cc_int32 err = ccNoError;
ccs_ccache_t ccache = NULL;
-
+
if (!out_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_name ) { err = cci_check_error (ccErrBadParam); }
if (!in_principal) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
ccache = malloc (sizeof (*ccache));
- if (ccache) {
+ if (ccache) {
*ccache = ccs_ccache_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = ccs_server_new_identifier (&ccache->identifier);
}
-
+
if (!err) {
err = ccs_lock_state_new (&ccache->lock_state,
ccErrInvalidCCache,
ccErrCCacheLocked,
ccErrCCacheUnlocked);
}
-
+
if (!err) {
ccache->name = strdup (in_name);
if (!ccache->name) { err = cci_check_error (ccErrNoMem); }
}
-
+
if (!err) {
ccache->creds_version = in_creds_version;
if (ccache->creds_version == cc_credentials_v4) {
ccache->v4_principal = strdup (in_principal);
if (!ccache->v4_principal) { err = cci_check_error (ccErrNoMem); }
-
+
} else if (ccache->creds_version == cc_credentials_v5) {
ccache->v5_principal = strdup (in_principal);
if (!ccache->v5_principal) { err = cci_check_error (ccErrNoMem); }
@@ -101,43 +101,43 @@ cc_int32 ccs_ccache_new (ccs_ccache_t *out_ccache,
err = cci_check_error (ccErrBadCredentialsVersion);
}
}
-
+
if (!err) {
err = ccs_credentials_list_new (&ccache->credentials);
}
-
+
if (!err) {
err = ccs_callback_array_new (&ccache->change_callbacks);
}
-
+
if (!err) {
cc_uint64 now = time (NULL);
cc_uint64 count = 0;
-
+
err = ccs_ccache_list_count (io_ccache_list, &count);
-
+
if (!err) {
/* first cache is default */
ccache->last_default_time = (count == 0) ? now : 0;
- cci_debug_printf ("%s ccache->last_default_time is %d.",
+ cci_debug_printf ("%s ccache->last_default_time is %d.",
__FUNCTION__, ccache->last_default_time);
ccache->last_changed_time = now;
}
}
-
+
if (!err) {
/* Add self to the list of ccaches */
err = ccs_ccache_list_add (io_ccache_list, ccache);
}
-
+
if (!err) {
*out_ccache = ccache;
ccache = NULL;
}
-
+
ccs_ccache_release (ccache);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -151,41 +151,41 @@ cc_int32 ccs_ccache_reset (ccs_ccache_t io_ccache,
char *v4_principal = NULL;
char *v5_principal = NULL;
ccs_credentials_list_t credentials = NULL;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_principal ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
io_ccache->creds_version = in_creds_version;
-
+
if (io_ccache->creds_version == cc_credentials_v4) {
v4_principal = strdup (in_principal);
if (!v4_principal) { err = cci_check_error (ccErrNoMem); }
-
+
} else if (io_ccache->creds_version == cc_credentials_v5) {
v5_principal = strdup (in_principal);
if (!v5_principal) { err = cci_check_error (ccErrNoMem); }
-
+
} else {
err = cci_check_error (ccErrBadCredentialsVersion);
}
}
-
+
if (!err) {
err = ccs_credentials_list_new (&credentials);
}
-
+
if (!err) {
io_ccache->kdc_time_offset_v4 = 0;
io_ccache->kdc_time_offset_v4_valid = 0;
io_ccache->kdc_time_offset_v5 = 0;
io_ccache->kdc_time_offset_v5_valid = 0;
-
+
if (io_ccache->v4_principal) { free (io_ccache->v4_principal); }
io_ccache->v4_principal = v4_principal;
v4_principal = NULL; /* take ownership */
-
+
if (io_ccache->v5_principal) { free (io_ccache->v5_principal); }
io_ccache->v5_principal = v5_principal;
v5_principal = NULL; /* take ownership */
@@ -193,51 +193,51 @@ cc_int32 ccs_ccache_reset (ccs_ccache_t io_ccache,
ccs_credentials_list_release (io_ccache->credentials);
io_ccache->credentials = credentials;
credentials = NULL; /* take ownership */
-
+
err = ccs_ccache_changed (io_ccache, io_cache_collection);
}
-
+
free (v4_principal);
free (v5_principal);
ccs_credentials_list_release (credentials);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
-cc_int32 ccs_ccache_swap_contents (ccs_ccache_t io_source_ccache,
+cc_int32 ccs_ccache_swap_contents (ccs_ccache_t io_source_ccache,
ccs_ccache_t io_destination_ccache,
ccs_cache_collection_t io_cache_collection)
{
cc_int32 err = ccNoError;
-
+
if (!io_source_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_destination_ccache) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
struct ccs_ccache_d temp_ccache = *io_destination_ccache;
-
+
/* swap everything */
*io_destination_ccache = *io_source_ccache;
*io_source_ccache = temp_ccache;
-
+
/* swap back the name and identifier */
io_source_ccache->identifier = io_destination_ccache->identifier;
io_destination_ccache->identifier = temp_ccache.identifier;
-
+
io_source_ccache->name = io_destination_ccache->name;
io_destination_ccache->name = temp_ccache.name;
}
-
+
if (!err) {
err = ccs_ccache_changed (io_source_ccache, io_cache_collection);
}
-
+
if (!err) {
err = ccs_ccache_changed (io_destination_ccache, io_cache_collection);
}
-
+
return cci_check_error (err);
}
@@ -246,7 +246,7 @@ cc_int32 ccs_ccache_swap_contents (ccs_ccache_t io_source_ccache,
cc_int32 ccs_ccache_release (ccs_ccache_t io_ccache)
{
cc_int32 err = ccNoError;
-
+
if (!err && io_ccache) {
cci_identifier_release (io_ccache->identifier);
ccs_lock_state_release (io_ccache->lock_state);
@@ -257,8 +257,8 @@ cc_int32 ccs_ccache_release (ccs_ccache_t io_ccache)
ccs_callback_array_release (io_ccache->change_callbacks);
free (io_ccache);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -272,17 +272,17 @@ cc_int32 ccs_ccache_compare_identifier (ccs_ccache_t in_ccache,
cc_uint32 *out_equal)
{
cc_int32 err = ccNoError;
-
+
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier) { err = cci_check_error (ccErrBadParam); }
if (!out_equal ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = cci_identifier_compare (in_ccache->identifier,
- in_identifier,
+ err = cci_identifier_compare (in_ccache->identifier,
+ in_identifier,
out_equal);
}
-
+
return cci_check_error (err);
}
@@ -293,15 +293,15 @@ cc_int32 ccs_ccache_compare_name (ccs_ccache_t in_ccache,
cc_uint32 *out_equal)
{
cc_int32 err = ccNoError;
-
+
if (!in_ccache) { err = cci_check_error (ccErrBadParam); }
if (!in_name ) { err = cci_check_error (ccErrBadParam); }
if (!out_equal) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
*out_equal = (strcmp (in_ccache->name, in_name) == 0);
}
-
+
return cci_check_error (err);
}
@@ -316,28 +316,28 @@ cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache,
{
cc_int32 err = ccNoError;
k5_ipc_stream reply_data = NULL;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
cc_time_t now = time (NULL);
-
+
if (io_ccache->last_changed_time < now) {
io_ccache->last_changed_time = now;
} else {
io_ccache->last_changed_time++;
}
}
-
+
if (!err) {
err = ccs_cache_collection_changed (io_cache_collection);
}
-
+
if (!err) {
err = krb5int_ipc_stream_new (&reply_data);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (reply_data, io_ccache->last_changed_time);
}
@@ -346,12 +346,12 @@ cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache,
/* Loop over callbacks sending messages to them */
cc_uint64 i;
cc_uint64 count = ccs_callback_array_count (io_ccache->change_callbacks);
-
+
for (i = 0; !err && i < count; i++) {
ccs_callback_t callback = ccs_callback_array_object_at_index (io_ccache->change_callbacks, i);
-
+
err = ccs_callback_reply_to_client (callback, reply_data);
-
+
if (!err) {
cci_debug_printf ("%s: Removing callback reference %p.", __FUNCTION__, callback);
err = ccs_callback_array_remove (io_ccache->change_callbacks, i);
@@ -359,14 +359,14 @@ cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache,
}
}
}
-
+
if (!err) {
- err = ccs_os_notify_ccache_changed (io_cache_collection,
+ err = ccs_os_notify_ccache_changed (io_cache_collection,
io_ccache->name);
}
-
+
krb5int_ipc_stream_release (reply_data);
-
+
return cci_check_error (err);
}
@@ -376,19 +376,19 @@ static cc_int32 ccs_ccache_invalidate_change_callback (ccs_callback_owner_t io_c
ccs_callback_t in_callback)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_callback) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
/* Remove callback */
ccs_ccache_t ccache = (ccs_ccache_t) io_ccache;
cc_uint64 i;
cc_uint64 count = ccs_callback_array_count (ccache->change_callbacks);
-
+
for (i = 0; !err && i < count; i++) {
ccs_callback_t callback = ccs_callback_array_object_at_index (ccache->change_callbacks, i);
-
+
if (callback == in_callback) {
cci_debug_printf ("%s: Removing callback reference %p.", __FUNCTION__, callback);
err = ccs_callback_array_remove (ccache->change_callbacks, i);
@@ -396,7 +396,7 @@ static cc_int32 ccs_ccache_invalidate_change_callback (ccs_callback_owner_t io_c
}
}
}
-
+
return cci_check_error (err);
}
@@ -407,24 +407,24 @@ cc_int32 ccs_ccache_notify_default_state_changed (ccs_ccache_t io_ccac
cc_uint32 in_new_default_state)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err && in_new_default_state) {
cc_time_t now = time (NULL);
-
+
if (io_ccache->last_default_time < now) {
io_ccache->last_default_time = now;
} else {
io_ccache->last_default_time++;
}
}
-
+
if (!err) {
err = ccs_ccache_changed (io_ccache, io_cache_collection);
}
-
+
return cci_check_error (err);
}
@@ -439,17 +439,17 @@ cc_int32 ccs_ccache_find_credentials_iterator (ccs_ccache_t in_cc
ccs_credentials_iterator_t *out_credentials_iterator)
{
cc_int32 err = ccNoError;
-
+
if (!in_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_credentials_list_find_iterator (in_ccache->credentials,
in_identifier,
out_credentials_iterator);
}
-
+
// Don't report ccErrInvalidCredentials to the log file. Non-fatal.
return (err == ccErrInvalidCredentials) ? err : cci_check_error (err);
}
@@ -464,15 +464,15 @@ cc_int32 ccs_ccache_write (ccs_ccache_t in_ccache,
k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
-
+
if (!in_ccache) { err = cci_check_error (ccErrBadParam); }
if (!io_stream) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_identifier_write (in_ccache->identifier, io_stream);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
@@ -482,15 +482,15 @@ cc_int32 ccs_ccache_write_name (ccs_ccache_t in_ccache,
k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
-
+
if (!in_ccache) { err = cci_check_error (ccErrBadParam); }
if (!io_stream) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (io_stream, in_ccache->name);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -506,23 +506,23 @@ static cc_int32 ccs_ccache_destroy (ccs_ccache_t io_ccache,
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_cache_collection_destroy_ccache (io_cache_collection,
+ err = ccs_cache_collection_destroy_ccache (io_cache_collection,
io_ccache->identifier);
}
-
+
if (!err) {
/* ccache has been destroyed so just mark the cache collection */
err = ccs_cache_collection_changed (io_cache_collection);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -533,18 +533,18 @@ static cc_int32 ccs_ccache_set_default (ccs_ccache_t io_ccache,
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_cache_collection_set_default_ccache (io_cache_collection,
+ err = ccs_cache_collection_set_default_ccache (io_cache_collection,
io_ccache->identifier);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -555,17 +555,17 @@ static cc_int32 ccs_ccache_get_credentials_version (ccs_ccache_t io_cc
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_uint32 (io_reply_data, io_ccache->creds_version);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -576,17 +576,17 @@ static cc_int32 ccs_ccache_get_name (ccs_ccache_t io_ccache,
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_string (io_reply_data, io_ccache->name);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -598,33 +598,33 @@ static cc_int32 ccs_ccache_get_principal (ccs_ccache_t io_ccache,
{
cc_int32 err = ccNoError;
cc_uint32 version = 0;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &version);
}
-
+
if (!err && version == cc_credentials_v4_v5) {
err = cci_check_error (ccErrBadCredentialsVersion);
}
-
+
if (!err) {
if (version == cc_credentials_v4) {
err = krb5int_ipc_stream_write_string (io_reply_data, io_ccache->v4_principal);
-
+
} else if (version == cc_credentials_v5) {
err = krb5int_ipc_stream_write_string (io_reply_data, io_ccache->v5_principal);
-
+
} else {
err = cci_check_error (ccErrBadCredentialsVersion);
}
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -637,35 +637,35 @@ static cc_int32 ccs_ccache_set_principal (ccs_ccache_t io_ccache,
cc_int32 err = ccNoError;
cc_uint32 version = 0;
char *principal = NULL;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &version);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_string (in_request_data, &principal);
}
-
+
if (!err) {
/* reset KDC time offsets because they are per-KDC */
if (version == cc_credentials_v4) {
io_ccache->kdc_time_offset_v4 = 0;
io_ccache->kdc_time_offset_v4_valid = 0;
-
+
if (io_ccache->v4_principal) { free (io_ccache->v4_principal); }
io_ccache->v4_principal = principal;
principal = NULL; /* take ownership */
-
-
+
+
} else if (version == cc_credentials_v5) {
io_ccache->kdc_time_offset_v5 = 0;
io_ccache->kdc_time_offset_v5_valid = 0;
-
+
if (io_ccache->v5_principal) { free (io_ccache->v5_principal); }
io_ccache->v5_principal = principal;
principal = NULL; /* take ownership */
@@ -674,16 +674,16 @@ static cc_int32 ccs_ccache_set_principal (ccs_ccache_t io_ccache,
err = cci_check_error (ccErrBadCredentialsVersion);
}
}
-
+
if (!err) {
io_ccache->creds_version |= version;
-
+
err = ccs_ccache_changed (io_ccache, io_cache_collection);
}
-
+
krb5int_ipc_stream_free_string (principal);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -695,24 +695,24 @@ static cc_int32 ccs_ccache_store_credentials (ccs_ccache_t io_ccache,
{
cc_int32 err = ccNoError;
ccs_credentials_t credentials = NULL;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_credentials_new (&credentials, in_request_data,
- io_ccache->creds_version,
+ err = ccs_credentials_new (&credentials, in_request_data,
+ io_ccache->creds_version,
io_ccache->credentials);
}
-
+
if (!err) {
err = ccs_ccache_changed (io_ccache, io_cache_collection);
}
-
-
- return cci_check_error (err);
+
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -724,27 +724,27 @@ static cc_int32 ccs_ccache_remove_credentials (ccs_ccache_t io_ccache,
{
cc_int32 err = ccNoError;
cci_identifier_t credentials_identifier = NULL;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_identifier_read (&credentials_identifier, in_request_data);
}
-
+
if (!err) {
err = ccs_credentials_list_remove (io_ccache->credentials, credentials_identifier);
}
-
+
if (!err) {
err = ccs_ccache_changed (io_ccache, io_cache_collection);
}
-
+
cci_identifier_release (credentials_identifier);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -757,23 +757,23 @@ static cc_int32 ccs_ccache_new_credentials_iterator (ccs_ccache_t io_c
{
cc_int32 err = ccNoError;
ccs_credentials_iterator_t credentials_iterator = NULL;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_credentials_list_new_iterator (io_ccache->credentials,
in_client_pipe,
&credentials_iterator);
}
-
+
if (!err) {
err = ccs_credentials_list_iterator_write (credentials_iterator, io_reply_data);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -785,31 +785,31 @@ static cc_int32 ccs_ccache_move (ccs_ccache_t io_ccache,
{
cc_int32 err = ccNoError;
cci_identifier_t source_identifier = NULL;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
/* Note: message is sent as the destination ccache to avoid */
/* extra work on the server when deleting it the source ccache. */
err = cci_identifier_read (&source_identifier, in_request_data);
}
-
+
if (!err) {
err = ccs_ccache_collection_move_ccache (io_cache_collection,
- source_identifier,
+ source_identifier,
io_ccache);
}
-
+
if (!err) {
err = ccs_ccache_changed (io_ccache, io_cache_collection);
}
-
+
cci_identifier_release (source_identifier);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -825,29 +825,29 @@ static cc_int32 ccs_ccache_lock (ccs_pipe_t in_client_pipe,
cc_int32 err = ccNoError;
cc_uint32 lock_type;
cc_uint32 block;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!out_will_block ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &lock_type);
}
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &block);
}
-
+
if (!err) {
- err = ccs_lock_state_add (io_ccache->lock_state,
- in_client_pipe, in_reply_pipe,
+ err = ccs_lock_state_add (io_ccache->lock_state,
+ in_client_pipe, in_reply_pipe,
lock_type, block, out_will_block);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -859,18 +859,18 @@ static cc_int32 ccs_ccache_unlock (ccs_pipe_t in_client_pipe,
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_lock_state_remove (io_ccache->lock_state, in_client_pipe);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -881,21 +881,21 @@ static cc_int32 ccs_ccache_get_last_default_time (ccs_ccache_t io_ccac
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err && io_ccache->last_default_time == 0) {
err = cci_check_error (ccErrNeverDefault);
}
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (io_reply_data, io_ccache->last_default_time);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -906,17 +906,17 @@ static cc_int32 ccs_ccache_get_change_time (ccs_ccache_t io_ccache,
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_write_time (io_reply_data, io_ccache->last_changed_time);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -932,51 +932,51 @@ static cc_int32 ccs_ccache_wait_for_change (ccs_pipe_t in_client_pi
cc_int32 err = ccNoError;
cc_time_t last_wait_for_change_time = 0;
cc_uint32 will_block = 0;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_reply_pipe )) { err = cci_check_error (ccErrBadParam); }
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!out_will_block ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_time (in_request_data, &last_wait_for_change_time);
}
-
+
if (!err) {
if (last_wait_for_change_time < io_ccache->last_changed_time) {
cci_debug_printf ("%s returning immediately", __FUNCTION__);
err = krb5int_ipc_stream_write_time (io_reply_data, io_ccache->last_changed_time);
-
+
} else {
ccs_callback_t callback = NULL;
- err = ccs_callback_new (&callback,
- ccErrInvalidCCache,
- in_client_pipe,
+ err = ccs_callback_new (&callback,
+ ccErrInvalidCCache,
+ in_client_pipe,
in_reply_pipe,
(ccs_callback_owner_t) io_ccache,
ccs_ccache_invalidate_change_callback);
-
+
if (!err) {
err = ccs_callback_array_insert (io_ccache->change_callbacks, callback,
ccs_callback_array_count (io_ccache->change_callbacks));
if (!err) { callback = NULL; /* take ownership */ }
-
+
cci_debug_printf ("%s blocking", __FUNCTION__);
will_block = 1;
}
-
+
ccs_callback_release (callback);
}
}
-
+
if (!err) {
*out_will_block = will_block;
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -988,16 +988,16 @@ static cc_int32 ccs_ccache_get_kdc_time_offset (ccs_ccache_t io_ccache
{
cc_int32 err = ccNoError;
cc_uint32 cred_vers = 0;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &cred_vers);
}
-
+
if (!err) {
if (cred_vers == cc_credentials_v4) {
if (io_ccache->kdc_time_offset_v4_valid) {
@@ -1005,20 +1005,20 @@ static cc_int32 ccs_ccache_get_kdc_time_offset (ccs_ccache_t io_ccache
} else {
err = cci_check_error (ccErrTimeOffsetNotSet);
}
-
+
} else if (cred_vers == cc_credentials_v5) {
if (io_ccache->kdc_time_offset_v5_valid) {
err = krb5int_ipc_stream_write_time (io_reply_data, io_ccache->kdc_time_offset_v5);
} else {
err = cci_check_error (ccErrTimeOffsetNotSet);
}
-
+
} else {
err = cci_check_error (ccErrBadCredentialsVersion);
}
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -1030,26 +1030,26 @@ static cc_int32 ccs_ccache_set_kdc_time_offset (ccs_ccache_t io_ccache
{
cc_int32 err = ccNoError;
cc_uint32 cred_vers = 0;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &cred_vers);
}
-
+
if (!err) {
if (cred_vers == cc_credentials_v4) {
err = krb5int_ipc_stream_read_time (in_request_data, &io_ccache->kdc_time_offset_v4);
-
+
if (!err) {
io_ccache->kdc_time_offset_v4_valid = 1;
}
} else if (cred_vers == cc_credentials_v5) {
err = krb5int_ipc_stream_read_time (in_request_data, &io_ccache->kdc_time_offset_v5);
-
+
if (!err) {
io_ccache->kdc_time_offset_v5_valid = 1;
}
@@ -1057,12 +1057,12 @@ static cc_int32 ccs_ccache_set_kdc_time_offset (ccs_ccache_t io_ccache
err = cci_check_error (ccErrBadCredentialsVersion);
}
}
-
+
if (!err) {
err = ccs_ccache_changed (io_ccache, io_cache_collection);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -1074,35 +1074,35 @@ static cc_int32 ccs_ccache_clear_kdc_time_offset (ccs_ccache_t io_ccac
{
cc_int32 err = ccNoError;
cc_uint32 cred_vers = 0;
-
+
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_read_uint32 (in_request_data, &cred_vers);
}
-
+
if (!err) {
if (cred_vers == cc_credentials_v4) {
io_ccache->kdc_time_offset_v4 = 0;
io_ccache->kdc_time_offset_v4_valid = 0;
-
+
} else if (cred_vers == cc_credentials_v5) {
io_ccache->kdc_time_offset_v5 = 0;
io_ccache->kdc_time_offset_v5_valid = 0;
-
+
} else {
err = cci_check_error (ccErrBadCredentialsVersion);
}
}
-
+
if (!err) {
err = ccs_ccache_changed (io_ccache, io_cache_collection);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -1123,104 +1123,104 @@ cc_int32 ccs_ccache_handle_message (ccs_pipe_t in_client_pipe,
cc_int32 err = ccNoError;
cc_uint32 will_block = 0;
k5_ipc_stream reply_data = NULL;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!out_will_block ) { err = cci_check_error (ccErrBadParam); }
if (!out_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&reply_data);
}
-
+
if (!err) {
if (in_request_name == cci_ccache_destroy_msg_id) {
err = ccs_ccache_destroy (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_set_default_msg_id) {
err = ccs_ccache_set_default (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_get_credentials_version_msg_id) {
err = ccs_ccache_get_credentials_version (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_get_name_msg_id) {
err = ccs_ccache_get_name (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_get_principal_msg_id) {
err = ccs_ccache_get_principal (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_set_principal_msg_id) {
err = ccs_ccache_set_principal (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_store_credentials_msg_id) {
err = ccs_ccache_store_credentials (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_remove_credentials_msg_id) {
err = ccs_ccache_remove_credentials (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_new_credentials_iterator_msg_id) {
- err = ccs_ccache_new_credentials_iterator (io_ccache,
+ err = ccs_ccache_new_credentials_iterator (io_ccache,
io_cache_collection,
in_client_pipe,
- in_request_data,
+ in_request_data,
reply_data);
-
+
} else if (in_request_name == cci_ccache_move_msg_id) {
err = ccs_ccache_move (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_lock_msg_id) {
- err = ccs_ccache_lock (in_client_pipe, in_reply_pipe,
+ err = ccs_ccache_lock (in_client_pipe, in_reply_pipe,
io_ccache, io_cache_collection,
- in_request_data,
+ in_request_data,
&will_block, reply_data);
-
+
} else if (in_request_name == cci_ccache_unlock_msg_id) {
- err = ccs_ccache_unlock (in_client_pipe,
+ err = ccs_ccache_unlock (in_client_pipe,
io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_get_last_default_time_msg_id) {
err = ccs_ccache_get_last_default_time (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_get_change_time_msg_id) {
err = ccs_ccache_get_change_time (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_wait_for_change_msg_id) {
- err = ccs_ccache_wait_for_change (in_client_pipe, in_reply_pipe,
+ err = ccs_ccache_wait_for_change (in_client_pipe, in_reply_pipe,
io_ccache, io_cache_collection,
in_request_data, reply_data,
&will_block);
-
+
} else if (in_request_name == cci_ccache_get_kdc_time_offset_msg_id) {
err = ccs_ccache_get_kdc_time_offset (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_set_kdc_time_offset_msg_id) {
err = ccs_ccache_set_kdc_time_offset (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else if (in_request_name == cci_ccache_clear_kdc_time_offset_msg_id) {
err = ccs_ccache_clear_kdc_time_offset (io_ccache, io_cache_collection,
in_request_data, reply_data);
-
+
} else {
err = ccErrBadInternalMessage;
}
}
-
+
if (!err) {
*out_will_block = will_block;
if (!will_block) {
@@ -1230,9 +1230,8 @@ cc_int32 ccs_ccache_handle_message (ccs_pipe_t in_client_pipe,
*out_reply_data = NULL;
}
}
-
+
krb5int_ipc_stream_release (reply_data);
-
+
return cci_check_error (err);
}
-
diff --git a/src/ccapi/server/ccs_ccache.h b/src/ccapi/server/ccs_ccache.h
index 21c9f41..9d4e607 100644
--- a/src/ccapi/server/ccs_ccache.h
+++ b/src/ccapi/server/ccs_ccache.h
@@ -40,7 +40,7 @@ cc_int32 ccs_ccache_reset (ccs_ccache_t io_ccache,
cc_uint32 in_cred_vers,
const char *in_principal);
-cc_int32 ccs_ccache_swap_contents (ccs_ccache_t io_source_ccache,
+cc_int32 ccs_ccache_swap_contents (ccs_ccache_t io_source_ccache,
ccs_ccache_t io_destination_ccache,
ccs_cache_collection_t io_cache_collection);
diff --git a/src/ccapi/server/ccs_ccache_iterator.c b/src/ccapi/server/ccs_ccache_iterator.c
index fb007bf..045ad3d 100644
--- a/src/ccapi/server/ccs_ccache_iterator.c
+++ b/src/ccapi/server/ccs_ccache_iterator.c
@@ -34,17 +34,17 @@ static cc_int32 ccs_ccache_iterator_release (ccs_ccache_iterator_t io_ccache_i
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!io_ccache_iterator ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_ccache_list_iterator_release (io_ccache_iterator);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -56,21 +56,21 @@ static cc_int32 ccs_ccache_iterator_next (ccs_ccache_iterator_t io_ccache_iter
{
cc_int32 err = ccNoError;
ccs_ccache_t ccache = NULL;
-
+
if (!io_ccache_iterator ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_ccache_list_iterator_next (io_ccache_iterator, &ccache);
}
-
+
if (!err) {
err = ccs_ccache_write (ccache, io_reply_data);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -82,22 +82,22 @@ static cc_int32 ccs_ccache_iterator_clone (ccs_ccache_iterator_t io_ccache_ite
{
cc_int32 err = ccNoError;
ccs_ccache_iterator_t ccache_iterator = NULL;
-
+
if (!io_ccache_iterator ) { err = cci_check_error (ccErrBadParam); }
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_ccache_list_iterator_clone (io_ccache_iterator,
&ccache_iterator);
}
-
+
if (!err) {
err = ccs_ccache_list_iterator_write (ccache_iterator, io_reply_data);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -114,45 +114,44 @@ static cc_int32 ccs_ccache_iterator_clone (ccs_ccache_iterator_t io_ccache_ite
{
cc_int32 err = ccNoError;
k5_ipc_stream reply_data = NULL;
-
+
if (!in_request_data) { err = cci_check_error (ccErrBadParam); }
if (!out_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&reply_data);
}
-
+
if (!err) {
if (in_request_name == cci_ccache_iterator_release_msg_id) {
err = ccs_ccache_iterator_release (io_ccache_iterator,
io_cache_collection,
- in_request_data,
+ in_request_data,
reply_data);
-
+
} else if (in_request_name == cci_ccache_iterator_next_msg_id) {
err = ccs_ccache_iterator_next (io_ccache_iterator,
io_cache_collection,
- in_request_data,
+ in_request_data,
reply_data);
-
+
} else if (in_request_name == cci_ccache_iterator_clone_msg_id) {
err = ccs_ccache_iterator_clone (io_ccache_iterator,
io_cache_collection,
- in_request_data,
+ in_request_data,
reply_data);
-
+
} else {
err = ccErrBadInternalMessage;
}
}
-
+
if (!err) {
*out_reply_data = reply_data;
reply_data = NULL; /* take ownership */
}
-
+
krb5int_ipc_stream_release (reply_data);
-
+
return cci_check_error (err);
}
-
diff --git a/src/ccapi/server/ccs_client.c b/src/ccapi/server/ccs_client.c
index 31ed14f..72ae89d 100644
--- a/src/ccapi/server/ccs_client.c
+++ b/src/ccapi/server/ccs_client.c
@@ -43,39 +43,39 @@ cc_int32 ccs_client_new (ccs_client_t *out_client,
{
cc_int32 err = ccNoError;
ccs_client_t client = NULL;
-
+
if (!out_client ) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
client = malloc (sizeof (*client));
- if (client) {
+ if (client) {
*client = ccs_client_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = ccs_callbackref_array_new (&client->callbacks);
}
-
+
if (!err) {
err = ccs_iteratorref_array_new (&client->iterators);
}
-
+
if (!err) {
err = ccs_pipe_copy (&client->client_pipe, in_client_pipe);
}
-
+
if (!err) {
*out_client = client;
client = NULL;
}
-
+
ccs_client_release (client);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -83,26 +83,26 @@ cc_int32 ccs_client_new (ccs_client_t *out_client,
cc_int32 ccs_client_release (ccs_client_t io_client)
{
cc_int32 err = ccNoError;
-
+
if (!err && io_client) {
cc_uint64 i;
cc_uint64 callback_count = ccs_callbackref_array_count (io_client->callbacks);
cc_uint64 iterator_count = ccs_iteratorref_array_count (io_client->iterators);
-
+
for (i = 0; !err && i < callback_count; i++) {
ccs_callback_t callback = ccs_callbackref_array_object_at_index (io_client->callbacks, i);
-
- cci_debug_printf ("%s: Invalidating callback reference %p.",
+
+ cci_debug_printf ("%s: Invalidating callback reference %p.",
__FUNCTION__, callback);
ccs_callback_invalidate (callback);
}
-
+
for (i = 0; !err && i < iterator_count; i++) {
ccs_generic_list_iterator_t iterator = ccs_iteratorref_array_object_at_index (io_client->iterators, i);
-
- cci_debug_printf ("%s: Invalidating iterator reference %p.",
+
+ cci_debug_printf ("%s: Invalidating iterator reference %p.",
__FUNCTION__, iterator);
- ccs_generic_list_iterator_invalidate (iterator);
+ ccs_generic_list_iterator_invalidate (iterator);
}
ccs_callbackref_array_release (io_client->callbacks);
@@ -110,8 +110,8 @@ cc_int32 ccs_client_release (ccs_client_t io_client)
ccs_pipe_release (io_client->client_pipe);
free (io_client);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -120,16 +120,16 @@ cc_int32 ccs_client_add_callback (ccs_client_t io_client,
ccs_callback_t in_callback)
{
cc_int32 err = ccNoError;
-
+
if (!io_client ) { err = cci_check_error (ccErrBadParam); }
if (!in_callback) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_callbackref_array_insert (io_client->callbacks, in_callback,
ccs_callbackref_array_count (io_client->callbacks));
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
@@ -140,16 +140,16 @@ cc_int32 ccs_client_remove_callback (ccs_client_t io_client,
{
cc_int32 err = ccNoError;
cc_uint32 found_callback = 0;
-
+
if (!io_client) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
cc_uint64 i;
cc_uint64 lock_count = ccs_callbackref_array_count (io_client->callbacks);
-
+
for (i = 0; !err && i < lock_count; i++) {
ccs_callback_t callback = ccs_callbackref_array_object_at_index (io_client->callbacks, i);
-
+
if (callback == in_callback) {
cci_debug_printf ("%s: Removing callback reference %p.", __FUNCTION__, callback);
found_callback = 1;
@@ -158,12 +158,12 @@ cc_int32 ccs_client_remove_callback (ccs_client_t io_client,
}
}
}
-
+
if (!err && !found_callback) {
cci_debug_printf ("%s: WARNING! callback not found.", __FUNCTION__);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -172,16 +172,16 @@ cc_int32 ccs_client_add_iterator (ccs_client_t io_client,
ccs_generic_list_iterator_t in_iterator)
{
cc_int32 err = ccNoError;
-
+
if (!io_client ) { err = cci_check_error (ccErrBadParam); }
if (!in_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_iteratorref_array_insert (io_client->iterators, in_iterator,
ccs_iteratorref_array_count (io_client->iterators));
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -191,16 +191,16 @@ cc_int32 ccs_client_remove_iterator (ccs_client_t io_client,
{
cc_int32 err = ccNoError;
cc_uint32 found_iterator = 0;
-
+
if (!io_client) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
cc_uint64 i;
cc_uint64 lock_count = ccs_iteratorref_array_count (io_client->iterators);
-
+
for (i = 0; !err && i < lock_count; i++) {
ccs_generic_list_iterator_t iterator = ccs_iteratorref_array_object_at_index (io_client->iterators, i);
-
+
if (iterator == in_iterator) {
cci_debug_printf ("%s: Removing iterator reference %p.", __FUNCTION__, iterator);
found_iterator = 1;
@@ -209,12 +209,12 @@ cc_int32 ccs_client_remove_iterator (ccs_client_t io_client,
}
}
}
-
+
if (!err && !found_iterator) {
cci_debug_printf ("%s: WARNING! iterator not found.", __FUNCTION__);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -224,14 +224,14 @@ cc_int32 ccs_client_uses_pipe (ccs_client_t in_client,
cc_uint32 *out_uses_pipe)
{
cc_int32 err = ccNoError;
-
+
if (!in_client ) { err = cci_check_error (ccErrBadParam); }
if (!in_pipe ) { err = cci_check_error (ccErrBadParam); }
if (!out_uses_pipe) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_pipe_compare (in_client->client_pipe, in_pipe, out_uses_pipe);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
diff --git a/src/ccapi/server/ccs_credentials.c b/src/ccapi/server/ccs_credentials.c
index 56b5a57..9795ef8 100644
--- a/src/ccapi/server/ccs_credentials.c
+++ b/src/ccapi/server/ccs_credentials.c
@@ -42,44 +42,44 @@ cc_int32 ccs_credentials_new (ccs_credentials_t *out_credentials,
{
cc_int32 err = ccNoError;
ccs_credentials_t credentials = NULL;
-
+
if (!out_credentials) { err = cci_check_error (ccErrBadParam); }
if (!in_stream ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
credentials = malloc (sizeof (*credentials));
- if (credentials) {
+ if (credentials) {
*credentials = ccs_credentials_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = cci_credentials_union_read (&credentials->cred_union, in_stream);
}
-
+
if (!err && !(credentials->cred_union->version & in_ccache_version)) {
/* ccache does not have a principal set for this credentials version */
err = cci_check_error (ccErrBadCredentialsVersion);
}
-
+
if (!err) {
err = ccs_server_new_identifier (&credentials->identifier);
}
-
+
if (!err) {
err = ccs_credentials_list_add (io_credentials_list, credentials);
}
-
+
if (!err) {
*out_credentials = credentials;
credentials = NULL;
}
-
+
ccs_credentials_release (credentials);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -87,14 +87,14 @@ cc_int32 ccs_credentials_new (ccs_credentials_t *out_credentials,
cc_int32 ccs_credentials_release (ccs_credentials_t io_credentials)
{
cc_int32 err = ccNoError;
-
+
if (!err && io_credentials) {
cci_credentials_union_release (io_credentials->cred_union);
cci_identifier_release (io_credentials->identifier);
free (io_credentials);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -103,19 +103,19 @@ cc_int32 ccs_credentials_write (ccs_credentials_t in_credentials,
k5_ipc_stream io_stream)
{
cc_int32 err = ccNoError;
-
+
if (!in_credentials) { err = cci_check_error (ccErrBadParam); }
if (!io_stream ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_identifier_write (in_credentials->identifier, io_stream);
}
-
+
if (!err) {
err = cci_credentials_union_write (in_credentials->cred_union, io_stream);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -125,16 +125,16 @@ cc_int32 ccs_credentials_compare_identifier (ccs_credentials_t in_credentials,
cc_uint32 *out_equal)
{
cc_int32 err = ccNoError;
-
+
if (!in_credentials) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_equal ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = cci_identifier_compare (in_credentials->identifier,
- in_identifier,
+ err = cci_identifier_compare (in_credentials->identifier,
+ in_identifier,
out_equal);
}
-
+
return cci_check_error (err);
}
diff --git a/src/ccapi/server/ccs_credentials_iterator.c b/src/ccapi/server/ccs_credentials_iterator.c
index 3ca7eee..27751ed 100644
--- a/src/ccapi/server/ccs_credentials_iterator.c
+++ b/src/ccapi/server/ccs_credentials_iterator.c
@@ -34,17 +34,17 @@ static cc_int32 ccs_credentials_iterator_release (ccs_credentials_iterator_t io_
k5_ipc_stream io_reply_data)
{
cc_int32 err = ccNoError;
-
+
if (!io_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_credentials_list_iterator_release (io_credentials_iterator);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -56,22 +56,22 @@ static cc_int32 ccs_credentials_iterator_next (ccs_credentials_iterator_t io_cre
{
cc_int32 err = ccNoError;
ccs_credentials_t credentials = NULL;
-
+
if (!io_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_credentials_list_iterator_next (io_credentials_iterator,
&credentials);
}
-
+
if (!err) {
err = ccs_credentials_write (credentials, io_reply_data);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -83,23 +83,23 @@ static cc_int32 ccs_credentials_iterator_clone (ccs_credentials_iterator_t io_c
{
cc_int32 err = ccNoError;
ccs_credentials_iterator_t credentials_iterator = NULL;
-
+
if (!io_credentials_iterator) { err = cci_check_error (ccErrBadParam); }
if (!io_ccache ) { err = cci_check_error (ccErrBadParam); }
if (!in_request_data ) { err = cci_check_error (ccErrBadParam); }
if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_credentials_list_iterator_clone (io_credentials_iterator,
&credentials_iterator);
}
-
+
if (!err) {
- err = ccs_credentials_list_iterator_write (credentials_iterator,
+ err = ccs_credentials_list_iterator_write (credentials_iterator,
io_reply_data);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -116,45 +116,44 @@ static cc_int32 ccs_credentials_iterator_clone (ccs_credentials_iterator_t io_c
{
cc_int32 err = ccNoError;
k5_ipc_stream reply_data = NULL;
-
+
if (!in_request_data) { err = cci_check_error (ccErrBadParam); }
if (!out_reply_data ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = krb5int_ipc_stream_new (&reply_data);
}
-
+
if (!err) {
if (in_request_name == cci_credentials_iterator_release_msg_id) {
err = ccs_credentials_iterator_release (io_credentials_iterator,
io_ccache,
in_request_data,
reply_data);
-
+
} else if (in_request_name == cci_credentials_iterator_next_msg_id) {
err = ccs_credentials_iterator_next (io_credentials_iterator,
io_ccache,
in_request_data,
reply_data);
-
+
} else if (in_request_name == cci_credentials_iterator_clone_msg_id) {
err = ccs_credentials_iterator_clone (io_credentials_iterator,
io_ccache,
in_request_data,
reply_data);
-
+
} else {
err = ccErrBadInternalMessage;
}
}
-
+
if (!err) {
*out_reply_data = reply_data;
reply_data = NULL; /* take ownership */
}
-
+
krb5int_ipc_stream_release (reply_data);
-
+
return cci_check_error (err);
}
-
diff --git a/src/ccapi/server/ccs_list.c b/src/ccapi/server/ccs_list.c
index c5b1eb4..8896734 100644
--- a/src/ccapi/server/ccs_list.c
+++ b/src/ccapi/server/ccs_list.c
@@ -49,7 +49,7 @@ static cc_int32 ccs_cache_collection_list_object_compare_identifier (ccs_list_ob
cc_int32 ccs_cache_collection_list_new (ccs_cache_collection_list_t *out_list)
{
- return ccs_list_new (out_list,
+ return ccs_list_new (out_list,
ccErrInvalidContext,
ccErrInvalidContext,
ccs_cache_collection_list_object_compare_identifier,
@@ -122,7 +122,7 @@ static cc_int32 ccs_ccache_list_object_compare_identifier (ccs_list_object_t in
cc_int32 ccs_ccache_list_new (ccs_ccache_list_t *out_list)
{
- return ccs_list_new (out_list,
+ return ccs_list_new (out_list,
ccErrInvalidCCache,
ccErrInvalidCCacheIterator,
ccs_ccache_list_object_compare_identifier,
@@ -161,7 +161,7 @@ cc_int32 ccs_ccache_list_find_iterator (ccs_ccache_list_t in_list,
cci_identifier_t in_identifier,
ccs_ccache_list_iterator_t *out_list_iterator)
{
- return ccs_list_find_iterator (in_list, in_identifier,
+ return ccs_list_find_iterator (in_list, in_identifier,
(ccs_list_iterator_t *) out_list_iterator);
}
@@ -201,7 +201,7 @@ cc_int32 ccs_ccache_list_release (ccs_ccache_list_t io_list)
cc_int32 ccs_ccache_list_iterator_write (ccs_ccache_list_iterator_t in_list_iterator,
k5_ipc_stream in_stream)
{
- return ccs_list_iterator_write (in_list_iterator, in_stream);
+ return ccs_list_iterator_write (in_list_iterator, in_stream);
}
/* ------------------------------------------------------------------------ */
@@ -253,8 +253,8 @@ static cc_int32 ccs_credentials_list_object_compare_identifier (ccs_list_object_
cc_int32 ccs_credentials_list_new (ccs_credentials_list_t *out_list)
{
- return ccs_list_new (out_list,
- ccErrInvalidCredentials,
+ return ccs_list_new (out_list,
+ ccErrInvalidCredentials,
ccErrInvalidCredentialsIterator,
ccs_credentials_list_object_compare_identifier,
ccs_credentials_list_object_release);
@@ -292,7 +292,7 @@ cc_int32 ccs_credentials_list_find_iterator (ccs_credentials_list_t in
cci_identifier_t in_identifier,
ccs_credentials_list_iterator_t *out_list_iterator)
{
- return ccs_list_find_iterator (in_list, in_identifier,
+ return ccs_list_find_iterator (in_list, in_identifier,
(ccs_list_iterator_t *) out_list_iterator);
}
@@ -324,7 +324,7 @@ cc_int32 ccs_credentials_list_release (ccs_credentials_list_t io_list)
cc_int32 ccs_credentials_list_iterator_write (ccs_credentials_list_iterator_t in_list_iterator,
k5_ipc_stream in_stream)
{
- return ccs_list_iterator_write (in_list_iterator, in_stream);
+ return ccs_list_iterator_write (in_list_iterator, in_stream);
}
/* ------------------------------------------------------------------------ */
diff --git a/src/ccapi/server/ccs_list_internal.c b/src/ccapi/server/ccs_list_internal.c
index 74bc45a6a..834a7bc 100644
--- a/src/ccapi/server/ccs_list_internal.c
+++ b/src/ccapi/server/ccs_list_internal.c
@@ -84,37 +84,37 @@ cc_int32 ccs_list_new (ccs_list_t *out_list,
{
cc_int32 err = ccNoError;
ccs_list_t list = NULL;
-
+
if (!out_list) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
list = malloc (sizeof (*list));
- if (list) {
+ if (list) {
*list = ccs_list_initializer;
list->object_not_found_err = in_object_not_found_err;
list->iterator_not_found_err = in_iterator_not_found_err;
list->object_compare_identifier = in_object_compare_identifier;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = cci_array_new (&list->objects, in_object_release);
}
-
+
if (!err) {
err = cci_array_new (&list->iterators, ccs_list_iterator_object_release);
}
-
+
if (!err) {
*out_list = list;
list = NULL;
}
-
+
ccs_list_release (list);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -122,14 +122,14 @@ cc_int32 ccs_list_new (ccs_list_t *out_list,
cc_int32 ccs_list_release (ccs_list_t io_list)
{
cc_int32 err = ccNoError;
-
- if (!err && io_list) {
+
+ if (!err && io_list) {
cci_array_release (io_list->iterators);
cci_array_release (io_list->objects);
free (io_list);
}
-
- return err;
+
+ return err;
}
/* ------------------------------------------------------------------------ */
@@ -138,8 +138,8 @@ cc_int32 ccs_list_new_iterator (ccs_list_t io_list,
ccs_pipe_t in_client_pipe,
ccs_list_iterator_t *out_list_iterator)
{
- return cci_check_error (ccs_list_iterator_new (out_list_iterator,
- io_list,
+ return cci_check_error (ccs_list_iterator_new (out_list_iterator,
+ io_list,
in_client_pipe));
}
@@ -150,19 +150,19 @@ cc_int32 ccs_list_release_iterator (ccs_list_t io_list,
{
cc_int32 err = ccNoError;
ccs_list_iterator_t iterator = NULL;
-
+
if (!io_list ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_list_find_iterator (io_list, in_identifier, &iterator);
}
-
+
if (!err) {
err = ccs_list_iterator_release (iterator);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -171,15 +171,15 @@ cc_int32 ccs_list_count (ccs_list_t in_list,
cc_uint64 *out_count)
{
cc_int32 err = ccNoError;
-
+
if (!in_list ) { err = cci_check_error (ccErrBadParam); }
if (!out_count) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
*out_count = cci_array_count (in_list->objects);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -187,7 +187,7 @@ cc_int32 ccs_list_count (ccs_list_t in_list,
static ccs_list_iterator_t ccs_list_iterator_at_index (ccs_list_t in_list,
cc_uint64 in_index)
{
- return (ccs_list_iterator_t) cci_array_object_at_index (in_list->iterators, in_index);
+ return (ccs_list_iterator_t) cci_array_object_at_index (in_list->iterators, in_index);
}
/* ------------------------------------------------------------------------ */
@@ -198,33 +198,33 @@ static cc_int32 ccs_list_find_index (ccs_list_t in_list,
{
cc_int32 err = ccNoError;
cc_int32 found = 0;
-
+
if (!in_list ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_object_index) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err && !found) {
cc_uint64 i;
-
+
for (i = 0; !err && i < cci_array_count (in_list->objects); i++) {
cc_uint32 equal = 0;
cci_array_object_t object = cci_array_object_at_index (in_list->objects, i);
-
+
err = in_list->object_compare_identifier (object, in_identifier, &equal);
-
+
if (!err && equal) {
found = 1;
*out_object_index = i;
break;
}
- }
+ }
}
-
+
if (!err && !found) {
- err = cci_check_error (in_list->object_not_found_err);
+ err = cci_check_error (in_list->object_not_found_err);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -234,20 +234,20 @@ cc_int32 ccs_list_find (ccs_list_t in_list,
{
cc_int32 err = ccNoError;
cc_uint64 i;
-
+
if (!in_list ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier) { err = cci_check_error (ccErrBadParam); }
if (!out_object ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_list_find_index (in_list, in_identifier, &i);
}
-
+
if (!err) {
*out_object = cci_array_object_at_index (in_list->objects, i);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -258,33 +258,33 @@ static cc_int32 ccs_list_find_iterator_index (ccs_list_t in_list,
{
cc_int32 err = ccNoError;
cc_int32 found = 0;
-
+
if (!in_list ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_object_index) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err && !found) {
cc_uint64 i;
-
+
for (i = 0; !err && i < cci_array_count (in_list->iterators); i++) {
cc_uint32 equal = 0;
ccs_list_iterator_t iterator = ccs_list_iterator_at_index (in_list, i);
-
+
err = cci_identifier_compare (iterator->identifier, in_identifier, &equal);
-
+
if (!err && equal) {
found = 1;
*out_object_index = i;
break;
}
- }
+ }
}
-
+
if (!err && !found) {
// Don't report this error to the log file. Non-fatal.
- return in_list->object_not_found_err;
+ return in_list->object_not_found_err;
} else {
- return cci_check_error (err);
+ return cci_check_error (err);
}
}
@@ -296,20 +296,20 @@ cc_int32 ccs_list_find_iterator (ccs_list_t in_list,
{
cc_int32 err = ccNoError;
cc_uint64 i;
-
+
if (!in_list ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier ) { err = cci_check_error (ccErrBadParam); }
if (!out_list_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_list_find_iterator_index (in_list, in_identifier, &i);
}
-
+
if (!err) {
*out_list_iterator = ccs_list_iterator_at_index (in_list, i);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -319,28 +319,28 @@ cc_int32 ccs_list_add (ccs_list_t io_list,
{
cc_int32 err = ccNoError;
cc_uint64 add_index;
-
+
if (!io_list ) { err = cci_check_error (ccErrBadParam); }
if (!in_object) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
add_index = cci_array_count (io_list->objects);
-
+
err = cci_array_insert (io_list->objects, in_object, add_index);
}
-
+
if (!err) {
/* Fixup iterator indexes */
cc_uint64 i;
-
+
for (i = 0; !err && i < cci_array_count (io_list->iterators); i++) {
ccs_list_iterator_t iterator = ccs_list_iterator_at_index (io_list, i);
-
+
err = ccs_list_iterator_update (iterator, ccs_list_action_insert, add_index);
- }
- }
-
- return cci_check_error (err);
+ }
+ }
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -350,30 +350,30 @@ cc_int32 ccs_list_remove (ccs_list_t io_list,
{
cc_int32 err = ccNoError;
cc_uint64 remove_index;
-
+
if (!io_list ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_list_find_index (io_list, in_identifier, &remove_index);
}
-
+
if (!err) {
err = cci_array_remove (io_list->objects, remove_index);
}
-
+
if (!err) {
/* Fixup iterator indexes */
cc_uint64 i;
-
+
for (i = 0; !err && i < cci_array_count (io_list->iterators); i++) {
ccs_list_iterator_t iterator = ccs_list_iterator_at_index (io_list, i);
-
+
err = ccs_list_iterator_update (iterator, ccs_list_action_remove, remove_index);
- }
- }
-
- return cci_check_error (err);
+ }
+ }
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -383,32 +383,32 @@ cc_int32 ccs_list_push_front (ccs_list_t io_list,
{
cc_int32 err = ccNoError;
cc_uint64 push_front_index;
-
+
if (!io_list ) { err = cci_check_error (ccErrBadParam); }
if (!in_identifier) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_list_find_index (io_list, in_identifier, &push_front_index);
}
-
+
if (!err) {
- err = cci_array_push_front (io_list->objects, push_front_index);
+ err = cci_array_push_front (io_list->objects, push_front_index);
}
-
+
if (!err) {
/* Fixup iterator indexes */
cc_uint64 i;
-
+
for (i = 0; !err && i < cci_array_count (io_list->iterators); i++) {
ccs_list_iterator_t iterator = ccs_list_iterator_at_index (io_list, i);
-
- err = ccs_list_iterator_update (iterator,
- ccs_list_action_push_front,
+
+ err = ccs_list_iterator_update (iterator,
+ ccs_list_action_push_front,
push_front_index);
- }
- }
-
- return cci_check_error (err);
+ }
+ }
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -423,20 +423,20 @@ static cc_int32 ccs_list_iterator_new (ccs_list_iterator_t *out_list_iterator,
{
cc_int32 err = ccNoError;
ccs_list_iterator_t list_iterator = NULL;
-
+
if (!out_list_iterator) { err = cci_check_error (ccErrBadParam); }
if (!io_list ) { err = cci_check_error (ccErrBadParam); }
/* client_pipe may be NULL if the iterator exists for internal server use */
-
+
if (!err) {
list_iterator = malloc (sizeof (*list_iterator));
- if (list_iterator) {
+ if (list_iterator) {
*list_iterator = ccs_list_iterator_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = ccs_server_new_identifier (&list_iterator->identifier);
}
@@ -444,21 +444,21 @@ static cc_int32 ccs_list_iterator_new (ccs_list_iterator_t *out_list_iterator,
if (!err) {
list_iterator->list = io_list;
list_iterator->current = 0;
-
- err = cci_array_insert (io_list->iterators,
- (cci_array_object_t) list_iterator,
+
+ err = cci_array_insert (io_list->iterators,
+ (cci_array_object_t) list_iterator,
cci_array_count (io_list->iterators));
}
-
+
if (!err && ccs_pipe_valid (in_client_pipe)) {
ccs_client_t client = NULL;
-
+
err = ccs_pipe_copy (&list_iterator->client_pipe, in_client_pipe);
-
+
if (!err) {
err = ccs_server_client_for_pipe (in_client_pipe, &client);
}
-
+
if (!err) {
err = ccs_client_add_iterator (client, list_iterator);
}
@@ -468,10 +468,10 @@ static cc_int32 ccs_list_iterator_new (ccs_list_iterator_t *out_list_iterator,
*out_list_iterator = list_iterator;
list_iterator = NULL;
}
-
+
ccs_list_iterator_release (list_iterator);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -480,16 +480,16 @@ cc_int32 ccs_list_iterator_write (ccs_list_iterator_t in_list_iterator,
k5_ipc_stream in_stream)
{
cc_int32 err = ccNoError;
-
+
if (!in_list_iterator) { err = cci_check_error (ccErrBadParam); }
if (!in_stream ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = cci_identifier_write (in_list_iterator->identifier,
+ err = cci_identifier_write (in_list_iterator->identifier,
in_stream);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -499,26 +499,26 @@ cc_int32 ccs_list_iterator_clone (ccs_list_iterator_t in_list_iterator,
{
cc_int32 err = ccNoError;
ccs_list_iterator_t list_iterator = NULL;
-
+
if (!in_list_iterator ) { err = cci_check_error (ccErrBadParam); }
if (!out_list_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_list_iterator_new (&list_iterator,
- in_list_iterator->list,
+ err = ccs_list_iterator_new (&list_iterator,
+ in_list_iterator->list,
in_list_iterator->client_pipe);
}
-
+
if (!err) {
list_iterator->current = in_list_iterator->current;
*out_list_iterator = list_iterator;
list_iterator = NULL;
}
-
+
ccs_list_iterator_release (list_iterator);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -527,27 +527,27 @@ static cc_int32 ccs_list_iterator_object_release (cci_array_object_t io_list_ite
{
cc_int32 err = ccNoError;
ccs_list_iterator_t list_iterator = (ccs_list_iterator_t) io_list_iterator;
-
+
if (!io_list_iterator) { err = ccErrBadParam; }
-
+
if (!err && ccs_pipe_valid (list_iterator->client_pipe)) {
ccs_client_t client = NULL;
err = ccs_server_client_for_pipe (list_iterator->client_pipe, &client);
-
+
if (!err && client) {
/* if client object still has a reference to us, remove it */
err = ccs_client_remove_iterator (client, list_iterator);
}
}
-
+
if (!err) {
ccs_pipe_release (list_iterator->client_pipe);
cci_identifier_release (list_iterator->identifier);
free (io_list_iterator);
}
-
- return err;
+
+ return err;
}
/* ------------------------------------------------------------------------ */
@@ -555,12 +555,12 @@ static cc_int32 ccs_list_iterator_object_release (cci_array_object_t io_list_ite
cc_int32 ccs_list_iterator_release (ccs_list_iterator_t io_list_iterator)
{
cc_int32 err = ccNoError;
-
+
if (!err && io_list_iterator) {
cc_uint64 i = 0;
-
- if (ccs_list_find_iterator_index (io_list_iterator->list,
- io_list_iterator->identifier,
+
+ if (ccs_list_find_iterator_index (io_list_iterator->list,
+ io_list_iterator->identifier,
&i) == ccNoError) {
/* cci_array_remove will call ccs_list_iterator_object_release */
err = cci_array_remove (io_list_iterator->list->iterators, i);
@@ -568,8 +568,8 @@ cc_int32 ccs_list_iterator_release (ccs_list_iterator_t io_list_iterator)
cci_debug_printf ("Warning: iterator not in iterator list!");
}
}
-
- return err;
+
+ return err;
}
/* ------------------------------------------------------------------------ */
@@ -578,20 +578,20 @@ cc_int32 ccs_list_iterator_invalidate (ccs_list_iterator_t io_list_iterator)
{
cc_int32 err = ccNoError;
ccs_list_iterator_t list_iterator = (ccs_list_iterator_t) io_list_iterator;
-
+
if (!io_list_iterator) { err = ccErrBadParam; }
-
+
if (!err) {
/* Client owner died. Remove client reference and then the iterator. */
- if (ccs_pipe_valid (list_iterator->client_pipe)) {
+ if (ccs_pipe_valid (list_iterator->client_pipe)) {
ccs_pipe_release (list_iterator->client_pipe);
list_iterator->client_pipe = CCS_PIPE_NULL;
}
-
+
err = ccs_list_iterator_release (io_list_iterator);
}
-
- return err;
+
+ return err;
}
/* ------------------------------------------------------------------------ */
@@ -600,20 +600,20 @@ cc_int32 ccs_list_iterator_current (ccs_list_iterator_t io_list_iterator,
ccs_list_object_t *out_object)
{
cc_int32 err = ccNoError;
-
+
if (!io_list_iterator) { err = cci_check_error (ccErrBadParam); }
if (!out_object ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
if (io_list_iterator->current < cci_array_count (io_list_iterator->list->objects)) {
- *out_object = cci_array_object_at_index (io_list_iterator->list->objects,
+ *out_object = cci_array_object_at_index (io_list_iterator->list->objects,
io_list_iterator->current);
} else {
err = ccIteratorEnd;
}
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -622,21 +622,21 @@ cc_int32 ccs_list_iterator_next (ccs_list_iterator_t io_list_iterator,
ccs_list_object_t *out_object)
{
cc_int32 err = ccNoError;
-
+
if (!io_list_iterator) { err = cci_check_error (ccErrBadParam); }
if (!out_object ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
if (io_list_iterator->current < cci_array_count (io_list_iterator->list->objects)) {
- *out_object = cci_array_object_at_index (io_list_iterator->list->objects,
+ *out_object = cci_array_object_at_index (io_list_iterator->list->objects,
io_list_iterator->current);
io_list_iterator->current++;
} else {
err = ccIteratorEnd;
}
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -646,9 +646,9 @@ static cc_int32 ccs_list_iterator_update (ccs_list_iterator_t io_list_iterator,
cc_uint64 in_object_index)
{
cc_int32 err = ccNoError;
-
+
if (!io_list_iterator) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
/* When the list changes adjust the current index so that */
/* we don't unnecessarily skip or double count items */
@@ -656,22 +656,21 @@ static cc_int32 ccs_list_iterator_update (ccs_list_iterator_t io_list_iterator,
if (io_list_iterator->current > in_object_index) {
io_list_iterator->current++;
}
-
+
} else if (in_action == ccs_list_action_remove) {
if (io_list_iterator->current >= in_object_index) {
io_list_iterator->current--;
}
-
+
} else if (in_action == ccs_list_action_push_front) {
if (io_list_iterator->current < in_object_index) {
io_list_iterator->current++;
}
-
+
} else {
err = cci_check_error (ccErrBadParam);
}
}
-
- return cci_check_error (err);
-}
+ return cci_check_error (err);
+}
diff --git a/src/ccapi/server/ccs_lock.c b/src/ccapi/server/ccs_lock.c
index 639bd17..23756b4 100644
--- a/src/ccapi/server/ccs_lock.c
+++ b/src/ccapi/server/ccs_lock.c
@@ -48,48 +48,48 @@ cc_int32 ccs_lock_new (ccs_lock_t *out_lock,
{
cc_int32 err = ccNoError;
ccs_lock_t lock = NULL;
-
+
if (!out_lock ) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); }
if (!in_lock_state_owner ) { err = cci_check_error (ccErrBadParam); }
-
- if (in_type != cc_lock_read &&
+
+ if (in_type != cc_lock_read &&
in_type != cc_lock_write &&
in_type != cc_lock_upgrade &&
- in_type != cc_lock_downgrade) {
- err = cci_check_error (ccErrBadLockType);
+ in_type != cc_lock_downgrade) {
+ err = cci_check_error (ccErrBadLockType);
}
-
+
if (!err) {
lock = malloc (sizeof (*lock));
- if (lock) {
+ if (lock) {
*lock = ccs_lock_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
lock->type = in_type;
lock->lock_state_owner = in_lock_state_owner;
- err = ccs_callback_new (&lock->callback,
- in_invalid_object_err,
- in_client_pipe,
+ err = ccs_callback_new (&lock->callback,
+ in_invalid_object_err,
+ in_client_pipe,
in_reply_pipe,
(ccs_callback_owner_t) lock,
ccs_lock_invalidate_callback);
}
-
+
if (!err) {
*out_lock = lock;
lock = NULL;
}
-
+
ccs_lock_release (lock);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -97,13 +97,13 @@ cc_int32 ccs_lock_new (ccs_lock_t *out_lock,
cc_int32 ccs_lock_release (ccs_lock_t io_lock)
{
cc_int32 err = ccNoError;
-
+
if (!err && io_lock) {
ccs_callback_release (io_lock->callback);
free (io_lock);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -112,17 +112,17 @@ static cc_int32 ccs_lock_invalidate_callback (ccs_callback_owner_t io_lock,
ccs_callback_t in_callback)
{
cc_int32 err = ccNoError;
-
+
if (!io_lock ) { err = cci_check_error (ccErrBadParam); }
if (!in_callback) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
ccs_lock_t lock = (ccs_lock_t) io_lock;
-
+
err = ccs_lock_state_invalidate_lock (lock->lock_state_owner, lock);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -130,14 +130,14 @@ static cc_int32 ccs_lock_invalidate_callback (ccs_callback_owner_t io_lock,
cc_int32 ccs_lock_grant_lock (ccs_lock_t io_lock)
{
cc_int32 err = ccNoError;
-
+
if (!io_lock) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_callback_reply_to_client (io_lock->callback, NULL);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -146,15 +146,15 @@ cc_uint32 ccs_lock_is_pending (ccs_lock_t in_lock,
cc_uint32 *out_pending)
{
cc_int32 err = ccNoError;
-
+
if (!in_lock ) { err = cci_check_error (ccErrBadParam); }
if (!out_pending) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_callback_is_pending (in_lock->callback, out_pending);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -163,15 +163,15 @@ cc_int32 ccs_lock_type (ccs_lock_t in_lock,
cc_uint32 *out_lock_type)
{
cc_int32 err = ccNoError;
-
+
if (!in_lock ) { err = cci_check_error (ccErrBadParam); }
if (!out_lock_type) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
*out_lock_type = in_lock->type;
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -180,16 +180,16 @@ cc_int32 ccs_lock_is_read_lock (ccs_lock_t in_lock,
cc_uint32 *out_is_read_lock)
{
cc_int32 err = ccNoError;
-
+
if (!in_lock ) { err = cci_check_error (ccErrBadParam); }
if (!out_is_read_lock) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- *out_is_read_lock = (in_lock->type == cc_lock_read ||
+ *out_is_read_lock = (in_lock->type == cc_lock_read ||
in_lock->type == cc_lock_downgrade);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -198,16 +198,16 @@ cc_int32 ccs_lock_is_write_lock (ccs_lock_t in_lock,
cc_uint32 *out_is_write_lock)
{
cc_int32 err = ccNoError;
-
+
if (!in_lock ) { err = cci_check_error (ccErrBadParam); }
if (!out_is_write_lock) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- *out_is_write_lock = (in_lock->type == cc_lock_write ||
+ *out_is_write_lock = (in_lock->type == cc_lock_write ||
in_lock->type == cc_lock_upgrade);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -217,17 +217,17 @@ cc_int32 ccs_lock_is_for_client_pipe (ccs_lock_t in_lock,
cc_uint32 *out_is_for_client_pipe)
{
cc_int32 err = ccNoError;
-
+
if (!in_lock ) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!out_is_for_client_pipe ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_callback_is_for_client_pipe (in_lock->callback, in_client_pipe,
+ err = ccs_callback_is_for_client_pipe (in_lock->callback, in_client_pipe,
out_is_for_client_pipe);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
@@ -237,13 +237,13 @@ cc_int32 ccs_lock_client_pipe (ccs_lock_t in_lock,
ccs_pipe_t *out_client_pipe)
{
cc_int32 err = ccNoError;
-
+
if (!in_lock ) { err = cci_check_error (ccErrBadParam); }
if (!out_client_pipe) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_callback_client_pipe (in_lock->callback, out_client_pipe);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
diff --git a/src/ccapi/server/ccs_lock_state.c b/src/ccapi/server/ccs_lock_state.c
index 516a1e2..94edcec 100644
--- a/src/ccapi/server/ccs_lock_state.c
+++ b/src/ccapi/server/ccs_lock_state.c
@@ -38,41 +38,41 @@ struct ccs_lock_state_d ccs_lock_state_initializer = { 1, 1, 1, NULL, 0 };
/* ------------------------------------------------------------------------ */
-cc_int32 ccs_lock_state_new (ccs_lock_state_t *out_lock_state,
- cc_int32 in_invalid_object_err,
- cc_int32 in_pending_lock_err,
+cc_int32 ccs_lock_state_new (ccs_lock_state_t *out_lock_state,
+ cc_int32 in_invalid_object_err,
+ cc_int32 in_pending_lock_err,
cc_int32 in_no_lock_err)
{
cc_int32 err = ccNoError;
ccs_lock_state_t lock_state = NULL;
-
+
if (!out_lock_state) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
lock_state = malloc (sizeof (*lock_state));
- if (lock_state) {
+ if (lock_state) {
*lock_state = ccs_lock_state_initializer;
} else {
- err = cci_check_error (ccErrNoMem);
+ err = cci_check_error (ccErrNoMem);
}
}
-
+
if (!err) {
err = ccs_lock_array_new (&lock_state->locks);
}
-
+
if (!err) {
lock_state->invalid_object_err = in_invalid_object_err;
lock_state->pending_lock_err = in_pending_lock_err;
lock_state->no_lock_err = in_no_lock_err;
-
+
*out_lock_state = lock_state;
lock_state = NULL;
}
-
+
ccs_lock_state_release (lock_state);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -80,13 +80,13 @@ cc_int32 ccs_lock_state_new (ccs_lock_state_t *out_lock_state,
cc_int32 ccs_lock_state_release (ccs_lock_state_t io_lock_state)
{
cc_int32 err = ccNoError;
-
+
if (!err && io_lock_state) {
ccs_lock_array_release (io_lock_state->locks);
free (io_lock_state);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -103,31 +103,31 @@ static cc_int32 ccs_lock_status_add_pending_lock (ccs_lock_state_t io_lock_stat
{
cc_int32 err = ccNoError;
ccs_lock_t lock = NULL;
-
+
if (!io_lock_state ) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- err = ccs_lock_new (&lock, in_lock_type,
+ err = ccs_lock_new (&lock, in_lock_type,
io_lock_state->invalid_object_err,
- in_client_pipe, in_reply_pipe,
+ in_client_pipe, in_reply_pipe,
io_lock_state);
}
-
+
if (!err) {
err = ccs_lock_array_insert (io_lock_state->locks, lock,
ccs_lock_array_count (io_lock_state->locks));
if (!err) { lock = NULL; /* take ownership */ }
}
-
+
if (!err) {
*out_lock_index = ccs_lock_array_count (io_lock_state->locks) - 1;
}
-
+
ccs_lock_release (lock);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -136,18 +136,18 @@ static cc_int32 ccs_lock_status_remove_lock (ccs_lock_state_t io_lock_state,
cc_uint64 in_lock_index)
{
cc_int32 err = ccNoError;
-
+
if (!io_lock_state) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_lock_array_remove (io_lock_state->locks, in_lock_index);
-
- if (!err && in_lock_index < io_lock_state->first_pending_lock_index) {
- io_lock_state->first_pending_lock_index--;
+
+ if (!err && in_lock_index < io_lock_state->first_pending_lock_index) {
+ io_lock_state->first_pending_lock_index--;
}
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -160,36 +160,36 @@ static cc_int32 ccs_lock_status_grant_lock (ccs_lock_state_t io_lock_state,
cc_uint32 type = 0;
if (!io_lock_state) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
- pending_lock = ccs_lock_array_object_at_index (io_lock_state->locks,
+ pending_lock = ccs_lock_array_object_at_index (io_lock_state->locks,
in_pending_lock_index);
if (!pending_lock || in_pending_lock_index < io_lock_state->first_pending_lock_index) {
err = cci_check_error (ccErrBadParam);
}
}
-
+
if (!err) {
err = ccs_lock_type (pending_lock, &type);
}
-
+
if (!err && (type == cc_lock_upgrade || type == cc_lock_downgrade)) {
/* lock upgrades or downgrades. Find the old lock and remove it. */
ccs_pipe_t pending_client_pipe = CCS_PIPE_NULL;
-
+
err = ccs_lock_client_pipe (pending_lock, &pending_client_pipe);
if (!err) {
cc_uint64 i;
-
+
for (i = 0; !err && i < io_lock_state->first_pending_lock_index; i++) {
ccs_lock_t lock = ccs_lock_array_object_at_index (io_lock_state->locks, i);
cc_uint32 is_lock_for_client = 0;
-
+
err = ccs_lock_is_for_client_pipe (lock, pending_client_pipe, &is_lock_for_client);
-
+
if (!err && is_lock_for_client) {
- cci_debug_printf ("%s: Removing old lock %p at index %d to replace with pending lock %p.",
+ cci_debug_printf ("%s: Removing old lock %p at index %d to replace with pending lock %p.",
__FUNCTION__, lock, (int) i, pending_lock);
err = ccs_lock_status_remove_lock (io_lock_state, i);
if (!err) { i--; in_pending_lock_index--; /* We removed one so back up an index */ }
@@ -198,22 +198,22 @@ static cc_int32 ccs_lock_status_grant_lock (ccs_lock_state_t io_lock_state,
}
}
}
-
- if (!err) {
+
+ if (!err) {
cc_uint64 new_lock_index = 0;
- err = ccs_lock_array_move (io_lock_state->locks,
- in_pending_lock_index,
+ err = ccs_lock_array_move (io_lock_state->locks,
+ in_pending_lock_index,
io_lock_state->first_pending_lock_index,
&new_lock_index);
if (!err) { io_lock_state->first_pending_lock_index++; }
}
-
+
if (!err) {
err = ccs_lock_grant_lock (pending_lock);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -234,35 +234,35 @@ static cc_int32 ccs_lock_state_check_pending_lock (ccs_lock_state_t io_lock_sta
cc_uint32 client_lock_type = 0;
cc_uint64 client_lock_index = 0;
cc_uint32 grant_lock = 0;
-
+
if (!io_lock_state ) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_pending_lock_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!out_grant_lock ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
cc_uint64 i;
cc_uint64 lock_count = io_lock_state->first_pending_lock_index;
-
+
for (i = 0; !err && i < lock_count; i++) {
ccs_lock_t lock = ccs_lock_array_object_at_index (io_lock_state->locks, i);
cc_uint32 lock_type = 0;
cc_uint32 lock_is_for_client = 0;
-
+
err = ccs_lock_type (lock, &lock_type);
-
+
if (!err) {
- err = ccs_lock_is_for_client_pipe (lock, in_pending_lock_client_pipe,
+ err = ccs_lock_is_for_client_pipe (lock, in_pending_lock_client_pipe,
&lock_is_for_client);
}
-
+
if (!err) {
if (lock_type == cc_lock_write || lock_type == cc_lock_upgrade) {
is_write_locked = 1;
}
-
+
if (!lock_is_for_client) {
other_clients_have_locks = 1;
-
+
} else if (!client_has_lock) { /* only record type of 1st lock */
client_has_lock = 1;
client_lock_type = lock_type;
@@ -271,35 +271,35 @@ static cc_int32 ccs_lock_state_check_pending_lock (ccs_lock_state_t io_lock_sta
}
}
}
-
+
if (!err) {
cc_uint64 lock_count = io_lock_state->first_pending_lock_index;
-
+
if (in_pending_lock_type == cc_lock_write) {
if (client_has_lock) {
err = cci_check_error (ccErrBadLockType);
} else {
grant_lock = (lock_count == 0);
}
-
+
} else if (in_pending_lock_type == cc_lock_read) {
if (client_has_lock) {
err = cci_check_error (ccErrBadLockType);
} else {
grant_lock = !is_write_locked;
}
-
+
} else if (in_pending_lock_type == cc_lock_upgrade) {
- if (!client_has_lock || (client_lock_type != cc_lock_read &&
+ if (!client_has_lock || (client_lock_type != cc_lock_read &&
client_lock_type != cc_lock_downgrade)) {
err = cci_check_error (ccErrBadLockType);
} else {
/* don't grant if other clients have read locks */
- grant_lock = !other_clients_have_locks;
+ grant_lock = !other_clients_have_locks;
}
-
+
} else if (in_pending_lock_type == cc_lock_downgrade) {
- if (!client_has_lock || (client_lock_type != cc_lock_write &&
+ if (!client_has_lock || (client_lock_type != cc_lock_write &&
client_lock_type != cc_lock_upgrade)) {
err = cci_check_error (ccErrBadLockType);
} else {
@@ -310,62 +310,62 @@ static cc_int32 ccs_lock_state_check_pending_lock (ccs_lock_state_t io_lock_sta
err = cci_check_error (ccErrBadLockType);
}
}
-
+
if (!err) {
*out_grant_lock = grant_lock;
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
-static cc_int32 ccs_lock_status_try_to_grant_pending_locks (ccs_lock_state_t io_lock_state)
+static cc_int32 ccs_lock_status_try_to_grant_pending_locks (ccs_lock_state_t io_lock_state)
{
cc_int32 err = ccNoError;
cc_uint32 done = 0;
-
+
if (!io_lock_state) { err = cci_check_error (ccErrBadParam); }
-
- /* Look at the pending locks and see if we can grant them.
+
+ /* Look at the pending locks and see if we can grant them.
* Note that downgrade locks mean we must check all pending locks each pass
* since a downgrade lock might be last in the list. */
-
+
while (!err && !done) {
cc_uint64 i;
cc_uint64 count = ccs_lock_array_count (io_lock_state->locks);
cc_uint32 granted_lock = 0;
-
+
for (i = io_lock_state->first_pending_lock_index; !err && i < count; i++) {
ccs_lock_t lock = ccs_lock_array_object_at_index (io_lock_state->locks, i);
cc_uint32 lock_type = 0;
ccs_pipe_t client_pipe = CCS_PIPE_NULL;
cc_uint32 can_grant_lock_now = 0;
-
+
err = ccs_lock_client_pipe (lock, &client_pipe);
-
+
if (!err) {
err = ccs_lock_type (lock, &lock_type);
}
-
+
if (!err) {
err = ccs_lock_state_check_pending_lock (io_lock_state, client_pipe,
lock_type, &can_grant_lock_now);
}
-
+
if (!err && can_grant_lock_now) {
err = ccs_lock_status_grant_lock (io_lock_state, i);
if (!err) { granted_lock = 1; }
}
}
-
+
if (!err && !granted_lock) {
/* we walked over all the locks and couldn't grant any of them */
done = 1;
}
- }
-
- return cci_check_error (err);
+ }
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -383,54 +383,54 @@ cc_int32 ccs_lock_state_add (ccs_lock_state_t io_lock_state,
{
cc_int32 err = ccNoError;
cc_uint32 can_grant_lock_now = 0;
-
+
if (!io_lock_state ) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); }
if (!out_will_send_reply ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
/* Sanity check: if there are any pending locks for this client
* the client must have timed out waiting for our reply. Remove any
* existing pending locks for the client. */
cc_uint64 i;
-
+
for (i = io_lock_state->first_pending_lock_index; !err && i < ccs_lock_array_count (io_lock_state->locks); i++) {
ccs_lock_t lock = ccs_lock_array_object_at_index (io_lock_state->locks, i);
cc_uint32 has_pending_lock_for_client = 0;
-
+
err = ccs_lock_is_for_client_pipe (lock, in_client_pipe, &has_pending_lock_for_client);
-
+
if (!err && has_pending_lock_for_client) {
- cci_debug_printf ("WARNING %s: Removing unexpected pending lock %p at index %d.",
+ cci_debug_printf ("WARNING %s: Removing unexpected pending lock %p at index %d.",
__FUNCTION__, lock, (int) i);
err = ccs_lock_status_remove_lock (io_lock_state, i);
if (!err) { i--; /* We removed one so back up an index */ }
}
}
}
-
+
if (!err) {
err = ccs_lock_state_check_pending_lock (io_lock_state, in_client_pipe,
in_lock_type, &can_grant_lock_now);
}
-
+
if (!err) {
if (!can_grant_lock_now && (in_block == cc_lock_noblock)) {
err = cci_check_error (io_lock_state->pending_lock_err);
-
+
} else {
cc_uint64 new_lock_index = 0;
-
+
err = ccs_lock_status_add_pending_lock (io_lock_state,
in_client_pipe,
in_reply_pipe,
in_lock_type,
&new_lock_index);
-
+
if (!err && can_grant_lock_now) {
err = ccs_lock_status_grant_lock (io_lock_state, new_lock_index);
-
+
if (!err && (in_lock_type == cc_lock_downgrade)) {
/* downgrades can allow us to grant other locks */
err = ccs_lock_status_try_to_grant_pending_locks (io_lock_state);
@@ -438,13 +438,13 @@ cc_int32 ccs_lock_state_add (ccs_lock_state_t io_lock_state,
}
}
}
-
+
if (!err) {
/* ccs_lock_state_add sends its replies via callback so caller shouldn't */
*out_will_send_reply = 1;
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -454,45 +454,45 @@ cc_int32 ccs_lock_state_remove (ccs_lock_state_t io_lock_state,
{
cc_int32 err = ccNoError;
cc_uint32 found_lock = 0;
-
+
if (!io_lock_state ) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
cc_uint64 i;
-
- /* Remove all locks for this client.
+
+ /* Remove all locks for this client.
* There should only be one so warn if there are multiple */
for (i = 0; !err && i < io_lock_state->first_pending_lock_index; i++) {
ccs_lock_t lock = ccs_lock_array_object_at_index (io_lock_state->locks, i);
cc_uint32 is_for_client = 0;
-
+
err = ccs_lock_is_for_client_pipe (lock, in_client_pipe, &is_for_client);
-
+
if (!err && is_for_client) {
if (found_lock) {
- cci_debug_printf ("WARNING %s: Found multiple locks for client.",
+ cci_debug_printf ("WARNING %s: Found multiple locks for client.",
__FUNCTION__);
}
-
+
found_lock = 1;
-
+
cci_debug_printf ("%s: Removing lock %p at index %d.", __FUNCTION__, lock, (int) i);
err = ccs_lock_status_remove_lock (io_lock_state, i);
if (!err) { i--; /* We removed one so back up an index */ }
}
}
}
-
+
if (!err && !found_lock) {
err = cci_check_error (io_lock_state->no_lock_err);
}
-
+
if (!err) {
err = ccs_lock_status_try_to_grant_pending_locks (io_lock_state);
- }
-
- return cci_check_error (err);
+ }
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -501,26 +501,26 @@ cc_int32 ccs_lock_state_invalidate_lock (ccs_lock_state_t io_lock_state,
ccs_lock_t in_lock)
{
cc_int32 err = ccNoError;
-
+
if (!io_lock_state) { err = ccErrBadParam; }
-
+
if (!err) {
cc_uint64 i;
cc_uint64 count = ccs_lock_array_count (io_lock_state->locks);
-
+
for (i = 0; !err && i < count; i++) {
ccs_lock_t lock = ccs_lock_array_object_at_index (io_lock_state->locks, i);
-
+
if (lock == in_lock) {
err = ccs_lock_status_remove_lock (io_lock_state, i);
-
+
if (!err) {
err = ccs_lock_status_try_to_grant_pending_locks (io_lock_state);
break;
- }
+ }
}
}
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
diff --git a/src/ccapi/server/ccs_lock_state.h b/src/ccapi/server/ccs_lock_state.h
index c6b9bdb..aa0c23a 100644
--- a/src/ccapi/server/ccs_lock_state.h
+++ b/src/ccapi/server/ccs_lock_state.h
@@ -29,9 +29,9 @@
#include "ccs_types.h"
-cc_int32 ccs_lock_state_new (ccs_lock_state_t *out_lock_state,
- cc_int32 in_invalid_object_err,
- cc_int32 in_pending_lock_err,
+cc_int32 ccs_lock_state_new (ccs_lock_state_t *out_lock_state,
+ cc_int32 in_invalid_object_err,
+ cc_int32 in_pending_lock_err,
cc_int32 in_no_lock_err);
cc_int32 ccs_lock_state_release (ccs_lock_state_t io_lock_state);
diff --git a/src/ccapi/server/ccs_pipe.c b/src/ccapi/server/ccs_pipe.c
index 0a65a0a..41ec60c 100644
--- a/src/ccapi/server/ccs_pipe.c
+++ b/src/ccapi/server/ccs_pipe.c
@@ -40,7 +40,7 @@ cc_int32 ccs_pipe_compare (ccs_pipe_t in_pipe,
ccs_pipe_t in_compare_to_pipe,
cc_uint32 *out_equal)
{
- return ccs_os_pipe_compare (in_pipe, in_compare_to_pipe, out_equal);
+ return ccs_os_pipe_compare (in_pipe, in_compare_to_pipe, out_equal);
}
/* ------------------------------------------------------------------------ */
diff --git a/src/ccapi/server/ccs_server.c b/src/ccapi/server/ccs_server.c
index 30476e4..4698341 100644
--- a/src/ccapi/server/ccs_server.c
+++ b/src/ccapi/server/ccs_server.c
@@ -38,35 +38,35 @@ ccs_client_array_t g_client_array = NULL;
int main (int argc, const char *argv[])
{
cc_int32 err = 0;
-
+
if (!err) {
err = ccs_os_server_initialize (argc, argv);
}
-
+
if (!err) {
err = cci_identifier_new_uuid (&g_server_id);
}
-
+
if (!err) {
err = ccs_cache_collection_new (&g_cache_collection);
}
-
+
if (!err) {
err = ccs_client_array_new (&g_client_array);
}
-
+
if (!err) {
err = ccs_os_server_listen_loop (argc, argv);
}
-
+
if (!err) {
free (g_server_id);
cci_check_error (ccs_cache_collection_release (g_cache_collection));
cci_check_error (ccs_client_array_release (g_client_array));
-
+
err = ccs_os_server_cleanup (argc, argv);
}
-
+
return cci_check_error (err) ? 1 : 0;
}
@@ -92,19 +92,19 @@ cc_int32 ccs_server_add_client (ccs_pipe_t in_connection_pipe)
{
cc_int32 err = ccNoError;
ccs_client_t client = NULL;
-
+
if (!err) {
err = ccs_client_new (&client, in_connection_pipe);
}
-
+
if (!err) {
cci_debug_printf ("%s: Adding client %p.", __FUNCTION__, client);
- err = ccs_client_array_insert (g_client_array,
+ err = ccs_client_array_insert (g_client_array,
client,
ccs_client_array_count (g_client_array));
}
- return cci_check_error (err);
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -117,26 +117,26 @@ cc_int32 ccs_server_remove_client (ccs_pipe_t in_connection_pipe)
cc_uint64 i;
cc_uint64 count = ccs_client_array_count (g_client_array);
cc_uint32 found = 0;
-
+
for (i = 0; !err && i < count; i++) {
ccs_client_t client = ccs_client_array_object_at_index (g_client_array, i);
-
+
err = ccs_client_uses_pipe (client, in_connection_pipe, &found);
-
+
if (!err && found) {
cci_debug_printf ("%s: Removing client %p.", __FUNCTION__, client);
err = ccs_client_array_remove (g_client_array, i);
break;
}
}
-
+
if (!err && !found) {
- cci_debug_printf ("WARNING %s() didn't find client in client list.",
+ cci_debug_printf ("WARNING %s() didn't find client in client list.",
__FUNCTION__);
- }
+ }
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -146,32 +146,32 @@ cc_int32 ccs_server_client_for_pipe (ccs_pipe_t in_client_pipe,
{
cc_int32 err = ccNoError;
ccs_client_t client_for_pipe = NULL;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!out_client ) { err = cci_check_error (ccErrBadParam); }
if (!err) {
cc_uint64 i;
cc_uint64 count = ccs_client_array_count (g_client_array);
-
+
for (i = 0; !err && i < count; i++) {
ccs_client_t client = ccs_client_array_object_at_index (g_client_array, i);
cc_uint32 uses_pipe = 0;
-
+
err = ccs_client_uses_pipe (client, in_client_pipe, &uses_pipe);
-
+
if (!err && uses_pipe) {
client_for_pipe = client;
break;
}
}
}
-
+
if (!err) {
*out_client = client_for_pipe; /* may be NULL if not found */
}
- return cci_check_error (err);
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -181,19 +181,19 @@ cc_int32 ccs_server_client_is_valid (ccs_pipe_t in_client_pipe,
{
cc_int32 err = ccNoError;
ccs_client_t client = NULL;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!out_client_is_valid ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = ccs_server_client_for_pipe (in_client_pipe, &client);
}
-
+
if (!err) {
*out_client_is_valid = (client != NULL);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
#ifdef TARGET_OS_MAC
@@ -221,9 +221,9 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe
if (!err) {
if (in_request_name > cci_context_first_msg_id &&
in_request_name < cci_context_last_msg_id) {
- /* Note: context identifier doesn't need to match.
+ /* Note: context identifier doesn't need to match.
* Client just uses the identifier to detect server relaunch. */
-
+
if (!err) {
err = ccs_cache_collection_handle_message (in_client_pipe,
in_reply_pipe,
@@ -233,15 +233,15 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe
out_will_block,
out_reply_data);
}
-
+
} else if (in_request_name > cci_ccache_first_msg_id &&
in_request_name < cci_ccache_last_msg_id) {
ccs_ccache_t ccache = NULL;
-
+
err = ccs_cache_collection_find_ccache (in_cache_collection,
in_request_identifier,
- &ccache);
-
+ &ccache);
+
if (!err) {
err = ccs_ccache_handle_message (in_client_pipe,
in_reply_pipe,
@@ -251,16 +251,16 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe
in_request_data,
out_will_block,
out_reply_data);
- }
-
+ }
+
} else if (in_request_name > cci_ccache_iterator_first_msg_id &&
in_request_name < cci_ccache_iterator_last_msg_id) {
ccs_ccache_iterator_t ccache_iterator = NULL;
-
+
err = ccs_cache_collection_find_ccache_iterator (in_cache_collection,
in_request_identifier,
- &ccache_iterator);
-
+ &ccache_iterator);
+
if (!err) {
err = ccs_ccache_iterator_handle_message (ccache_iterator,
in_cache_collection,
@@ -268,21 +268,21 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe
in_request_data,
out_reply_data);
}
-
+
if (!err) {
*out_will_block = 0; /* can't block */
}
-
+
} else if (in_request_name > cci_credentials_iterator_first_msg_id &&
in_request_name < cci_credentials_iterator_last_msg_id) {
ccs_credentials_iterator_t credentials_iterator = NULL;
ccs_ccache_t ccache = NULL;
-
+
err = ccs_cache_collection_find_credentials_iterator (in_cache_collection,
in_request_identifier,
&ccache,
- &credentials_iterator);
-
+ &credentials_iterator);
+
if (!err) {
err = ccs_credentials_iterator_handle_message (credentials_iterator,
ccache,
@@ -290,16 +290,16 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe
in_request_data,
out_reply_data);
}
-
+
if (!err) {
*out_will_block = 0; /* can't block */
}
-
+
} else {
err = ccErrBadInternalMessage;
}
}
-
+
return cci_check_error (err);
}
@@ -318,46 +318,46 @@ cc_int32 ccs_server_handle_request (ccs_pipe_t in_client_pipe,
cci_identifier_t request_identifier = NULL;
cc_uint32 will_block = 0;
k5_ipc_stream reply_data = NULL;
-
+
if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); }
if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); }
if (!in_request ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_message_read_request_header (in_request,
&request_name,
&request_identifier);
}
-
+
if (!err) {
cc_uint32 server_err = 0;
cc_uint32 valid = 0;
ccs_cache_collection_t cache_collection = g_cache_collection;
-
- server_err = cci_identifier_is_for_server (request_identifier,
- g_server_id,
+
+ server_err = cci_identifier_is_for_server (request_identifier,
+ g_server_id,
&valid);
-
+
if (!server_err && !valid) {
server_err = cci_message_invalid_object_err (request_name);
}
-
+
if (!server_err) {
-
- /* Monolithic server implementation would need to select
+
+ /* Monolithic server implementation would need to select
* cache collection here. Currently we only support per-user
* servers so we always use the same cache collection. */
-
+
server_err = ccs_server_request_demux (in_client_pipe,
in_reply_pipe,
cache_collection,
request_name,
request_identifier,
- in_request,
+ in_request,
&will_block,
&reply_data);
}
-
+
if (server_err || !will_block) {
/* send a reply now if the server isn't blocked on something */
@@ -367,8 +367,8 @@ cc_int32 ccs_server_handle_request (ccs_pipe_t in_client_pipe,
cci_identifier_release (request_identifier);
krb5int_ipc_stream_release (reply_data);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -379,24 +379,24 @@ cc_int32 ccs_server_send_reply (ccs_pipe_t in_reply_pipe,
{
cc_int32 err = ccNoError;
k5_ipc_stream reply = NULL;
-
+
if (!ccs_pipe_valid (in_reply_pipe) ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
err = cci_message_new_reply_header (&reply, in_reply_err);
}
-
+
if (!err && in_reply_data && krb5int_ipc_stream_size (in_reply_data) > 0) {
- err = krb5int_ipc_stream_write (reply,
- krb5int_ipc_stream_data (in_reply_data),
+ err = krb5int_ipc_stream_write (reply,
+ krb5int_ipc_stream_data (in_reply_data),
krb5int_ipc_stream_size (in_reply_data));
}
-
+
if (!err) {
err = ccs_os_server_send_reply (in_reply_pipe, reply);
}
-
+
krb5int_ipc_stream_release (reply);
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
diff --git a/src/ccapi/server/mac/ccs_os_notify.c b/src/ccapi/server/mac/ccs_os_notify.c
index 9202823..84501fb 100644
--- a/src/ccapi/server/mac/ccs_os_notify.c
+++ b/src/ccapi/server/mac/ccs_os_notify.c
@@ -33,22 +33,22 @@
cc_int32 ccs_os_notify_cache_collection_changed (ccs_cache_collection_t io_cache_collection)
{
cc_int32 err = ccNoError;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter ();
- if (center) {
+ if (center) {
CFNotificationCenterPostNotification (center,
kCCAPICacheCollectionChangedNotification,
NULL, NULL, TRUE);
}
}
-
-
-
- return cci_check_error (err);
+
+
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -57,24 +57,24 @@ cc_int32 ccs_os_notify_ccache_changed (ccs_cache_collection_t io_cache_collecti
const char *in_ccache_name)
{
cc_int32 err = ccNoError;
-
+
if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
if (!in_ccache_name ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter ();
CFStringRef name = CFStringCreateWithCString (kCFAllocatorDefault,
in_ccache_name,
kCFStringEncodingUTF8);
-
- if (center && name) {
+
+ if (center && name) {
CFNotificationCenterPostNotification (center,
kCCAPICCacheChangedNotification,
name, NULL, TRUE);
}
-
+
if (name) { CFRelease (name); }
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
diff --git a/src/ccapi/server/mac/ccs_os_pipe.c b/src/ccapi/server/mac/ccs_os_pipe.c
index 9122767..0462a64 100644
--- a/src/ccapi/server/mac/ccs_os_pipe.c
+++ b/src/ccapi/server/mac/ccs_os_pipe.c
@@ -44,16 +44,16 @@ cc_int32 ccs_os_pipe_compare (ccs_pipe_t in_pipe,
cc_uint32 *out_equal)
{
cc_int32 err = ccNoError;
-
+
if (!in_pipe ) { err = cci_check_error (ccErrBadParam); }
if (!in_compare_to_pipe) { err = cci_check_error (ccErrBadParam); }
if (!out_equal ) { err = cci_check_error (ccErrBadParam); }
-
+
if (!err) {
*out_equal = (in_pipe == in_compare_to_pipe);
}
-
- return cci_check_error (err);
+
+ return cci_check_error (err);
}
/* ------------------------------------------------------------------------ */
@@ -62,9 +62,9 @@ cc_int32 ccs_os_pipe_copy (ccs_pipe_t *out_pipe,
ccs_pipe_t in_pipe)
{
cc_int32 err = 0;
-
+
*out_pipe = in_pipe;
-
+
return cci_check_error (err);
}
@@ -73,9 +73,8 @@ cc_int32 ccs_os_pipe_copy (ccs_pipe_t *out_pipe,
cc_int32 ccs_os_pipe_release (ccs_pipe_t io_pipe)
{
cc_int32 err = 0;
-
+
/* Nothing to do here on Mac OS X */
-
+
return cci_check_error (err);
}
-
diff --git a/src/ccapi/server/mac/ccs_os_server.c b/src/ccapi/server/mac/ccs_os_server.c
index 98bc6b3..276c1ad 100644
--- a/src/ccapi/server/mac/ccs_os_server.c
+++ b/src/ccapi/server/mac/ccs_os_server.c
@@ -51,8 +51,8 @@ kern_return_t k5_ipc_server_handle_request (mach_port_t in_connection_port,
mach_port_t in_reply_port,
k5_ipc_stream in_request_stream)
{
- return cci_check_error (ccs_server_handle_request (in_connection_port,
- in_reply_port,
+ return cci_check_error (ccs_server_handle_request (in_connection_port,
+ in_reply_port,
in_request_stream));
}
@@ -63,10 +63,10 @@ kern_return_t k5_ipc_server_handle_request (mach_port_t in_connection_port,
cc_int32 ccs_os_server_initialize (int argc, const char *argv[])
{
cc_int32 err = 0;
-
+
openlog (argv[0], LOG_CONS | LOG_PID, LOG_AUTH);
- syslog (LOG_INFO, "Starting up.");
-
+ syslog (LOG_INFO, "Starting up.");
+
return cci_check_error (err);
}
@@ -75,9 +75,9 @@ cc_int32 ccs_os_server_initialize (int argc, const char *argv[])
cc_int32 ccs_os_server_cleanup (int argc, const char *argv[])
{
cc_int32 err = 0;
-
+
syslog (LOG_NOTICE, "Exiting.");
-
+
return cci_check_error (err);
}
@@ -93,6 +93,6 @@ cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[])
cc_int32 ccs_os_server_send_reply (ccs_pipe_t in_reply_pipe,
k5_ipc_stream in_reply_stream)
{
- return cci_check_error (k5_ipc_server_send_reply (in_reply_pipe,
+ return cci_check_error (k5_ipc_server_send_reply (in_reply_pipe,
in_reply_stream));
}
diff --git a/src/ccapi/server/win/ccs_os_pipe.c b/src/ccapi/server/win/ccs_os_pipe.c
index 95af378..4573fa5 100644
--- a/src/ccapi/server/win/ccs_os_pipe.c
+++ b/src/ccapi/server/win/ccs_os_pipe.c
@@ -31,7 +31,7 @@
/* ------------------------------------------------------------------------ */
/* On Windows, a pipe is a struct. See ccs_win_pipe.h for details. */
-
+
/* ------------------------------------------------------------------------ */
@@ -43,7 +43,7 @@ cc_int32 ccs_os_pipe_valid (ccs_pipe_t in_pipe) {
cc_int32 ccs_os_pipe_copy (ccs_pipe_t* out_pipe, ccs_pipe_t in_pipe) {
return ccs_win_pipe_copy(
- out_pipe,
+ out_pipe,
in_pipe);
}
@@ -61,4 +61,3 @@ cc_int32 ccs_os_pipe_compare (ccs_pipe_t pipe_1,
return ccs_win_pipe_compare(pipe_1, pipe_2, out_equal);
}
-
diff --git a/src/ccapi/server/win/ccs_request_proc.c b/src/ccapi/server/win/ccs_request_proc.c
index 8421b72..00a8f03 100644
--- a/src/ccapi/server/win/ccs_request_proc.c
+++ b/src/ccapi/server/win/ccs_request_proc.c
@@ -50,8 +50,8 @@ void ccs_rpc_request(
cci_debug_printf("%s rpcmsg:%d; UUID:<%s> SST:<%s>", __FUNCTION__, rpcmsg, pszUUID, serverStartTime);
#endif
status = (rpcmsg != CCMSG_REQUEST) && (rpcmsg != CCMSG_PING);
-
- if (!status) {
+
+ if (!status) {
status = krb5int_ipc_stream_new (&stream); /* Create a stream for the request data */
}
@@ -59,7 +59,7 @@ void ccs_rpc_request(
status = krb5int_ipc_stream_write (stream, pbRequest, lenRequest);
}
- pipe = ccs_win_pipe_new(pszUUID, *p);
+ pipe = ccs_win_pipe_new(pszUUID, *p);
worklist_add(rpcmsg, pipe, stream, serverStartTime);
*return_status = status;
}
@@ -76,7 +76,7 @@ void ccs_rpc_connect(
#if 0
cci_debug_printf("%s; rpcmsg:%d; UUID: <%s>", __FUNCTION__, rpcmsg, pszUUID);
#endif
- worklist_add( rpcmsg,
+ worklist_add( rpcmsg,
pipe,
NULL, /* No payload with connect request */
(const time_t)0 ); /* No server session number with connect request */
diff --git a/src/ccapi/server/win/ccs_win_pipe.c b/src/ccapi/server/win/ccs_win_pipe.c
index 4ef807d..243f8f2 100644
--- a/src/ccapi/server/win/ccs_win_pipe.c
+++ b/src/ccapi/server/win/ccs_win_pipe.c
@@ -55,7 +55,7 @@ struct ccs_win_pipe_t* ccs_win_pipe_new (const char* uuid, const HANDLE h) {
if (!uuidCopy) {err = cci_check_error(ccErrBadParam);}
strcpy(uuidCopy, uuid);
}
-
+
if (!err) {
out_pipe = (struct ccs_win_pipe_t*)malloc(sizeof(struct ccs_win_pipe_t));
if (!out_pipe) {err = cci_check_error(ccErrBadParam);}
@@ -70,10 +70,10 @@ struct ccs_win_pipe_t* ccs_win_pipe_new (const char* uuid, const HANDLE h) {
/* ------------------------------------------------------------------------ */
-cc_int32 ccs_win_pipe_copy (WIN_PIPE** out_pipe,
+cc_int32 ccs_win_pipe_copy (WIN_PIPE** out_pipe,
const WIN_PIPE* in_pipe) {
- *out_pipe =
+ *out_pipe =
ccs_win_pipe_new(
ccs_win_pipe_getUuid (in_pipe),
ccs_win_pipe_getHandle(in_pipe) );
diff --git a/src/ccapi/server/win/ccs_win_pipe.h b/src/ccapi/server/win/ccs_win_pipe.h
index 3600d12..c489aaf 100644
--- a/src/ccapi/server/win/ccs_win_pipe.h
+++ b/src/ccapi/server/win/ccs_win_pipe.h
@@ -33,16 +33,16 @@
/* ------------------------------------------------------------------------ */
-/* On Windows, a pipe is a struct containing a UUID and a handle. Both the
- UUID and handle are supplied by the client.
-
- The UUID is used to build the client's reply endpoint.
-
+/* On Windows, a pipe is a struct containing a UUID and a handle. Both the
+ UUID and handle are supplied by the client.
+
+ The UUID is used to build the client's reply endpoint.
+
The handle is to the requesting client thread's thread local storage struct,
so that the client's one and only reply handler can put reply data where
the requesting thread will be able to see it.
*/
-
+
struct ccs_win_pipe_t {
char* uuid;
HANDLE clientHandle;
@@ -58,7 +58,7 @@ cc_int32 ccs_win_pipe_compare (const WIN_PIPE* win_pipe_1,
const WIN_PIPE* win_pipe_2,
cc_uint32 *out_equal);
-cc_int32 ccs_win_pipe_copy (WIN_PIPE** out_pipe,
+cc_int32 ccs_win_pipe_copy (WIN_PIPE** out_pipe,
const WIN_PIPE* in_pipe);
cc_int32 ccs_win_pipe_valid (const WIN_PIPE* in_pipe);
@@ -66,4 +66,4 @@ cc_int32 ccs_win_pipe_valid (const WIN_PIPE* in_pipe);
char* ccs_win_pipe_getUuid (const WIN_PIPE* in_pipe);
HANDLE ccs_win_pipe_getHandle (const WIN_PIPE* in_pipe);
-#endif // _ccs_win_pipe_h_ \ No newline at end of file
+#endif // _ccs_win_pipe_h_
diff --git a/src/ccapi/server/win/workitem.h b/src/ccapi/server/win/workitem.h
index 9829f85..1d3df15 100644
--- a/src/ccapi/server/win/workitem.h
+++ b/src/ccapi/server/win/workitem.h
@@ -15,9 +15,9 @@ private:
const long _rpcmsg;
const long _sst;
public:
- WorkItem( k5_ipc_stream buf,
- WIN_PIPE* pipe,
- const long type,
+ WorkItem( k5_ipc_stream buf,
+ WIN_PIPE* pipe,
+ const long type,
const long serverStartTime);
WorkItem( const WorkItem&);
WorkItem();
diff --git a/src/ccapi/test/main.c b/src/ccapi/test/main.c
index d486010..2ace967 100644
--- a/src/ccapi/test/main.c
+++ b/src/ccapi/test/main.c
@@ -11,16 +11,16 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
// cc_ccache_iterator_t cache_iterator = NULL;
// cc_credentials_iterator_t cred_iterator = NULL;
-
+
fprintf(stdout, "Testing CCAPI against CCAPI v3 rev 8 documentation...\n");
fprintf(stdout, "Warning: this test suite is woefully incomplete and unpolished.\n");
-
+
T_CCAPI_INIT;
-
+
// *** ccapi v2 compat ***
err = check_cc_shutdown();
err = check_cc_get_change_time();
@@ -39,9 +39,9 @@ int main (int argc, const char * argv[]) {
err = check_cc_seq_fetch_creds_begin();
err = check_cc_seq_fetch_creds_next();
err = check_cc_get_NC_info();
-
+
err = check_constants();
-
+
// *** cc_context ***
err = check_cc_initialize();
err = check_cc_context_release();
@@ -56,7 +56,7 @@ int main (int argc, const char * argv[]) {
// err = check_cc_context_lock();
// err = check_cc_context_unlock();
err = check_cc_context_compare();
-
+
// *** cc_ccache ***
err = check_cc_ccache_release();
err = check_cc_ccache_destroy();
@@ -77,14 +77,14 @@ int main (int argc, const char * argv[]) {
err = check_cc_ccache_get_kdc_time_offset();
err = check_cc_ccache_set_kdc_time_offset();
err = check_cc_ccache_clear_kdc_time_offset();
-
+
// *** cc_ccache_iterator ***
err = check_cc_ccache_iterator_next();
-
+
// *** cc_credentials_iterator ***
err = check_cc_credentials_iterator_next();
-
+
fprintf(stdout, "\nFinished testing CCAPI. %d failure%s in total.\n", total_failure_count, (total_failure_count == 1) ? "" : "s");
-
+
return err;
}
diff --git a/src/ccapi/test/pingtest.c b/src/ccapi/test/pingtest.c
index 637f8ab..d64db2e 100644
--- a/src/ccapi/test/pingtest.c
+++ b/src/ccapi/test/pingtest.c
@@ -30,9 +30,9 @@ RPC_STATUS send_test(char* endpoint) {
unsigned char* pszNetworkAddress = NULL;
unsigned char* pszOptions = NULL;
unsigned char* pszStringBinding = NULL;
- unsigned char* pszUuid = NULL;
+ unsigned char* pszUuid = NULL;
RPC_STATUS status;
-
+
status = RpcStringBindingCompose(pszUuid,
(RPC_CSTR)"ncalrpc",
pszNetworkAddress,
@@ -73,7 +73,7 @@ int main( int argc, char *argv[]) {
char* message = "Hello, RPC!";
- if ((dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE;
+ if ((dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE;
// send_test("krbcc.229026.0.ep");
@@ -90,14 +90,14 @@ int main( int argc, char *argv[]) {
}
if (!err) {
- err = cci_os_ipc_msg(TRUE, send_stream, CCMSG_PING, &reply_stream);
+ err = cci_os_ipc_msg(TRUE, send_stream, CCMSG_PING, &reply_stream);
}
Sleep(10*1000);
cci_debug_printf("Try finishing async call.");
Sleep(INFINITE);
cci_debug_printf("main: return. err == %d", err);
-
+
return 0;
}
diff --git a/src/ccapi/test/simple_lock_test.c b/src/ccapi/test/simple_lock_test.c
index 418d56a..8961d99 100644
--- a/src/ccapi/test/simple_lock_test.c
+++ b/src/ccapi/test/simple_lock_test.c
@@ -1,6 +1,6 @@
/*
simple_lock_test.c
-
+
Initializes two contexts in two different threads and tries to get read locks on both at the same time.
Hangs at line 24.
*/
@@ -25,7 +25,7 @@
void *other_thread (void) {
cc_int32 err;
cc_context_t context = NULL;
-
+
err = cc_initialize(&context, ccapi_version_7, NULL, NULL);
log_error("thread: attempting lock. may hang. err == %d", err);
@@ -57,7 +57,7 @@ int main (int argc, char *argv[]) {
if (!err) {
err = cc_context_lock(context, cc_lock_read, cc_lock_noblock);
}
-
+
log_error("main: initialized and read locked context. err == %d", err);
#ifdef TARGET_OS_MAC
@@ -71,9 +71,9 @@ int main (int argc, char *argv[]) {
#else
#endif
-
+
log_error("main: unlocking and releasing context. err == %d", err);
-
+
if (context) {
log_error("main: calling cc_context_unlock");
cc_context_unlock(context);
@@ -83,7 +83,7 @@ int main (int argc, char *argv[]) {
}
log_error("main: return. err == %d", err);
-
+
#if defined(_WIN32)
UNREFERENCED_PARAMETER(status); // no whining!
#endif
diff --git a/src/ccapi/test/test_cc_ccache_compare.c b/src/ccapi/test/test_cc_ccache_compare.c
index 6034a34..96aaa56 100644
--- a/src/ccapi/test/test_cc_ccache_compare.c
+++ b/src/ccapi/test/test_cc_ccache_compare.c
@@ -7,7 +7,7 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_compare();
diff --git a/src/ccapi/test/test_cc_ccache_destroy.c b/src/ccapi/test/test_cc_ccache_destroy.c
index 2b56f10..95c417c 100644
--- a/src/ccapi/test/test_cc_ccache_destroy.c
+++ b/src/ccapi/test/test_cc_ccache_destroy.c
@@ -7,7 +7,7 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_destroy();
diff --git a/src/ccapi/test/test_cc_ccache_get_change_time.c b/src/ccapi/test/test_cc_ccache_get_change_time.c
index 323c66f..a515d5b 100644
--- a/src/ccapi/test/test_cc_ccache_get_change_time.c
+++ b/src/ccapi/test/test_cc_ccache_get_change_time.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_get_change_time();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_get_credentials_version.c b/src/ccapi/test/test_cc_ccache_get_credentials_version.c
index 7f3e714..f5df7c0 100644
--- a/src/ccapi/test/test_cc_ccache_get_credentials_version.c
+++ b/src/ccapi/test/test_cc_ccache_get_credentials_version.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_get_credentials_version();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_get_kdc_time_offset.c b/src/ccapi/test/test_cc_ccache_get_kdc_time_offset.c
index 871342a..13e6116 100644
--- a/src/ccapi/test/test_cc_ccache_get_kdc_time_offset.c
+++ b/src/ccapi/test/test_cc_ccache_get_kdc_time_offset.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_get_kdc_time_offset();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_get_last_default_time.c b/src/ccapi/test/test_cc_ccache_get_last_default_time.c
index a820d13..4de22e4 100644
--- a/src/ccapi/test/test_cc_ccache_get_last_default_time.c
+++ b/src/ccapi/test/test_cc_ccache_get_last_default_time.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_get_last_default_time();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_get_name.c b/src/ccapi/test/test_cc_ccache_get_name.c
index 77e525a..f664997 100644
--- a/src/ccapi/test/test_cc_ccache_get_name.c
+++ b/src/ccapi/test/test_cc_ccache_get_name.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_get_name();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_get_principal.c b/src/ccapi/test/test_cc_ccache_get_principal.c
index 8e110ed..05d7c43 100644
--- a/src/ccapi/test/test_cc_ccache_get_principal.c
+++ b/src/ccapi/test/test_cc_ccache_get_principal.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_get_principal();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_iterator_next.c b/src/ccapi/test/test_cc_ccache_iterator_next.c
index ec81103..945a98d 100644
--- a/src/ccapi/test/test_cc_ccache_iterator_next.c
+++ b/src/ccapi/test/test_cc_ccache_iterator_next.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_iterator_next();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_move.c b/src/ccapi/test/test_cc_ccache_move.c
index 3779318..880198c 100644
--- a/src/ccapi/test/test_cc_ccache_move.c
+++ b/src/ccapi/test/test_cc_ccache_move.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_move();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_new_credentials_iterator.c b/src/ccapi/test/test_cc_ccache_new_credentials_iterator.c
index cd18693..1338e83 100644
--- a/src/ccapi/test/test_cc_ccache_new_credentials_iterator.c
+++ b/src/ccapi/test/test_cc_ccache_new_credentials_iterator.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_new_credentials_iterator();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_release.c b/src/ccapi/test/test_cc_ccache_release.c
index 4a8e685..75d604c 100644
--- a/src/ccapi/test/test_cc_ccache_release.c
+++ b/src/ccapi/test/test_cc_ccache_release.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_release();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_remove_credentials.c b/src/ccapi/test/test_cc_ccache_remove_credentials.c
index c13a618..679da85 100644
--- a/src/ccapi/test/test_cc_ccache_remove_credentials.c
+++ b/src/ccapi/test/test_cc_ccache_remove_credentials.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_remove_credentials();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_set_default.c b/src/ccapi/test/test_cc_ccache_set_default.c
index 6adf3e9..71bba2a 100644
--- a/src/ccapi/test/test_cc_ccache_set_default.c
+++ b/src/ccapi/test/test_cc_ccache_set_default.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_set_default();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_set_kdc_time_offset.c b/src/ccapi/test/test_cc_ccache_set_kdc_time_offset.c
index e15f246..b8b21e9 100644
--- a/src/ccapi/test/test_cc_ccache_set_kdc_time_offset.c
+++ b/src/ccapi/test/test_cc_ccache_set_kdc_time_offset.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_set_kdc_time_offset();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_set_principal.c b/src/ccapi/test/test_cc_ccache_set_principal.c
index 4cc4534..ec55acd 100644
--- a/src/ccapi/test/test_cc_ccache_set_principal.c
+++ b/src/ccapi/test/test_cc_ccache_set_principal.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_set_principal();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_ccache_store_credentials.c b/src/ccapi/test/test_cc_ccache_store_credentials.c
index 53a6564..c52125b 100644
--- a/src/ccapi/test/test_cc_ccache_store_credentials.c
+++ b/src/ccapi/test/test_cc_ccache_store_credentials.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_ccache_store_credentials();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_close.c b/src/ccapi/test/test_cc_close.c
index b3a5bc2..b6bc3af 100644
--- a/src/ccapi/test/test_cc_close.c
+++ b/src/ccapi/test/test_cc_close.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_close();
diff --git a/src/ccapi/test/test_cc_context_compare.c b/src/ccapi/test/test_cc_context_compare.c
index 9b2626a..f4965af 100644
--- a/src/ccapi/test/test_cc_context_compare.c
+++ b/src/ccapi/test/test_cc_context_compare.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_context_compare();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_context_create_ccache.c b/src/ccapi/test/test_cc_context_create_ccache.c
index a616e1c..c942945 100644
--- a/src/ccapi/test/test_cc_context_create_ccache.c
+++ b/src/ccapi/test/test_cc_context_create_ccache.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_context_create_ccache();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_context_create_default_ccache.c b/src/ccapi/test/test_cc_context_create_default_ccache.c
index aaad4ab..c3fb405 100644
--- a/src/ccapi/test/test_cc_context_create_default_ccache.c
+++ b/src/ccapi/test/test_cc_context_create_default_ccache.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_context_create_default_ccache();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_context_create_new_ccache.c b/src/ccapi/test/test_cc_context_create_new_ccache.c
index c77d931..d89fa4f 100644
--- a/src/ccapi/test/test_cc_context_create_new_ccache.c
+++ b/src/ccapi/test/test_cc_context_create_new_ccache.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_context_create_new_ccache();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_context_get_change_time.c b/src/ccapi/test/test_cc_context_get_change_time.c
index f98b2ce..ad5c0a3 100644
--- a/src/ccapi/test/test_cc_context_get_change_time.c
+++ b/src/ccapi/test/test_cc_context_get_change_time.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_context_get_change_time();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_context_get_default_ccache_name.c b/src/ccapi/test/test_cc_context_get_default_ccache_name.c
index ffa8c2c..06fff95 100644
--- a/src/ccapi/test/test_cc_context_get_default_ccache_name.c
+++ b/src/ccapi/test/test_cc_context_get_default_ccache_name.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_context_get_default_ccache_name();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_context_new_ccache_iterator.c b/src/ccapi/test/test_cc_context_new_ccache_iterator.c
index b7885de..8220985 100644
--- a/src/ccapi/test/test_cc_context_new_ccache_iterator.c
+++ b/src/ccapi/test/test_cc_context_new_ccache_iterator.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_context_new_ccache_iterator();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_context_open_ccache.c b/src/ccapi/test/test_cc_context_open_ccache.c
index 8e7e825..461d8df 100644
--- a/src/ccapi/test/test_cc_context_open_ccache.c
+++ b/src/ccapi/test/test_cc_context_open_ccache.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_context_open_ccache();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_context_open_default_ccache.c b/src/ccapi/test/test_cc_context_open_default_ccache.c
index e6e72fa..09c6b7c 100644
--- a/src/ccapi/test/test_cc_context_open_default_ccache.c
+++ b/src/ccapi/test/test_cc_context_open_default_ccache.c
@@ -7,10 +7,9 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_context_open_default_ccache();
return err;
}
- \ No newline at end of file
diff --git a/src/ccapi/test/test_cc_context_release.c b/src/ccapi/test/test_cc_context_release.c
index 5510ab9..03faf23 100644
--- a/src/ccapi/test/test_cc_context_release.c
+++ b/src/ccapi/test/test_cc_context_release.c
@@ -7,7 +7,7 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_context_release();
diff --git a/src/ccapi/test/test_cc_create.c b/src/ccapi/test/test_cc_create.c
index d591d47..a21c443 100644
--- a/src/ccapi/test/test_cc_create.c
+++ b/src/ccapi/test/test_cc_create.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_create();
diff --git a/src/ccapi/test/test_cc_credentials_iterator_next.c b/src/ccapi/test/test_cc_credentials_iterator_next.c
index 5ae9611..beed791 100644
--- a/src/ccapi/test/test_cc_credentials_iterator_next.c
+++ b/src/ccapi/test/test_cc_credentials_iterator_next.c
@@ -7,7 +7,7 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_credentials_iterator_next();
diff --git a/src/ccapi/test/test_cc_destroy.c b/src/ccapi/test/test_cc_destroy.c
index 13eae7b..e55a837 100644
--- a/src/ccapi/test/test_cc_destroy.c
+++ b/src/ccapi/test/test_cc_destroy.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_destroy();
diff --git a/src/ccapi/test/test_cc_get_NC_info.c b/src/ccapi/test/test_cc_get_NC_info.c
index fe72cbe..6b8eb37 100644
--- a/src/ccapi/test/test_cc_get_NC_info.c
+++ b/src/ccapi/test/test_cc_get_NC_info.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_get_NC_info();
diff --git a/src/ccapi/test/test_cc_get_change_time.c b/src/ccapi/test/test_cc_get_change_time.c
index 8b031c1..d2058fe 100644
--- a/src/ccapi/test/test_cc_get_change_time.c
+++ b/src/ccapi/test/test_cc_get_change_time.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_get_change_time();
diff --git a/src/ccapi/test/test_cc_get_cred_version.c b/src/ccapi/test/test_cc_get_cred_version.c
index 865abf0..1ff8678 100644
--- a/src/ccapi/test/test_cc_get_cred_version.c
+++ b/src/ccapi/test/test_cc_get_cred_version.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_get_cred_version();
diff --git a/src/ccapi/test/test_cc_get_name.c b/src/ccapi/test/test_cc_get_name.c
index b4efa40..5b6e146 100644
--- a/src/ccapi/test/test_cc_get_name.c
+++ b/src/ccapi/test/test_cc_get_name.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_get_name();
diff --git a/src/ccapi/test/test_cc_get_principal.c b/src/ccapi/test/test_cc_get_principal.c
index f007856..a809e5d 100644
--- a/src/ccapi/test/test_cc_get_principal.c
+++ b/src/ccapi/test/test_cc_get_principal.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_get_principal();
diff --git a/src/ccapi/test/test_cc_initialize.c b/src/ccapi/test/test_cc_initialize.c
index bf2fcdc..1669a29 100644
--- a/src/ccapi/test/test_cc_initialize.c
+++ b/src/ccapi/test/test_cc_initialize.c
@@ -7,7 +7,7 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_initialize();
diff --git a/src/ccapi/test/test_cc_open.c b/src/ccapi/test/test_cc_open.c
index d3253d8..83bb602 100644
--- a/src/ccapi/test/test_cc_open.c
+++ b/src/ccapi/test/test_cc_open.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_open();
diff --git a/src/ccapi/test/test_cc_remove_cred.c b/src/ccapi/test/test_cc_remove_cred.c
index 121ad1b..6f841bb 100644
--- a/src/ccapi/test/test_cc_remove_cred.c
+++ b/src/ccapi/test/test_cc_remove_cred.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_remove_cred();
diff --git a/src/ccapi/test/test_cc_seq_fetch_NCs_begin.c b/src/ccapi/test/test_cc_seq_fetch_NCs_begin.c
index 0d08e91..329ca26 100644
--- a/src/ccapi/test/test_cc_seq_fetch_NCs_begin.c
+++ b/src/ccapi/test/test_cc_seq_fetch_NCs_begin.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_seq_fetch_NCs_begin();
diff --git a/src/ccapi/test/test_cc_seq_fetch_NCs_next.c b/src/ccapi/test/test_cc_seq_fetch_NCs_next.c
index c941fd4..31b5ac0 100644
--- a/src/ccapi/test/test_cc_seq_fetch_NCs_next.c
+++ b/src/ccapi/test/test_cc_seq_fetch_NCs_next.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_seq_fetch_NCs_next();
diff --git a/src/ccapi/test/test_cc_seq_fetch_creds_begin.c b/src/ccapi/test/test_cc_seq_fetch_creds_begin.c
index 16c0a72..5bb5e91 100644
--- a/src/ccapi/test/test_cc_seq_fetch_creds_begin.c
+++ b/src/ccapi/test/test_cc_seq_fetch_creds_begin.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_seq_fetch_creds_begin();
diff --git a/src/ccapi/test/test_cc_seq_fetch_creds_next.c b/src/ccapi/test/test_cc_seq_fetch_creds_next.c
index eaaf451..83528b3 100644
--- a/src/ccapi/test/test_cc_seq_fetch_creds_next.c
+++ b/src/ccapi/test/test_cc_seq_fetch_creds_next.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_seq_fetch_creds_next();
diff --git a/src/ccapi/test/test_cc_set_principal.c b/src/ccapi/test/test_cc_set_principal.c
index bfe9162..04b55df 100644
--- a/src/ccapi/test/test_cc_set_principal.c
+++ b/src/ccapi/test/test_cc_set_principal.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_set_principal();
diff --git a/src/ccapi/test/test_cc_shutdown.c b/src/ccapi/test/test_cc_shutdown.c
index 31c3d7c..8756ca9 100644
--- a/src/ccapi/test/test_cc_shutdown.c
+++ b/src/ccapi/test/test_cc_shutdown.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_shutdown();
diff --git a/src/ccapi/test/test_cc_store.c b/src/ccapi/test/test_cc_store.c
index 7edc777..507b361 100644
--- a/src/ccapi/test/test_cc_store.c
+++ b/src/ccapi/test/test_cc_store.c
@@ -6,7 +6,7 @@
#include "test_ccapi_v2.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_cc_store();
diff --git a/src/ccapi/test/test_ccapi_ccache.c b/src/ccapi/test/test_ccapi_ccache.c
index 64a70e3..a0fd84a 100644
--- a/src/ccapi/test/test_ccapi_ccache.c
+++ b/src/ccapi/test/test_ccapi_ccache.c
@@ -1,4 +1,3 @@
-
#include <string.h>
#include <stdlib.h>
#include <errno.h>
@@ -15,69 +14,69 @@ int check_cc_ccache_release(void) {
cc_int32 err = 0;
cc_context_t context = NULL;
cc_ccache_t ccache = NULL;
-
+
BEGIN_TEST("cc_ccache_release");
-
+
#ifndef cc_ccache_release
log_error("cc_ccache_release is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
-
+
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
}
-
-
-
+
+
+
if (!err) {
check_once_cc_ccache_release(context, ccache, ccNoError, NULL);
ccache = NULL;
}
-
+
if (context) { cc_context_release(context); }
-
+
#endif /* cc_ccache_release */
-
+
END_TEST_AND_RETURN
}
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;
-
+
cc_int32 possible_return_values[2] = {
- ccNoError,
- ccErrInvalidCCache,
+ ccNoError,
+ ccErrInvalidCCache,
};
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);
-
+
if (!err && name) { // try opening released ccache to make sure it still exists
err = cc_context_open_ccache(context, name->data, &ccache);
}
check_if(err == ccErrCCacheNotFound, "released ccache was actually destroyed instead");
-
+
if (ccache) { cc_ccache_destroy(ccache); }
if (name) { cc_string_release(name); }
-
+
#endif /* cc_ccache_release */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -89,69 +88,69 @@ int check_cc_ccache_destroy(void) {
cc_int32 err = 0;
cc_context_t context = NULL;
cc_ccache_t ccache = NULL;
-
+
BEGIN_TEST("cc_ccache_destroy");
-
+
#ifndef cc_ccache_destroy
log_error("cc_ccache_destroy is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
-
+
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
}
-
-
-
+
+
+
if (!err) {
check_once_cc_ccache_destroy(context, ccache, ccNoError, NULL);
ccache = NULL;
}
-
+
if (context) { cc_context_release(context); }
-
+
#endif /* cc_ccache_destroy */
-
+
END_TEST_AND_RETURN
}
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;
-
+
cc_int32 possible_return_values[2] = {
- ccNoError,
- ccErrInvalidCCache,
+ ccNoError,
+ ccErrInvalidCCache,
};
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;
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err && name) { // try opening released ccache to make sure it still exists
err = cc_context_open_ccache(context, name->data, &ccache);
}
check_if(err != ccErrCCacheNotFound, "destroyed ccache was actually released instead");
-
+
if (ccache) { cc_ccache_destroy(ccache); }
if (name) { cc_string_release(name); }
-
+
#endif /* cc_ccache_destroy */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -163,16 +162,16 @@ int check_cc_ccache_set_default(void) {
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
log_error("cc_ccache_set_default is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
-
+
// try when it's the only ccache (already default)
if (!err) {
err = destroy_all_ccaches(context);
@@ -187,7 +186,7 @@ int check_cc_ccache_set_default(void) {
err = cc_ccache_release(ccache);
ccache = NULL;
}
-
+
// try when it's not the only ccache (and not default)
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "baz@BAR.ORG", &ccache);
@@ -199,8 +198,8 @@ int check_cc_ccache_set_default(void) {
err = cc_ccache_release(ccache);
ccache = NULL;
}
-
- // try when it's not the only ccache (and already default)
+
+ // try when it's not the only ccache (and already default)
if (!err) {
err = cc_context_open_default_ccache(context, &ccache);
}
@@ -211,41 +210,41 @@ int check_cc_ccache_set_default(void) {
err = cc_ccache_release(ccache);
ccache = NULL;
}
-
+
if (!err) {
err = destroy_all_ccaches(context);
}
-
+
if (context) { cc_context_release(context); }
-
+
#endif /* cc_ccache_set_default */
-
+
END_TEST_AND_RETURN
}
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;
-
+
cc_int32 possible_return_values[3] = {
- ccNoError,
- ccErrInvalidCCache,
- ccErrCCacheNotFound,
+ ccNoError,
+ ccErrInvalidCCache,
+ ccErrCCacheNotFound,
};
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);
-
+
if (!err) {
err = cc_ccache_get_name(ccache, &name);
}
@@ -261,16 +260,16 @@ cc_int32 check_once_cc_ccache_set_default(cc_context_t context, cc_ccache_t ccac
else {
check_if(1, "cc_ccache_get_name failed");
}
-
+
if (default_ccache) { cc_ccache_release(default_ccache); }
//if (ccache) { cc_ccache_destroy(ccache); } // ccache is released by the caller
if (default_name) { cc_string_release(default_name); }
if (name) { cc_string_release(name); }
-
+
#endif /* cc_ccache_set_default */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -282,16 +281,16 @@ int check_cc_ccache_get_credentials_version(void) {
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
log_error("cc_ccache_get_credentials_version is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
-
+
// try one created with v5 creds
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
@@ -303,7 +302,7 @@ int check_cc_ccache_get_credentials_version(void) {
log_error("cc_context_create_new_ccache failed, can't complete test");
failure_count++;
}
-
+
// try it with added v4 creds
if (!err) {
err = cc_ccache_set_principal(ccache, cc_credentials_v4, "foo@BAR.ORG");
@@ -315,14 +314,14 @@ int check_cc_ccache_get_credentials_version(void) {
log_error("cc_ccache_set_principal failed, can't complete test");
failure_count++;
}
-
+
if (ccache) {
cc_ccache_destroy(ccache);
ccache = NULL;
}
-
+
err = ccNoError;
-
+
// try one created with v4 creds
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v4, "foo@BAR.ORG", &ccache);
@@ -334,62 +333,62 @@ int check_cc_ccache_get_credentials_version(void) {
log_error("cc_context_create_new_ccache failed, can't complete test");
failure_count++;
}
-
+
// try it with added v5 creds
if (!err) {
err = cc_ccache_set_principal(ccache, cc_credentials_v5, "foo@BAR.ORG");
}
if (!err) {
check_once_cc_ccache_get_credentials_version(ccache, cc_credentials_v4_v5, ccNoError, "v4 with v5 creds added");
- }
+ }
else {
log_error("cc_ccache_set_principal failed, can't complete test");
failure_count++;
}
-
+
if (ccache) {
cc_ccache_destroy(ccache);
ccache = NULL;
}
-
+
if (context) { cc_context_release(context); }
-
+
#endif /* cc_ccache_get_credentials_version */
-
+
END_TEST_AND_RETURN
}
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;
-
+
cc_int32 possible_return_values[4] = {
- ccNoError,
- ccErrInvalidCCache,
- ccErrBadParam,
- ccErrCCacheNotFound,
+ ccNoError,
+ ccErrInvalidCCache,
+ ccErrBadParam,
+ ccErrCCacheNotFound,
};
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
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
check_if(stored_cred_vers != expected_cred_vers, NULL);
}
-
+
#endif /* cc_ccache_get_credentials_version */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -401,20 +400,20 @@ int check_cc_ccache_get_name(void) {
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
log_error("cc_ccache_get_name is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches(context);
}
-
+
// try with unique ccache (which happens to be default)
if (!err) {
err = cc_context_create_ccache(context, "0", cc_credentials_v5, "foo@BAR.ORG", &ccache);
@@ -425,12 +424,12 @@ int check_cc_ccache_get_name(void) {
else {
log_error("cc_context_create_ccache failed, can't complete test");
failure_count++;
- }
+ }
if (ccache) {
cc_ccache_release(ccache);
ccache = NULL;
}
-
+
// try with unique ccache (which is not default)
if (!err) {
err = cc_context_create_ccache(context, "1", cc_credentials_v5, "foo@BAR.ORG", &ccache);
@@ -442,7 +441,7 @@ int check_cc_ccache_get_name(void) {
log_error("cc_context_create_ccache failed, can't complete test");
failure_count++;
}
-
+
// try with bad param
if (!err) {
check_once_cc_ccache_get_name(ccache, NULL, ccErrBadParam, "NULL param");
@@ -451,104 +450,104 @@ int check_cc_ccache_get_name(void) {
cc_ccache_release(ccache);
ccache = NULL;
}
-
- if (context) {
+
+ if (context) {
err = destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
#endif /* cc_ccache_get_name */
-
- END_TEST_AND_RETURN
+
+ END_TEST_AND_RETURN
}
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;
-
+
cc_int32 possible_return_values[4] = {
- ccNoError,
- ccErrInvalidCCache,
- ccErrBadParam,
- ccErrCCacheNotFound,
+ ccNoError,
+ ccErrInvalidCCache,
+ ccErrBadParam,
+ ccErrCCacheNotFound,
};
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);
}
else {
err = cc_ccache_get_name(ccache, &stored_name);
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
check_if(strcmp(stored_name->data, expected_name), NULL);
}
-
+
if (stored_name) { cc_string_release(stored_name); }
-
+
#endif /* cc_ccache_get_name */
-
+
END_CHECK_ONCE;
-
+
return err;
}
// ---------------------------------------------------------------------------
-cc_int32 check_once_cc_ccache_get_principal(cc_ccache_t ccache,
- cc_uint32 cred_vers,
- const char *expected_principal,
- cc_int32 expected_err,
+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,
+ 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;
}
@@ -558,20 +557,20 @@ int check_cc_ccache_get_principal(void) {
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
log_error("cc_ccache_get_principal is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches(context);
}
-
+
// try with krb5 principal
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo/BAR@BAZ.ORG", &ccache);
@@ -587,7 +586,7 @@ int check_cc_ccache_get_principal(void) {
cc_ccache_release(ccache);
ccache = NULL;
}
-
+
// try with krb4 principal
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v4, "foo.BAR@BAZ.ORG", &ccache);
@@ -599,29 +598,29 @@ int check_cc_ccache_get_principal(void) {
log_error("cc_context_create_new_ccache failed, can't complete test");
failure_count++;
}
-
+
// try with bad param
if (!err) {
// cc_ccache_t doesn't have any concept of the difference between a v4 and v5 principal
- check_once_cc_ccache_get_principal(ccache, cc_credentials_v4_v5, "foo.BAR@BAZ.ORG",
+ check_once_cc_ccache_get_principal(ccache, cc_credentials_v4_v5, "foo.BAR@BAZ.ORG",
ccErrBadCredentialsVersion,
"passing cc_credentials_v4_v5 (shouldn't be allowed)");
check_once_cc_ccache_get_principal(ccache, cc_credentials_v5, NULL, ccErrBadParam, "passed null out param");
}
-
+
if (ccache) {
cc_ccache_release(ccache);
ccache = NULL;
}
-
- if (context) {
+
+ if (context) {
err = destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
#endif /* cc_ccache_get_principal */
-
- END_TEST_AND_RETURN
+
+ END_TEST_AND_RETURN
}
// ---------------------------------------------------------------------------
@@ -630,20 +629,20 @@ int check_cc_ccache_set_principal(void) {
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
log_error("cc_ccache_set_principal is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches(context);
}
-
+
// bad params
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAZ.ORG", &ccache);
@@ -660,7 +659,7 @@ int check_cc_ccache_set_principal(void) {
cc_ccache_destroy(ccache);
ccache = NULL;
}
-
+
// empty ccache
@@ -679,7 +678,7 @@ int check_cc_ccache_set_principal(void) {
cc_ccache_destroy(ccache);
ccache = NULL;
}
-
+
// add v4 principal to v5 only ccache
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAZ.ORG", &ccache);
@@ -711,7 +710,7 @@ int check_cc_ccache_set_principal(void) {
cc_ccache_destroy(ccache);
ccache = NULL;
}
-
+
// add v5 principal to v4 only ccache
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v4, "foo@BAZ.ORG", &ccache);
@@ -727,66 +726,66 @@ int check_cc_ccache_set_principal(void) {
cc_ccache_destroy(ccache);
ccache = NULL;
}
-
+
// with credentials
-
+
// replace v5 only ccache's principal
-
+
// add v4 principal to v5 only ccache
// replace v4 only ccache's principal
-
+
// add v5 principal to v4 only ccache
-
- if (context) {
+
+ if (context) {
err = destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
#endif /* cc_ccache_set_principal */
-
- END_TEST_AND_RETURN
+
+ END_TEST_AND_RETURN
}
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;
cc_string_t stored_principal = NULL;
-
+
cc_int32 possible_return_values[6] = {
- ccNoError,
- ccErrNoMem,
- ccErrInvalidCCache,
- ccErrBadCredentialsVersion,
- ccErrBadParam,
- ccErrCCacheNotFound,
+ ccNoError,
+ ccErrNoMem,
+ ccErrInvalidCCache,
+ ccErrBadCredentialsVersion,
+ ccErrBadParam,
+ ccErrCCacheNotFound,
};
BEGIN_CHECK_ONCE(description);
-
+
#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);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
err = cc_ccache_get_principal(ccache, cred_vers, &stored_principal);
}
-
+
// compare stored with input
if (!err) {
check_if(strcmp(stored_principal->data, in_principal), "expected princ == \"%s\" stored princ == \"%s\"", in_principal, stored_principal->data);
}
-
+
if (stored_principal) { cc_string_release(stored_principal); }
-
+
#endif /* cc_ccache_set_principal */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -801,20 +800,20 @@ int check_cc_ccache_store_credentials(void) {
cc_ccache_t dup_ccache = NULL;
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) {
err = destroy_all_ccaches(context);
}
-
+
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
}
@@ -823,21 +822,21 @@ int check_cc_ccache_store_credentials(void) {
if (!err) {
err = new_v5_creds_union(&creds_union, "BAR.ORG");
}
-
+
if (!err) {
check_once_cc_ccache_store_credentials(ccache, &creds_union, ccNoError, "ok creds");
}
-
+
if (&creds_union) { release_v5_creds_union(&creds_union); }
-
+
// try with bad params
check_once_cc_ccache_store_credentials(ccache, NULL, ccErrBadParam, "NULL creds param");
-
+
// invalid creds
if (!err) {
err = new_v5_creds_union(&creds_union, "BAR.ORG");
}
-
+
if (!err) {
if (creds_union.credentials.credentials_v5->client) {
free(creds_union.credentials.credentials_v5->client);
@@ -845,14 +844,14 @@ int check_cc_ccache_store_credentials(void) {
}
check_once_cc_ccache_store_credentials(ccache, &creds_union, ccErrBadParam, "invalid creds (NULL client string)");
}
-
+
if (&creds_union) { release_v5_creds_union(&creds_union); }
-
+
// bad creds version
if (!err) {
err = new_v5_creds_union(&creds_union, "BAR.ORG");
}
-
+
if (!err) {
creds_union.version = cc_credentials_v4_v5;
check_once_cc_ccache_store_credentials(ccache, &creds_union, ccErrBadCredentialsVersion, "v4_v5 creds (invalid) into a ccache with only v5 princ");
@@ -860,11 +859,11 @@ int check_cc_ccache_store_credentials(void) {
check_once_cc_ccache_store_credentials(ccache, &creds_union, ccErrBadCredentialsVersion, "v4 creds into a ccache with only v5 princ");
creds_union.version = cc_credentials_v5;
}
-
+
if (&creds_union) { release_v5_creds_union(&creds_union); }
-
+
// non-existent ccache
- if (ccache) {
+ if (ccache) {
err = cc_ccache_get_name(ccache, &name);
if (!err) {
err = cc_context_open_ccache(context, name->data, &dup_ccache);
@@ -872,24 +871,24 @@ int check_cc_ccache_store_credentials(void) {
if (name) { cc_string_release(name); }
if (dup_ccache) { cc_ccache_destroy(dup_ccache); }
}
-
+
if (!err) {
err = new_v5_creds_union(&creds_union, "BAR.ORG");
}
-
+
if (!err) {
check_once_cc_ccache_store_credentials(ccache, &creds_union, ccErrInvalidCCache, "invalid ccache");
}
-
+
if (&creds_union) { release_v5_creds_union(&creds_union); }
if (ccache) { cc_ccache_release(ccache); }
- if (context) {
+ if (context) {
destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
#endif /* cc_ccache_store_credentials */
-
+
END_TEST_AND_RETURN
}
@@ -897,27 +896,27 @@ cc_int32 check_once_cc_ccache_store_credentials(cc_ccache_t ccache, const cc_cre
cc_int32 err = ccNoError;
cc_credentials_iterator_t creds_iterator = NULL;
cc_credentials_t creds = NULL;
-
+
cc_int32 possible_return_values[6] = {
- ccNoError,
- ccErrBadParam,
- ccErrInvalidCCache,
- ccErrInvalidCredentials,
- ccErrBadCredentialsVersion,
- ccErrCCacheNotFound,
+ ccNoError,
+ ccErrBadParam,
+ ccErrInvalidCCache,
+ ccErrInvalidCredentials,
+ ccErrBadCredentialsVersion,
+ ccErrCCacheNotFound,
};
BEGIN_CHECK_ONCE(description);
-
+
#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);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
// make sure credentials were truly stored
if (!err) {
err = cc_ccache_new_credentials_iterator(ccache, &creds_iterator);
@@ -929,20 +928,20 @@ cc_int32 check_once_cc_ccache_store_credentials(cc_ccache_t ccache, const cc_cre
break;
}
cc_credentials_release(creds);
- creds = NULL;
+ creds = NULL;
}
}
-
- if (err == ccIteratorEnd) {
+
+ if (err == ccIteratorEnd) {
check_if((creds != NULL), "stored credentials not found in ccache");
err = ccNoError;
}
if (creds) { cc_credentials_release(creds); }
-
+
#endif /* cc_ccache_store_credentials */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -961,24 +960,24 @@ int check_cc_ccache_remove_credentials(void) {
cc_credentials_iterator_t creds_iterator = NULL;
cc_string_t name = NULL;
unsigned int i;
-
+
BEGIN_TEST("cc_ccache_remove_credentials");
-
+
#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);
}
-
+
// store 10 creds and retrieve their cc_credentials_t representations
for(i = 0; !err && (i < 10); i++) {
new_v5_creds_union(&creds_union, "BAR.ORG");
@@ -1000,7 +999,7 @@ int check_cc_ccache_remove_credentials(void) {
}
}
if (err == ccIteratorEnd) { err = ccNoError; }
-
+
// remove 10 valid creds
for (i = 0; !err && (i < 8); i++) {
check_once_cc_ccache_remove_credentials(ccache, creds_array[i], ccNoError, "10 ok creds");
@@ -1008,12 +1007,12 @@ int check_cc_ccache_remove_credentials(void) {
// NULL 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], ccErrInvalidCredentials, "removed same creds twice");
-
+
// non-existent ccache
- if (ccache) {
+ if (ccache) {
err = cc_ccache_get_name(ccache, &name);
if (!err) {
err = cc_context_open_ccache(context, name->data, &dup_ccache);
@@ -1021,11 +1020,11 @@ int check_cc_ccache_remove_credentials(void) {
if (name) { cc_string_release(name); }
if (dup_ccache) { cc_ccache_destroy(dup_ccache); }
}
-
+
if (!err) {
err = new_v5_creds_union(&creds_union, "BAR.ORG");
}
-
+
if (!err) {
check_once_cc_ccache_remove_credentials(ccache, creds_array[8], ccErrInvalidCCache, "invalid ccache");
}
@@ -1035,13 +1034,13 @@ int check_cc_ccache_remove_credentials(void) {
}
if (ccache) { cc_ccache_release(ccache); }
- if (context) {
+ if (context) {
destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
#endif /* cc_ccache_remove_credentials */
-
+
END_TEST_AND_RETURN
}
@@ -1049,27 +1048,27 @@ cc_int32 check_once_cc_ccache_remove_credentials(cc_ccache_t ccache, cc_credenti
cc_int32 err = ccNoError;
cc_credentials_iterator_t creds_iterator = NULL;
cc_credentials_t creds = NULL;
-
+
cc_int32 possible_return_values[6] = {
- ccNoError,
- ccErrBadParam,
- ccErrInvalidCCache,
- ccErrInvalidCredentials,
- ccErrCredentialsNotFound,
+ ccNoError,
+ ccErrBadParam,
+ ccErrInvalidCCache,
+ ccErrInvalidCredentials,
+ ccErrCredentialsNotFound,
ccErrCCacheNotFound,
};
BEGIN_CHECK_ONCE(description);
-
+
#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);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
// make sure credentials were truly removed
if (!err) {
err = cc_ccache_new_credentials_iterator(ccache, &creds_iterator);
@@ -1081,22 +1080,22 @@ cc_int32 check_once_cc_ccache_remove_credentials(cc_ccache_t ccache, cc_credenti
break;
}
cc_credentials_release(creds);
- creds = NULL;
+ creds = NULL;
}
}
-
- if (err == ccIteratorEnd) {
+
+ if (err == ccIteratorEnd) {
err = ccNoError;
}
else {
check_if((creds != NULL), "credentials not removed from ccache");
}
if (creds) { cc_credentials_release(creds); }
-
+
#endif /* cc_ccache_remove_credentials */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -1111,44 +1110,44 @@ int check_cc_ccache_new_credentials_iterator(void) {
cc_ccache_t dup_ccache = NULL;
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) {
err = destroy_all_ccaches(context);
}
-
+
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
}
-
+
// valid params
if (!err) {
check_once_cc_ccache_new_credentials_iterator(ccache, &creds_iterator, ccNoError, "valid params");
}
- if (creds_iterator) {
- cc_credentials_iterator_release(creds_iterator);
+ if (creds_iterator) {
+ cc_credentials_iterator_release(creds_iterator);
creds_iterator = NULL;
}
-
+
// NULL out param
if (!err) {
check_once_cc_ccache_new_credentials_iterator(ccache, NULL, ccErrBadParam, "NULL out iterator param");
}
- if (creds_iterator) {
- cc_credentials_iterator_release(creds_iterator);
+ if (creds_iterator) {
+ cc_credentials_iterator_release(creds_iterator);
creds_iterator = NULL;
}
-
+
// non-existent ccache
- if (ccache) {
+ if (ccache) {
err = cc_ccache_get_name(ccache, &name);
if (!err) {
err = cc_context_open_ccache(context, name->data, &dup_ccache);
@@ -1156,53 +1155,53 @@ int check_cc_ccache_new_credentials_iterator(void) {
if (name) { cc_string_release(name); }
if (dup_ccache) { cc_ccache_destroy(dup_ccache); }
}
-
+
if (!err) {
check_once_cc_ccache_new_credentials_iterator(ccache, &creds_iterator, ccErrInvalidCCache, "invalid ccache");
}
-
- if (creds_iterator) {
- cc_credentials_iterator_release(creds_iterator);
+
+ if (creds_iterator) {
+ cc_credentials_iterator_release(creds_iterator);
creds_iterator = NULL;
}
if (ccache) { cc_ccache_release(ccache); }
- if (context) {
+ if (context) {
destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
#endif /* cc_ccache_new_credentials_iterator */
-
+
END_TEST_AND_RETURN
}
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[5] = {
- ccNoError,
- ccErrBadParam,
- ccErrNoMem,
- ccErrCCacheNotFound,
- ccErrInvalidCCache,
+ ccNoError,
+ ccErrBadParam,
+ ccErrNoMem,
+ ccErrCCacheNotFound,
+ ccErrInvalidCCache,
};
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);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
#endif /* cc_ccache_new_credentials_iterator */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -1212,38 +1211,38 @@ 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,
+ ccNoError,
+ ccErrInvalidCCache,
+ ccErrBadParam,
+ ccErrCCacheNotFound,
};
BEGIN_CHECK_ONCE(description);
-
+
#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;
}
@@ -1258,20 +1257,20 @@ int check_cc_ccache_get_change_time(void) {
cc_credentials_iterator_t creds_iterator = NULL;
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) {
err = destroy_all_ccaches(context);
}
-
+
// create some ccaches (so that the one we keep around as 'ccache' is not default)
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
@@ -1282,14 +1281,14 @@ int check_cc_ccache_get_change_time(void) {
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAZ.ORG", &ccache);
}
-
+
// change it in all the ways it can change, checking after each
-
+
// the ccache is created
if (!err) {
check_once_cc_ccache_get_change_time(ccache, &last_time, ccNoError, "new ccache (change time should be > 0)");
}
-
+
// the ccache is made default
if (!err) {
err = cc_ccache_set_default(ccache);
@@ -1297,7 +1296,7 @@ int check_cc_ccache_get_change_time(void) {
if (!err) {
check_once_cc_ccache_get_change_time(ccache, &last_time, ccNoError, "non-default ccache became default");
}
-
+
// the ccache is made not-default
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "something@ELSE.COM", &dummy_ccache);
@@ -1305,20 +1304,20 @@ int check_cc_ccache_get_change_time(void) {
if (!err) {
err = cc_ccache_set_default(dummy_ccache);
}
- if (dummy_ccache) {
+ if (dummy_ccache) {
cc_ccache_release(dummy_ccache);
}
if (!err) {
check_once_cc_ccache_get_change_time(ccache, &last_time, ccNoError, "default ccache became non-default");
}
-
+
// try with bad params
-
+
// NULL out param
if (!err) {
check_once_cc_ccache_get_change_time(ccache, NULL, ccErrBadParam, "NULL out param for time");
}
-
+
// store a credential
if (!err) {
new_v5_creds_union(&creds_union, "BAR.ORG");
@@ -1326,7 +1325,7 @@ int check_cc_ccache_get_change_time(void) {
release_v5_creds_union(&creds_union);
}
check_once_cc_ccache_get_change_time(ccache, &last_time, ccNoError, "stored new credential");
-
+
if (!err) {
// change principal (fails with ccErrBadInternalMessage)
err = cc_ccache_set_principal(ccache, cc_credentials_v5, "foo@BAR.ORG");
@@ -1337,7 +1336,7 @@ int check_cc_ccache_get_change_time(void) {
}
}
check_once_cc_context_get_change_time(context, &last_time, ccNoError, "after changing a principle");
-
+
// remove a credential
if (!err) {
err = cc_ccache_new_credentials_iterator(ccache, &creds_iterator);
@@ -1352,8 +1351,8 @@ int check_cc_ccache_get_change_time(void) {
err = cc_ccache_remove_credentials(ccache, credentials);
}
check_once_cc_context_get_change_time(context, &last_time, ccNoError, "after removing a credential");
-
-
+
+
// invalid ccache
if (!err) {
err = destroy_all_ccaches(context);
@@ -1361,15 +1360,15 @@ int check_cc_ccache_get_change_time(void) {
if (!err) {
check_once_cc_ccache_get_change_time(ccache, &last_time, ccErrInvalidCCache, "getting change time on destroyed ccache");
}
-
+
if (ccache) { cc_ccache_release(ccache); }
- if (context) {
+ if (context) {
destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
#endif /* cc_ccache_get_change_time */
-
+
END_TEST_AND_RETURN
}
@@ -1379,39 +1378,39 @@ int check_cc_ccache_get_change_time(void) {
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;
cc_time_t this_time = 0;
-
+
cc_int32 possible_return_values[5] = {
- ccNoError,
- ccErrInvalidCCache,
- ccErrBadParam,
- ccErrNeverDefault,
- ccErrCCacheNotFound,
+ ccNoError,
+ ccErrInvalidCCache,
+ ccErrBadParam,
+ ccErrNeverDefault,
+ ccErrCCacheNotFound,
};
BEGIN_CHECK_ONCE(description);
-
+
#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_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;
}
@@ -1425,20 +1424,20 @@ int check_cc_ccache_get_last_default_time(void) {
cc_time_t last_time_1 = 0;
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) {
err = destroy_all_ccaches(context);
}
-
+
// create 2 ccaches
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@ONE.ORG", &ccache_1);
@@ -1446,18 +1445,18 @@ int check_cc_ccache_get_last_default_time(void) {
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@TWO.ORG", &ccache_2);
}
-
+
if (!err) {
err = cc_ccache_get_change_time(ccache_1, &last_time_1);
}
-
- // since we destroyed all ccaches before creating these two,
+
+ // since we destroyed all ccaches before creating these two,
// ccache_1 should be default and ccache_2 should never have been default
if (!err) {
check_once_cc_ccache_get_last_default_time(ccache_1, &last_time_1, ccNoError, "ccache_1 default at creation");
check_once_cc_ccache_get_last_default_time(ccache_2, &last_time_2, ccErrNeverDefault, "ccache_2 never default");
}
-
+
// make ccache_2 default and check each of their times again
if (!err) {
err = cc_ccache_set_default(ccache_2);
@@ -1474,10 +1473,10 @@ int check_cc_ccache_get_last_default_time(void) {
if (!err) {
check_once_cc_ccache_get_last_default_time(ccache_1, NULL, ccErrBadParam, "NULL out param");
}
-
+
// non-existent ccache
- if (ccache_2) {
- cc_ccache_release(ccache_2);
+ if (ccache_2) {
+ cc_ccache_release(ccache_2);
ccache_2 = NULL;
}
if (!err) {
@@ -1490,20 +1489,20 @@ int check_cc_ccache_get_last_default_time(void) {
cc_ccache_destroy(ccache_2);
ccache_2 = NULL;
}
-
+
if (!err) {
check_once_cc_ccache_get_last_default_time(ccache_1, &last_time_1, ccErrInvalidCCache, "destroyed ccache");
}
-
+
if (ccache_1) { cc_ccache_release(ccache_1); }
-
- if (context) {
+
+ if (context) {
destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
#endif /* cc_ccache_get_last_default_time */
-
+
END_TEST_AND_RETURN
}
@@ -1514,23 +1513,23 @@ int check_cc_ccache_move(void) {
cc_context_t context = NULL;
cc_ccache_t source = NULL;
cc_ccache_t destination = NULL;
-
+
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) {
err = destroy_all_ccaches(context);
}
-
+
// create 2 ccaches
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@ONE.ORG", &source);
@@ -1538,7 +1537,7 @@ int check_cc_ccache_move(void) {
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@TWO.ORG", &destination);
}
-
+
// store credentials in each
for (i = 0; !err && (i < 10); i++) {
new_v5_creds_union(&creds_union, "ONE.ORG");
@@ -1548,7 +1547,7 @@ int check_cc_ccache_move(void) {
new_v5_creds_union(&creds_union, "TWO.ORG");
err = cc_ccache_store_credentials(destination, &creds_union);
}
-
+
// move source into destination
if (!err) {
check_once_cc_ccache_move(source, destination, ccNoError, "valid params");
@@ -1558,25 +1557,25 @@ int check_cc_ccache_move(void) {
if (!err) {
check_once_cc_ccache_move(destination, NULL, ccErrBadParam, "NULL destination param");
}
-
+
// non-existent ccache
if (!err) {
check_once_cc_ccache_move(destination, source, ccErrInvalidCCache, "recently moved source as destination param");
}
-
+
if (source) { cc_ccache_release(source); }
if (destination) { cc_ccache_release(destination); }
-
- if (context) {
+
+ if (context) {
destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
#endif /* cc_ccache_move */
-
+
END_TEST_AND_RETURN
-
-
+
+
}
cc_int32 check_once_cc_ccache_move(cc_ccache_t source, cc_ccache_t destination, cc_int32 expected_err, const char *description) {
@@ -1585,25 +1584,25 @@ cc_int32 check_once_cc_ccache_move(cc_ccache_t source, cc_ccache_t destination,
cc_credentials_t creds = NULL;
cc_credentials_iterator_t cred_iterator = NULL;
unsigned int i = 0;
-
+
cc_string_t src_principal = NULL;
cc_string_t dst_principal = NULL;
-
+
cc_int32 possible_return_values[4] = {
- ccNoError,
- ccErrBadParam,
- ccErrInvalidCCache,
+ ccNoError,
+ ccErrBadParam,
+ ccErrInvalidCCache,
ccErrCCacheNotFound,
};
BEGIN_CHECK_ONCE(description);
-
+
#ifdef cc_ccache_move
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
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)
+ // 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) {
err = cc_ccache_new_credentials_iterator(destination, &cred_iterator);
}
@@ -1616,8 +1615,8 @@ cc_int32 check_once_cc_ccache_move(cc_ccache_t source, cc_ccache_t destination,
if (err == ccIteratorEnd) {
err = ccNoError;
}
- if (cred_iterator) {
- cc_credentials_iterator_release(cred_iterator);
+ if (cred_iterator) {
+ cc_credentials_iterator_release(cred_iterator);
cred_iterator = NULL;
}
@@ -1626,16 +1625,16 @@ cc_int32 check_once_cc_ccache_move(cc_ccache_t source, cc_ccache_t destination,
err = cc_ccache_get_principal(source, cc_credentials_v5, &src_principal);
}
}
-
-
+
+
if (!err) {
err = cc_ccache_move(source, destination);
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
-
+
+
if (!err) {
// verify all of destination's credentials are no longer there (save a list and call remove_cred for each, expecting an err in response)
i = 0;
@@ -1657,7 +1656,7 @@ cc_int32 check_once_cc_ccache_move(cc_ccache_t source, cc_ccache_t destination,
}
// verify that handles for source are no longer valid (get_change_time)
- if (src_principal) {
+ if (src_principal) {
cc_string_release(src_principal);
src_principal = NULL;
}
@@ -1665,16 +1664,16 @@ cc_int32 check_once_cc_ccache_move(cc_ccache_t source, cc_ccache_t destination,
err = cc_ccache_get_principal(source, cc_credentials_v5, &src_principal);
check_if(err != ccErrInvalidCCache, "source ccache was not invalidated after move");
}
-
-
+
+
if (cred_iterator) { cc_credentials_iterator_release(cred_iterator); }
if (src_principal) { cc_string_release(src_principal); }
if (dst_principal) { cc_string_release(dst_principal); }
-
+
#endif /* cc_ccache_move */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -1687,14 +1686,14 @@ int check_cc_ccache_compare(void) {
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
log_error("cc_ccache_compare is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
if (!err) {
@@ -1711,7 +1710,7 @@ int check_cc_ccache_compare(void) {
check_once_cc_ccache_compare(ccache_a, ccache_a, &equal, ccNoError, "compare ccache with same pointer");
equal = 1;
check_once_cc_ccache_compare(ccache_a, ccache_b, &equal, ccNoError, "compare different handles to same ccache");
-
+
if (ccache_b) {
cc_ccache_release(ccache_b);
ccache_b = NULL;
@@ -1726,40 +1725,40 @@ int check_cc_ccache_compare(void) {
if (ccache_a) { cc_ccache_release(ccache_a); }
if (ccache_b) { cc_ccache_release(ccache_b); }
-
- if (context) {
+
+ if (context) {
err = destroy_all_ccaches(context);
- cc_context_release(context);
+ cc_context_release(context);
}
-
+
#endif /* cc_ccache_compare */
-
+
END_TEST_AND_RETURN
}
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;
cc_uint32 actually_equal = 0;
-
+
cc_int32 possible_return_values[4] = {
- ccNoError,
- ccErrInvalidContext,
- ccErrBadParam,
+ ccNoError,
+ ccErrInvalidContext,
+ ccErrBadParam,
ccErrServerUnavailable,
};
BEGIN_CHECK_ONCE(description);
#ifdef cc_ccache_compare
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
if (equal) {
actually_equal = *equal;
- }
-
+ }
+
err = cc_ccache_compare(ccache, compare_to, equal);
-
+
if (!err && equal) {
if (actually_equal) {
check_if(actually_equal != *equal, "equal ccaches not considered equal");
@@ -1768,12 +1767,12 @@ cc_int32 check_once_cc_ccache_compare(cc_ccache_t ccache, cc_ccache_t compare_to
check_if(actually_equal != *equal, "non-equal ccaches considered equal");
}
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
#endif /* cc_ccache_compare */
-
+
return err;
}
@@ -1785,14 +1784,14 @@ int check_cc_ccache_get_kdc_time_offset(void) {
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
log_error("cc_ccache_get_kdc_time_offset is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
if (!err) {
@@ -1804,7 +1803,7 @@ int check_cc_ccache_get_kdc_time_offset(void) {
time_offset = 0;
check_once_cc_ccache_get_kdc_time_offset(ccache, cc_credentials_v5, &time_offset, ccErrTimeOffsetNotSet, "brand new ccache (offset not yet set)");
-
+
time_offset = 10;
if (!err) {
err = cc_ccache_set_kdc_time_offset(ccache, cc_credentials_v5, time_offset);
@@ -1821,58 +1820,58 @@ int check_cc_ccache_get_kdc_time_offset(void) {
if (!err) {
check_once_cc_ccache_get_kdc_time_offset(ccache, cc_credentials_v4, &time_offset, ccNoError, "asking for v4 offset when v4 and v5 are set");
}
-
+
check_once_cc_ccache_get_kdc_time_offset(ccache, cc_credentials_v5, NULL, ccErrBadParam, "NULL time_offset out param");
check_once_cc_ccache_get_kdc_time_offset(ccache, cc_credentials_v4_v5, &time_offset, ccErrBadCredentialsVersion, "v4_v5 creds_vers in param (invalid)");
if (ccache) { cc_ccache_release(ccache); }
-
- if (context) {
+
+ if (context) {
err = destroy_all_ccaches(context);
- cc_context_release(context);
+ cc_context_release(context);
}
-
+
#endif /* cc_ccache_get_kdc_time_offset */
-
+
END_TEST_AND_RETURN
}
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;
cc_time_t expected_offset;
-
+
cc_int32 possible_return_values[7] = {
- ccNoError,
- ccErrTimeOffsetNotSet,
- ccErrCCacheNotFound,
- ccErrInvalidCCache,
- ccErrBadParam,
- ccErrServerUnavailable,
- ccErrBadCredentialsVersion,
+ ccNoError,
+ ccErrTimeOffsetNotSet,
+ ccErrCCacheNotFound,
+ ccErrInvalidCCache,
+ ccErrBadParam,
+ ccErrServerUnavailable,
+ ccErrBadCredentialsVersion,
};
BEGIN_CHECK_ONCE(description);
#ifdef cc_ccache_get_kdc_time_offset
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
if (time_offset) {
expected_offset = *time_offset;
}
-
+
err = cc_ccache_get_kdc_time_offset(ccache, credentials_version, time_offset);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err && time_offset) {
check_if(*time_offset != expected_offset, "kdc time offset doesn't match expected value");
}
-
+
#endif /* cc_ccache_get_kdc_time_offset */
-
+
return err;
}
@@ -1883,14 +1882,14 @@ int check_cc_ccache_set_kdc_time_offset(void) {
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
log_error("cc_ccache_set_kdc_time_offset is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
if (!err) {
@@ -1902,55 +1901,55 @@ int check_cc_ccache_set_kdc_time_offset(void) {
check_once_cc_ccache_set_kdc_time_offset(ccache, cc_credentials_v5, 0, ccNoError, "first time setting offset (v5)");
check_once_cc_ccache_set_kdc_time_offset(ccache, cc_credentials_v4, 0, ccNoError, "first time setting offset (v4)");
-
+
check_once_cc_ccache_set_kdc_time_offset(ccache, cc_credentials_v4_v5, 0, ccErrBadCredentialsVersion, "invalid creds_vers (v4_v5)");
if (ccache) { cc_ccache_release(ccache); }
-
- if (context) {
+
+ if (context) {
err = destroy_all_ccaches(context);
- cc_context_release(context);
+ cc_context_release(context);
}
-
+
#endif /* cc_ccache_set_kdc_time_offset */
-
+
END_TEST_AND_RETURN
}
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;
cc_time_t stored_offset = 0;
-
+
cc_int32 possible_return_values[6] = {
- ccNoError,
- ccErrCCacheNotFound,
- ccErrInvalidCCache,
- ccErrBadParam,
- ccErrServerUnavailable,
+ ccNoError,
+ ccErrCCacheNotFound,
+ ccErrInvalidCCache,
+ ccErrBadParam,
+ 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])
-
+
err = cc_ccache_set_kdc_time_offset(ccache, credentials_version, time_offset);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
err = cc_ccache_get_kdc_time_offset(ccache, credentials_version, &stored_offset);
}
-
+
if (!err) {
check_if(time_offset != stored_offset, "kdc time offset doesn't match expected value");
}
-
+
#endif /* cc_ccache_set_kdc_time_offset */
-
+
return err;
}
@@ -1961,14 +1960,14 @@ int check_cc_ccache_clear_kdc_time_offset(void) {
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
log_error("cc_ccache_clear_kdc_time_offset is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
if (!err) {
@@ -1983,55 +1982,53 @@ int check_cc_ccache_clear_kdc_time_offset(void) {
err = cc_ccache_set_kdc_time_offset(ccache, cc_credentials_v5, 0);
err = cc_ccache_set_kdc_time_offset(ccache, cc_credentials_v4, 0);
-
+
check_once_cc_ccache_clear_kdc_time_offset(ccache, cc_credentials_v5, ccNoError, "clearing v5");
check_once_cc_ccache_clear_kdc_time_offset(ccache, cc_credentials_v4, ccNoError, "clearing v4");
-
+
check_once_cc_ccache_clear_kdc_time_offset(ccache, cc_credentials_v4_v5, ccErrBadCredentialsVersion, "bad in param creds vers (v4_v5)");
-
+
if (ccache) { cc_ccache_release(ccache); }
-
- if (context) {
+
+ if (context) {
err = destroy_all_ccaches(context);
- cc_context_release(context);
+ cc_context_release(context);
}
-
+
#endif /* cc_ccache_clear_kdc_time_offset */
-
+
END_TEST_AND_RETURN
}
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;
cc_time_t stored_offset = 0;
-
+
cc_int32 possible_return_values[6] = {
- ccNoError,
- ccErrCCacheNotFound,
- ccErrInvalidCCache,
- ccErrBadParam,
- ccErrServerUnavailable,
+ ccNoError,
+ ccErrCCacheNotFound,
+ ccErrInvalidCCache,
+ ccErrBadParam,
+ ccErrServerUnavailable,
ccErrBadCredentialsVersion,
};
BEGIN_CHECK_ONCE(description);
#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
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
err = cc_ccache_get_kdc_time_offset(ccache, credentials_version, &stored_offset);
check_if(err != ccErrTimeOffsetNotSet, "time offset not cleared");
}
-
+
#endif /* cc_ccache_clear_kdc_time_offset */
-
+
return err;
}
-
-
diff --git a/src/ccapi/test/test_ccapi_check.c b/src/ccapi/test/test_ccapi_check.c
index 8352adf..7f55b45 100644
--- a/src/ccapi/test/test_ccapi_check.c
+++ b/src/ccapi/test/test_ccapi_check.c
@@ -14,20 +14,20 @@ int _check_if(int expression, const char *file, int line, const char *expression
_log_error_v(file, line, format, ap);
va_end(ap);
}
-
+
if (current_test_activity) {
fprintf(stdout, " (%s)", current_test_activity);
}
}
-
- return (expression != 0);
+
+ return (expression != 0);
}
int array_contains_int(cc_int32 *array, int size, cc_int32 value) {
if (array != NULL && size > 0) {
int i = 0;
- while (i < size && array[i] != value) {
- i++;
+ while (i < size && array[i] != value) {
+ i++;
}
if (i < size) {
return 1;
diff --git a/src/ccapi/test/test_ccapi_check.h b/src/ccapi/test/test_ccapi_check.h
index c05a515..0a95348 100644
--- a/src/ccapi/test/test_ccapi_check.h
+++ b/src/ccapi/test/test_ccapi_check.h
@@ -7,21 +7,21 @@
#include "test_ccapi_globals.h"
int _check_if(int expression, const char *file, int line, const char *expression_string, const char *format, ...);
-
+
#define check_int(a, b) \
check_if(a != b, NULL)
/*
* if expression evaluates to true, check_if increments the failure_count and prints:
- *
+ *
* check_if(a!=a, NULL);
- * ==> "/path/to/file:line: a!=a"
- *
+ * ==> "/path/to/file:line: a!=a"
+ *
* check_if(a!=a, "This shouldn't be happening");
* ==> "/path/to/file:line: This shouldn't be happening"
- *
+ *
* check_if(a!=a, "This has happened %d times now", 3);
- * ==> "/path/to/file:line: This has happened 3 times now"
+ * ==> "/path/to/file:line: This has happened 3 times now"
*/
#define check_if(expression, format, ...) \
diff --git a/src/ccapi/test/test_ccapi_constants.c b/src/ccapi/test/test_ccapi_constants.c
index 10d07f0..9f2aecb 100644
--- a/src/ccapi/test/test_ccapi_constants.c
+++ b/src/ccapi/test/test_ccapi_constants.c
@@ -5,16 +5,16 @@
int check_constants(void) {
BEGIN_TEST("constants");
/* API versions */
-
+
check_int(ccapi_version_2, 2);
check_int(ccapi_version_3, 3);
check_int(ccapi_version_4, 4);
check_int(ccapi_version_5, 5);
check_int(ccapi_version_6, 6);
-
+
/* Errors */
-
- check_int(ccNoError , 0 ); // 0
+
+ check_int(ccNoError , 0 ); // 0
check_int(ccIteratorEnd , 201); // 201
check_int(ccErrBadParam , 202); // 202
check_int(ccErrNoMem , 203); // 203
@@ -45,7 +45,7 @@ int check_constants(void) {
check_int(ccErrNotImplemented , 228); // 228
/* Credentials versions */
-
+
check_int(cc_credentials_v4, 1);
check_int(cc_credentials_v5, 2);
check_int(cc_credentials_v4_v5, (cc_credentials_v4 | cc_credentials_v5));
@@ -58,9 +58,9 @@ int check_constants(void) {
check_int(cc_lock_downgrade, 3);
/* Locking Modes */
-
+
check_int(cc_lock_noblock, 0);
check_int(cc_lock_block, 1);
-
+
END_TEST_AND_RETURN
}
diff --git a/src/ccapi/test/test_ccapi_context.c b/src/ccapi/test/test_ccapi_context.c
index 5171453..09feebe 100644
--- a/src/ccapi/test/test_ccapi_context.c
+++ b/src/ccapi/test/test_ccapi_context.c
@@ -7,110 +7,110 @@
int check_cc_initialize(void) {
cc_int32 err = 0;
cc_context_t context = NULL;
-
+
BEGIN_TEST("cc_initialize");
-
+
// try every api_version
err = check_once_cc_initialize(&context, ccapi_version_2, NULL, NULL, ccNoError, "cc_initialize with ccapi_version_2"); // err == CC_BAD_API_VERSION (9) would be imported by CredentialsCache2.h
- 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"); // "
-
+ 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
-
+ err = check_once_cc_initialize(&context, INT_MAX, NULL, NULL, ccErrBadAPIVersion, NULL); // err == ccErrBadAPIVersion
+
// try bad param
- err = check_once_cc_initialize(NULL, ccapi_version_3, NULL, NULL, ccErrBadParam, NULL); // err == ccErrBadParam
-
+ err = check_once_cc_initialize(NULL, ccapi_version_3, NULL, NULL, ccErrBadParam, NULL); // err == ccErrBadParam
+
END_TEST_AND_RETURN
}
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) {
cc_int32 err = 0;
cc_context_t context;
-
+
cc_int32 possible_return_values[4] = {
- ccNoError,
- ccErrNoMem,
- ccErrBadAPIVersion,
+ ccNoError,
+ ccErrNoMem,
+ ccErrBadAPIVersion,
ccErrBadParam,
};
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_initialize(out_context, in_version, out_supported_version, out_vendor);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (out_context) { context = *out_context; }
else { context = NULL; }
-
+
// check output parameters
if (!err) {
check_if(context == NULL, NULL);
- if (context) {
- cc_context_release(context);
+ if (context) {
+ cc_context_release(context);
*out_context = NULL;
}
} else {
check_if(context != NULL, NULL);
}
-
+
return err;
}
int check_cc_context_release(void) {
cc_int32 err = 0;
cc_context_t context = NULL;
-
+
BEGIN_TEST("cc_context_release");
-
+
#ifndef cc_context_release
log_error("cc_context_release is not implemented yet");
failure_count++;
#else
-
+
// try with valid context
err = check_once_cc_context_release(&context, ccNoError, NULL);
-
+
// try with NULL
//err = check_once_cc_context_release(NULL, ccErrInvalidContext);
- /* calling with NULL context crashes, because this macro expands to
+ /* calling with NULL context crashes, because this macro expands to
((NULL) -> functions -> release (NULL)) which is dereferencing NULL which is bad. */
-
+
if (context) { cc_context_release(context); }
-
+
#endif /* cc_context_release */
-
+
END_TEST_AND_RETURN
}
cc_int32 check_once_cc_context_release(cc_context_t *out_context, cc_int32 expected_err, const char *description) {
cc_int32 err = 0;
cc_context_t context = NULL;
-
+
cc_int32 possible_return_values[2] = {
- ccNoError,
- ccErrInvalidContext,
+ ccNoError,
+ ccErrInvalidContext,
};
BEGIN_CHECK_ONCE(description);
-
+
#ifdef cc_context_release
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
if (out_context) {
err = cc_initialize(out_context, ccapi_version_3, NULL, NULL);
- if (!err) {
- context = *out_context;
+ if (!err) {
+ context = *out_context;
}
}
-
+
if (err != ccNoError) {
log_error("failure in cc_initialize, unable to perform check");
return err;
@@ -120,13 +120,13 @@ cc_int32 check_once_cc_context_release(cc_context_t *out_context, cc_int32 expec
// check returned error
check_err(err, expected_err, possible_return_values);
}
-
+
*out_context = NULL;
-
+
#endif /* cc_context_release */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -138,32 +138,32 @@ int check_cc_context_get_change_time(void) {
cc_credentials_union creds_union;
cc_credentials_iterator_t creds_iterator = NULL;
cc_credentials_t credentials = NULL;
-
+
BEGIN_TEST("cc_context_get_change_time");
-
+
#ifndef cc_context_get_change_time
log_error("cc_context_get_change_time is not implemented yet");
failure_count++;
#else
-
+
/*
* Make a context
* make sure the change time changes after:
- * a ccache is created
- * a ccache is destroyed
- * a credential is stored
- * a credential is removed
- * a ccache principal is changed
+ * a ccache is created
+ * a ccache is destroyed
+ * a credential is stored
+ * a credential is removed
+ * a ccache principal is changed
* the default ccache is changed
* clean up memory
*/
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
if (!err) {
-
+
// try bad parameters first
err = check_once_cc_context_get_change_time(context, NULL, ccErrBadParam, "NULL param, should fail");
-
+
// make sure we have a default ccache
err = cc_context_open_default_ccache(context, &ccache);
if (err == ccErrCCacheNotFound) {
@@ -175,11 +175,11 @@ int check_cc_context_get_change_time(void) {
// either the default ccache already existed or we just created it
// either way, the get_change_time should now give something > 0
check_once_cc_context_get_change_time(context, &last_change_time, ccNoError, "first-run, should be > 0");
-
+
// create a ccache
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
check_once_cc_context_get_change_time(context, &last_change_time, ccNoError, "after creating a new ccache");
-
+
// store a credential
if (!err) {
new_v5_creds_union(&creds_union, "BAR.ORG");
@@ -187,7 +187,7 @@ int check_cc_context_get_change_time(void) {
release_v5_creds_union(&creds_union);
}
check_once_cc_context_get_change_time(context, &last_change_time, ccNoError, "after storing a credential");
-
+
if (!err) {
// change principal (fails with ccErrBadInternalMessage)
err = cc_ccache_set_principal(ccache, cc_credentials_v5, "foo@BAR.ORG");
@@ -198,7 +198,7 @@ int check_cc_context_get_change_time(void) {
}
}
check_once_cc_context_get_change_time(context, &last_change_time, ccNoError, "after changing a principle");
-
+
// remove a credential
if (!err) {
err = cc_ccache_new_credentials_iterator(ccache, &creds_iterator);
@@ -212,25 +212,25 @@ int check_cc_context_get_change_time(void) {
if (!err) {
err = cc_ccache_remove_credentials(ccache, credentials);
}
- check_once_cc_context_get_change_time(context, &last_change_time, ccNoError, "after removing a credential");
-
+ check_once_cc_context_get_change_time(context, &last_change_time, ccNoError, "after removing a credential");
+
if (!err) {
// change default ccache
err = cc_ccache_set_default(ccache);
check_once_cc_context_get_change_time(context, &last_change_time, ccNoError, "after changing default ccache");
}
-
+
if (ccache) {
// destroy a ccache
err = cc_ccache_destroy(ccache);
check_once_cc_context_get_change_time(context, &last_change_time, ccNoError, "after destroying a ccache");
}
}
-
+
if (context) { cc_context_release(context); }
-
+
#endif /* cc_get_change_time */
-
+
END_TEST_AND_RETURN
}
@@ -238,37 +238,37 @@ cc_int32 check_once_cc_context_get_change_time(cc_context_t context, cc_time_t *
cc_int32 err = 0;
cc_time_t last_change_time;
cc_time_t current_change_time = 0;
-
+
cc_int32 possible_return_values[3] = {
- ccNoError,
- ccErrInvalidContext,
+ ccNoError,
+ ccErrInvalidContext,
ccErrBadParam,
};
BEGIN_CHECK_ONCE(description);
-
+
#ifdef cc_context_get_change_time
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
if (time != NULL) { // if we were passed NULL, then we're looking to pass a bad param
err = cc_context_get_change_time(context, &current_change_time);
} else {
err = cc_context_get_change_time(context, NULL);
}
-
+
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
last_change_time = *time;
check_if(current_change_time <= last_change_time, "context change time did not increase when it was supposed to (%d <= %d)", current_change_time, last_change_time);
*time = current_change_time;
}
-
+
#endif /* cc_context_get_change_time */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -277,19 +277,19 @@ int check_cc_context_get_default_ccache_name(void) {
cc_context_t context = NULL;
cc_ccache_t ccache = NULL;
cc_string_t name = NULL;
-
+
BEGIN_TEST("cc_context_get_default_ccache_name");
-
+
#ifndef cc_context_get_default_ccache_name
log_error("cc_context_get_default_ccache_name is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
- if (!err) {
+ if (!err) {
// try bad parameters first
err = check_once_cc_context_get_default_ccache_name(context, NULL, ccErrBadParam, NULL);
-
+
// try with no default
err = destroy_all_ccaches(context);
err = cc_context_open_default_ccache(context, &ccache);
@@ -297,54 +297,54 @@ int check_cc_context_get_default_ccache_name(void) {
log_error("didn't remove all ccaches");
}
err = check_once_cc_context_get_default_ccache_name(context, &name, ccNoError, NULL);
-
+
// try normally
err = cc_context_create_default_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
if (ccache) { cc_ccache_release(ccache); }
err = check_once_cc_context_get_default_ccache_name(context, &name, ccNoError, NULL);
-
+
}
-
+
if (context) { cc_context_release(context); }
-
+
#endif /* cc_context_get_default_ccache_name */
-
- END_TEST_AND_RETURN
+
+ END_TEST_AND_RETURN
}
cc_int32 check_once_cc_context_get_default_ccache_name(cc_context_t context, cc_string_t *name, cc_int32 expected_err, const char *description) {
cc_int32 err = 0;
-
+
cc_int32 possible_return_values[4] = {
- ccNoError,
- ccErrInvalidContext,
- ccErrBadParam,
- ccErrNoMem,
+ ccNoError,
+ ccErrInvalidContext,
+ ccErrBadParam,
+ ccErrNoMem,
};
BEGIN_CHECK_ONCE(description);
-
+
#ifdef cc_context_get_default_ccache_name
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
if (name != NULL) { // if we were passed NULL, then we're looking to pass a bad param
err = cc_context_get_default_ccache_name(context, name);
} else {
err = cc_context_get_default_ccache_name(context, NULL);
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
// not really anything else to check
-
+
if (name && *name) { cc_string_release(*name); }
-
+
#endif /* cc_context_get_default_ccache_name */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -353,16 +353,16 @@ int check_cc_context_open_ccache(void) {
cc_context_t context = NULL;
cc_ccache_t ccache = NULL;
cc_string_t name = NULL;
-
+
BEGIN_TEST("cc_context_open_ccache");
-
+
#ifndef cc_context_open_ccache
log_error("cc_context_open_ccache is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
- if (!err) {
+ if (!err) {
// make sure we have a default ccache
err = cc_context_open_default_ccache(context, &ccache);
if (err == ccErrCCacheNotFound) {
@@ -372,7 +372,7 @@ int check_cc_context_open_ccache(void) {
err = cc_ccache_release(ccache);
ccache = NULL;
}
-
+
// try default ccache
err = cc_context_get_default_ccache_name(context, &name);
if (!err) {
@@ -382,7 +382,7 @@ int check_cc_context_open_ccache(void) {
// try bad parameters
err = check_once_cc_context_open_ccache(context, NULL, &ccache, ccErrBadParam, NULL);
err = check_once_cc_context_open_ccache(context, name->data, NULL, ccErrBadParam, NULL);
-
+
// try a ccache that doesn't exist (create one and then destroy it)
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
if (!err) {
@@ -392,67 +392,67 @@ int check_cc_context_open_ccache(void) {
err = cc_ccache_destroy(ccache);
ccache = NULL;
}
-
+
err = check_once_cc_context_open_ccache(context, name->data, &ccache, ccErrCCacheNotFound, NULL);
}
-
+
if (context) { cc_context_release(context); }
-
+
#endif /* cc_context_open_ccache */
-
- END_TEST_AND_RETURN
+
+ END_TEST_AND_RETURN
}
cc_int32 check_once_cc_context_open_ccache(cc_context_t context, const char *name, cc_ccache_t *ccache, cc_int32 expected_err, const char *description) {
cc_int32 err = 0;
cc_string_t stored_name = NULL;
-
+
cc_int32 possible_return_values[6] = {
- ccNoError,
- ccErrBadName,
- ccErrInvalidContext,
- ccErrNoMem,
- ccErrCCacheNotFound,
- ccErrBadParam,
+ ccNoError,
+ ccErrBadName,
+ ccErrInvalidContext,
+ ccErrNoMem,
+ ccErrCCacheNotFound,
+ ccErrBadParam,
};
BEGIN_CHECK_ONCE(description);
-
+
#ifdef cc_context_open_ccache
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
if (ccache != NULL) { // if we were passed NULL, then we're looking to pass a bad param
err = cc_context_open_ccache(context, name, ccache);
} else {
err = cc_context_open_ccache(context, name, NULL);
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
check_if(*ccache == NULL, NULL);
-
+
if (!err) {
err = cc_ccache_get_name(*ccache, &stored_name);
}
- if (!err) {
- check_if(strcmp(stored_name->data, name), NULL);
+ if (!err) {
+ check_if(strcmp(stored_name->data, name), NULL);
}
if (stored_name) { cc_string_release(stored_name); }
-
-
+
+
if (ccache && *ccache) {
cc_ccache_release(*ccache);
*ccache = NULL;
}
}
-
+
#endif /* cc_context_open_ccache */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -460,38 +460,38 @@ int check_cc_context_open_default_ccache(void) {
cc_int32 err = 0;
cc_context_t context = NULL;
cc_ccache_t ccache = NULL;
-
+
BEGIN_TEST("cc_context_open_default_ccache");
-
+
#ifndef cc_context_open_default_ccache
log_error("cc_context_open_default_ccache is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
- if (!err) {
+ if (!err) {
// make sure we have a default ccache
err = cc_context_create_default_ccache(context, cc_credentials_v5, "foo/bar@BAZ.ORG", &ccache);
if (ccache) { cc_ccache_release(ccache); }
-
+
// try default ccache
if (!err) {
err = check_once_cc_context_open_default_ccache(context, &ccache, ccNoError, NULL);
}
-
+
// try bad parameters
err = check_once_cc_context_open_default_ccache(context, NULL, ccErrBadParam, NULL);
-
+
// try with no default ccache (destroy all ccaches first)
err = destroy_all_ccaches(context);
-
+
err = check_once_cc_context_open_default_ccache(context, &ccache, ccErrCCacheNotFound, NULL);
}
-
+
if (context) { cc_context_release(context); }
-
+
#endif /* cc_context_open_default_ccache */
-
+
END_TEST_AND_RETURN
}
@@ -499,33 +499,33 @@ cc_int32 check_once_cc_context_open_default_ccache(cc_context_t context, cc_ccac
cc_int32 err = 0;
cc_string_t given_name = NULL;
cc_string_t default_name = NULL;
-
+
cc_int32 possible_return_values[5] = {
- ccNoError,
- ccErrInvalidContext,
- ccErrNoMem,
- ccErrCCacheNotFound,
- ccErrBadParam,
+ ccNoError,
+ ccErrInvalidContext,
+ ccErrNoMem,
+ ccErrCCacheNotFound,
+ ccErrBadParam,
};
BEGIN_CHECK_ONCE(description);
-
+
#ifdef cc_context_open_default_ccache
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
if (ccache != NULL) { // if we were passed NULL, then we're looking to pass a bad param
err = cc_context_open_default_ccache(context, ccache);
} else {
err = cc_context_open_default_ccache(context, NULL);
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
check_if(*ccache == NULL, NULL);
-
+
// make sure this ccache is the one we were looking to get back (compare name with cc_context_get_default_ccache_name)
err = cc_ccache_get_name(*ccache, &given_name);
err = cc_context_get_default_ccache_name(context, &default_name);
@@ -534,17 +534,17 @@ cc_int32 check_once_cc_context_open_default_ccache(cc_context_t context, cc_ccac
}
if (given_name) { cc_string_release(given_name); }
if (default_name) { cc_string_release(default_name); }
-
+
if (ccache && *ccache) {
cc_ccache_release(*ccache);
*ccache = NULL;
}
}
-
+
#endif /* cc_context_open_default_ccache */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -553,16 +553,16 @@ int check_cc_context_create_ccache(void) {
cc_context_t context = NULL;
cc_ccache_t ccache = NULL;
cc_string_t name = NULL;
-
+
BEGIN_TEST("cc_context_create_ccache");
-
+
#ifndef cc_context_create_ccache
log_error("cc_context_create_ccache is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
- if (!err) {
+ if (!err) {
// try making a ccache with a non-unique name (the existing default's name)
if (!err) {
err = cc_context_create_default_ccache(context, cc_credentials_v5, "foo/bar@BAZ.ORG", &ccache);
@@ -574,26 +574,26 @@ int check_cc_context_create_ccache(void) {
if (!err) {
err = check_once_cc_context_create_ccache(context, name->data, cc_credentials_v5, "foo@BAR.ORG", &ccache, ccNoError, NULL);
}
-
+
// try making a ccache with a unique name (the now destroyed default's name)
if (ccache) { cc_ccache_destroy(ccache); }
if (!err) {
err = check_once_cc_context_create_ccache(context, name->data, cc_credentials_v5, "foo/baz@BAR.ORG", &ccache, ccNoError, NULL);
}
-
+
// try bad parameters
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
}
-
+
if (name) { cc_string_release(name); }
if (ccache) { cc_ccache_destroy(ccache); }
if (context) { cc_context_release(context); }
-
+
#endif /* cc_context_create_ccache */
-
+
END_TEST_AND_RETURN
}
@@ -604,27 +604,27 @@ cc_int32 check_once_cc_context_create_ccache(cc_context_t context, const char *n
cc_uint32 stored_creds_vers = 0;
cc_int32 possible_return_values[6] = {
- ccNoError,
- ccErrBadName,
- ccErrBadParam,
- ccErrInvalidContext,
- ccErrNoMem,
- ccErrBadCredentialsVersion,
+ ccNoError,
+ ccErrBadName,
+ ccErrBadParam,
+ ccErrInvalidContext,
+ ccErrNoMem,
+ ccErrBadCredentialsVersion,
};
BEGIN_CHECK_ONCE(description);
-
+
#ifdef cc_context_create_ccache
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_context_create_ccache(context, name, cred_vers, principal, ccache);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
check_if(*ccache == NULL, NULL);
-
+
// make sure all of the ccache's info matches what we gave it
// name
err = cc_ccache_get_name(*ccache, &stored_name);
@@ -639,17 +639,17 @@ cc_int32 check_once_cc_context_create_ccache(cc_context_t context, const char *n
err = cc_ccache_get_principal(*ccache, cc_credentials_v5, &stored_principal);
if (!err) { check_if(strcmp(stored_principal->data, principal), NULL); }
if (stored_principal) { cc_string_release(stored_principal); }
-
+
if (ccache && *ccache) {
cc_ccache_destroy(*ccache);
*ccache = NULL;
}
}
-
+
#endif /* cc_context_create_ccache */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -658,41 +658,41 @@ int check_cc_context_create_default_ccache(void) {
cc_context_t context = NULL;
cc_ccache_t ccache = NULL;
cc_string_t name = NULL;
-
+
BEGIN_TEST("cc_context_create_default_ccache");
-
+
#ifndef cc_context_create_default_ccache
log_error("cc_context_create_default_ccache is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
- if (!err) {
+ if (!err) {
// try making the default when there are no existing ccaches
err = destroy_all_ccaches(context);
if (!err) {
err = check_once_cc_context_create_default_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache, ccNoError, NULL);
}
if (ccache) { cc_ccache_release(ccache); }
-
+
// try making a new default when one already exists
if (!err) {
err = check_once_cc_context_create_default_ccache(context, cc_credentials_v5, "foo/baz@BAR.ORG", &ccache, ccNoError, NULL);
}
-
+
// try bad parameters
err = check_once_cc_context_create_default_ccache(context, cc_credentials_v4_v5, "foo@BAR.ORG", &ccache, ccErrBadCredentialsVersion, "invalid creds_vers"); // invalid creds_vers
err = check_once_cc_context_create_default_ccache(context, cc_credentials_v5, NULL, &ccache, ccErrBadParam, "NULL principal"); // NULL principal
err = check_once_cc_context_create_default_ccache(context, cc_credentials_v5, "foo@BAR.ORG", NULL, ccErrBadParam, "NULL ccache"); // NULL ccache
}
-
+
if (name) { cc_string_release(name); }
if (ccache) { cc_ccache_destroy(ccache); }
if (context) { cc_context_release(context); }
-
+
#endif /* cc_context_create_default_ccache */
-
- END_TEST_AND_RETURN
+
+ END_TEST_AND_RETURN
}
cc_int32 check_once_cc_context_create_default_ccache(cc_context_t context, cc_uint32 cred_vers, const char *principal, cc_ccache_t *ccache, cc_int32 expected_err, const char *description) {
@@ -701,25 +701,25 @@ cc_int32 check_once_cc_context_create_default_ccache(cc_context_t context, cc_ui
cc_uint32 stored_creds_vers = 0;
cc_int32 possible_return_values[6] = {
- ccNoError,
+ ccNoError,
ccErrBadName, // how can this be possible when the name isn't a parameter?
- ccErrBadParam,
- ccErrInvalidContext,
- ccErrNoMem,
- ccErrBadCredentialsVersion,
+ ccErrBadParam,
+ ccErrInvalidContext,
+ ccErrNoMem,
+ ccErrBadCredentialsVersion,
};
BEGIN_CHECK_ONCE(description);
-
+
#ifdef cc_context_create_default_ccache
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_context_create_default_ccache(context, cred_vers, principal, ccache);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
if (ccache) { check_if(*ccache == NULL, NULL); }
// make sure all of the ccache's info matches what we gave it
@@ -730,17 +730,17 @@ cc_int32 check_once_cc_context_create_default_ccache(cc_context_t context, cc_ui
err = cc_ccache_get_principal(*ccache, cc_credentials_v5, &stored_principal);
if (!err) { check_if(strcmp(stored_principal->data, principal), NULL); }
if (stored_principal) { cc_string_release(stored_principal); }
-
+
if (ccache && *ccache) {
cc_ccache_release(*ccache);
*ccache = NULL;
}
}
-
+
#endif /* cc_context_create_default_ccache */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -749,41 +749,41 @@ int check_cc_context_create_new_ccache(void) {
cc_context_t context = NULL;
cc_ccache_t ccache = NULL;
cc_string_t name = NULL;
-
+
BEGIN_TEST("cc_context_create_new_ccache");
-
+
#ifndef cc_context_create_new_ccache
log_error("cc_context_create_new_ccache is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
- if (!err) {
+ if (!err) {
// try making when there are no existing ccaches (should have name of default)
err = destroy_all_ccaches(context);
if (!err) {
err = check_once_cc_context_create_new_ccache(context, 1, cc_credentials_v5, "foo@BAR.ORG", &ccache, ccNoError, NULL);
}
if (ccache) { cc_ccache_release(ccache); }
-
+
// try making a new ccache when one already exists (should not have name of default)
if (!err) {
err = check_once_cc_context_create_new_ccache(context, 0, cc_credentials_v5, "foo/baz@BAR.ORG", &ccache, ccNoError, NULL);
}
if (ccache) { cc_ccache_release(ccache); }
-
+
// try bad parameters
err = check_once_cc_context_create_new_ccache(context, 1, cc_credentials_v4_v5, "foo@BAR.ORG", &ccache, ccErrBadCredentialsVersion, "invalid creds_vers"); // invalid creds_vers
err = check_once_cc_context_create_new_ccache(context, 1, cc_credentials_v5, NULL, &ccache, ccErrBadParam, "NULL principal"); // NULL principal
err = check_once_cc_context_create_new_ccache(context, 1, cc_credentials_v5, "foo@BAR.ORG", NULL, ccErrBadParam, "NULL ccache"); // NULL ccache
}
-
+
if (name) { cc_string_release(name); }
if (ccache) { cc_ccache_destroy(ccache); }
if (context) { cc_context_release(context); }
-
+
#endif /* cc_context_create_new_ccache */
-
+
END_TEST_AND_RETURN
}
@@ -793,27 +793,27 @@ cc_int32 check_once_cc_context_create_new_ccache(cc_context_t context, cc_int32
cc_string_t stored_name = NULL;
cc_string_t stored_principal = NULL;
cc_uint32 stored_creds_vers = 0;
-
+
cc_int32 possible_return_values[6] = {
- ccNoError,
+ ccNoError,
ccErrBadName, // how can this be possible when the name isn't a parameter?
- ccErrBadParam,
- ccErrInvalidContext,
- ccErrNoMem,
- ccErrBadCredentialsVersion,
+ ccErrBadParam,
+ ccErrInvalidContext,
+ ccErrNoMem,
+ ccErrBadCredentialsVersion,
};
BEGIN_CHECK_ONCE(description);
-
+
#ifdef cc_context_create_new_ccache
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_context_create_new_ccache(context, cred_vers, principal, ccache);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
if (ccache) { check_if(*ccache == NULL, NULL); }
// make sure all of the ccache's info matches what we gave it
@@ -823,17 +823,17 @@ cc_int32 check_once_cc_context_create_new_ccache(cc_context_t context, cc_int32
if (!err) {
err = cc_ccache_get_name(*ccache, &stored_name);
}
- if (!err) {
+ if (!err) {
if (should_be_default) {
- check_if(strcmp(stored_name->data, name->data), "new ccache does not have name of default");
+ check_if(strcmp(stored_name->data, name->data), "new ccache does not have name of default");
}
else {
- check_if((strcmp(stored_name->data, name->data) == 0), "new cache has name of default");
- }
+ check_if((strcmp(stored_name->data, name->data) == 0), "new cache has name of default");
+ }
}
if (name) { cc_string_release(name); }
if (stored_name) { cc_string_release(stored_name); }
-
+
// cred_vers
err = cc_ccache_get_credentials_version(*ccache, &stored_creds_vers);
if (!err) { check_if(stored_creds_vers != cred_vers, NULL); }
@@ -841,17 +841,17 @@ cc_int32 check_once_cc_context_create_new_ccache(cc_context_t context, cc_int32
err = cc_ccache_get_principal(*ccache, cc_credentials_v5, &stored_principal);
if (!err) { check_if(strcmp(stored_principal->data, principal), NULL); }
if (stored_principal) { cc_string_release(stored_principal); }
-
+
if (ccache && *ccache) {
cc_ccache_release(*ccache);
*ccache = NULL;
}
}
-
+
#endif /* cc_context_create_new_ccache */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -861,39 +861,39 @@ int check_cc_context_new_ccache_iterator(void) {
cc_ccache_t ccache = NULL;
cc_string_t name = NULL;
cc_ccache_iterator_t iterator = NULL;
-
+
BEGIN_TEST("cc_context_new_ccache_iterator");
-
+
#ifndef cc_context_new_ccache_iterator
log_error("cc_context_new_ccache_iterator is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
- if (!err) {
+ if (!err) {
err = destroy_all_ccaches(context);
}
- if (!err) {
+ if (!err) {
// try making when there are no existing ccaches (shouldn't make a difference, but just in case)
check_once_cc_context_new_ccache_iterator(context, &iterator, ccNoError, "when there are no existing ccaches");
-
+
err = cc_context_create_default_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
}
- if (!err) {
+ if (!err) {
// try making when at least one ccache already exists (just to cover all our bases)
check_once_cc_context_new_ccache_iterator(context, &iterator, ccNoError, "when at least one ccache already exists");
-
+
// try bad parameters
check_once_cc_context_new_ccache_iterator(context, NULL, ccErrBadParam, "NULL param"); // NULL iterator
}
// we'll do a comprehensive test of cc_ccache_iterator related functions later in the test suite
-
+
if (name) { cc_string_release(name); }
if (ccache) { cc_ccache_destroy(ccache); }
if (context) { cc_context_release(context); }
-
+
#endif /* cc_context_new_ccache_iterator */
-
+
END_TEST_AND_RETURN
}
@@ -901,27 +901,27 @@ cc_int32 check_once_cc_context_new_ccache_iterator(cc_context_t context, cc_ccac
cc_int32 err = ccNoError;
cc_int32 possible_return_values[4] = {
- ccNoError,
- ccErrBadParam,
- ccErrNoMem,
- ccErrInvalidContext,
+ ccNoError,
+ ccErrBadParam,
+ ccErrNoMem,
+ ccErrInvalidContext,
};
BEGIN_CHECK_ONCE(description);
#ifdef cc_context_create_new_ccache
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_context_new_ccache_iterator(context, iterator);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
// we'll do a comprehensive test of cc_ccache_iterator related functions later
-
+
#endif /* cc_context_create_new_ccache */
-
+
return err;
}
@@ -933,14 +933,14 @@ int check_cc_context_compare(void) {
cc_context_t context_a = NULL;
cc_context_t context_b = NULL;
cc_uint32 equal = 0;
-
+
BEGIN_TEST("cc_context_compare");
-
+
#ifndef cc_context_compare
log_error("cc_context_compare is not implemented yet");
failure_count++;
#else
-
+
err = cc_initialize(&context_a, ccapi_version_3, NULL, NULL);
if (!err) {
err = cc_initialize(&context_b, ccapi_version_3, NULL, NULL);
@@ -953,9 +953,9 @@ int check_cc_context_compare(void) {
if (context_a) { cc_context_release(context_a); }
if (context_b) { cc_context_release(context_b); }
-
+
#endif /* cc_context_compare */
-
+
END_TEST_AND_RETURN
}
@@ -963,28 +963,28 @@ cc_int32 check_once_cc_context_compare(cc_context_t context, cc_context_t compar
cc_int32 err = ccNoError;
cc_int32 possible_return_values[4] = {
- ccNoError,
- ccErrInvalidContext,
- ccErrBadParam,
+ ccNoError,
+ ccErrInvalidContext,
+ ccErrBadParam,
ccErrServerUnavailable,
};
BEGIN_CHECK_ONCE(description);
#ifdef cc_context_compare
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_context_compare(context, compare_to, equal);
-
+
if (!err) {
*equal = 0;
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
#endif /* cc_context_compare */
-
+
return err;
}
diff --git a/src/ccapi/test/test_ccapi_globals.c b/src/ccapi/test/test_ccapi_globals.c
index f9aadbd..a4ea631 100644
--- a/src/ccapi/test/test_ccapi_globals.c
+++ b/src/ccapi/test/test_ccapi_globals.c
@@ -8,7 +8,7 @@ const char *current_test_name;
const char *current_test_activity;
const char * ccapi_error_strings[30] = {
-
+
"ccNoError", /* 0 */
"ccIteratorEnd", /* 201 */
"ccErrBadParam",
@@ -39,15 +39,15 @@ const char * ccapi_error_strings[30] = {
"ccErrServerUnavailable",
"ccErrServerInsecure",
"ccErrServerCantBecomeUID",
-
+
"ccErrTimeOffsetNotSet", /* 226 */
"ccErrBadInternalMessage",
"ccErrNotImplemented",
-
+
};
const char * ccapiv2_error_strings[24] = {
-
+
"CC_NOERROR",
"CC_BADNAME",
"CC_NOTFOUND",
@@ -65,23 +65,23 @@ const char * ccapiv2_error_strings[24] = {
"CC_ERR_CACHE_RELEASE",
"CC_ERR_CACHE_FULL",
"CC_ERR_CRED_VERSION"
-
+
};
const char *translate_ccapi_error(cc_int32 err) {
-
+
if (err == 0) {
return ccapi_error_strings[0];
- } else
+ } else
if (err >= 0 && err <= 16){
return ccapiv2_error_strings[err];
- } else
+ } else
if (err >= 201 && err <= 228){
return ccapi_error_strings[err - 200];
}
else {
return "\"Invalid or private CCAPI error\"";
}
-
+
return "";
}
diff --git a/src/ccapi/test/test_ccapi_iterators.c b/src/ccapi/test/test_ccapi_iterators.c
index c3254fb..e51c7cf 100644
--- a/src/ccapi/test/test_ccapi_iterators.c
+++ b/src/ccapi/test/test_ccapi_iterators.c
@@ -13,13 +13,13 @@ int check_cc_ccache_iterator_next(void) {
unsigned int i;
BEGIN_TEST("cc_ccache_iterator_next");
-
+
err = cc_initialize(&context, ccapi_version_3, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches(context);
}
-
+
// iterate with no ccaches
if (!err) {
err = cc_context_new_ccache_iterator(context, &iterator);
@@ -29,7 +29,7 @@ int check_cc_ccache_iterator_next(void) {
cc_ccache_iterator_release(iterator);
iterator = NULL;
}
-
+
// iterate with one ccache
if (!err) {
destroy_all_ccaches(context);
@@ -47,14 +47,14 @@ int check_cc_ccache_iterator_next(void) {
cc_ccache_iterator_release(iterator);
iterator = NULL;
}
-
+
// iterate with several ccaches
if (!err) {
destroy_all_ccaches(context);
}
for(i = 0; !err && (i < 1000); i++)
{
- if (i%100 == 0) fprintf(stdout, ".");
+ if (i%100 == 0) fprintf(stdout, ".");
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
if (ccache) {
cc_ccache_release(ccache);
@@ -69,15 +69,15 @@ int check_cc_ccache_iterator_next(void) {
cc_ccache_iterator_release(iterator);
iterator = NULL;
}
-
+
if (ccache) { cc_ccache_release(ccache); }
if (iterator) { cc_ccache_iterator_release(iterator); }
- if (context) {
+ if (context) {
destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
END_TEST_AND_RETURN
}
@@ -87,11 +87,11 @@ cc_int32 check_once_cc_ccache_iterator_next(cc_ccache_iterator_t iterator, cc_ui
// BEGIN_CHECK_ONCE(description);
cc_int32 possible_return_values[6] = {
- ccNoError,
- ccIteratorEnd,
- ccErrBadParam,
- ccErrNoMem,
- ccErrInvalidCCacheIterator,
+ ccNoError,
+ ccIteratorEnd,
+ ccErrBadParam,
+ ccErrNoMem,
+ ccErrInvalidCCacheIterator,
ccErrCCacheNotFound,
};
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
@@ -110,15 +110,15 @@ cc_int32 check_once_cc_ccache_iterator_next(cc_ccache_iterator_t iterator, cc_ui
if (err == ccIteratorEnd) {
err = ccNoError;
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
check_if(actual_count != expected_count, "iterator didn't iterate over all ccaches");
// END_CHECK_ONCE;
- return err;
+ return err;
}
@@ -131,15 +131,15 @@ int check_cc_credentials_iterator_next(void) {
cc_credentials_union creds_union;
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) {
err = destroy_all_ccaches(context);
}
-
+
// iterate with no creds
if (!err) {
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
@@ -156,7 +156,7 @@ int check_cc_credentials_iterator_next(void) {
cc_ccache_release(ccache);
ccache = NULL;
}
-
+
// iterate with one cred
if (!err) {
destroy_all_ccaches(context);
@@ -179,14 +179,14 @@ int check_cc_credentials_iterator_next(void) {
cc_ccache_release(ccache);
ccache = NULL;
}
-
+
// iterate with several creds
if (!err) {
destroy_all_ccaches(context);
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
}
for(i = 0; !err && (i < 1000); i++) {
- if (i%100 == 0) fprintf(stdout, ".");
+ if (i%100 == 0) fprintf(stdout, ".");
new_v5_creds_union(&creds_union, "BAR.ORG");
err = cc_ccache_store_credentials(ccache, &creds_union);
release_v5_creds_union(&creds_union);
@@ -194,15 +194,15 @@ int check_cc_credentials_iterator_next(void) {
if (!err) {
err = cc_ccache_new_credentials_iterator(ccache, &iterator);
}
- check_once_cc_credentials_iterator_next(iterator, 1000, ccNoError, "iterating over a ccache with 1000 creds");
+ check_once_cc_credentials_iterator_next(iterator, 1000, ccNoError, "iterating over a ccache with 1000 creds");
if (ccache) { cc_ccache_release(ccache); }
if (iterator) { cc_credentials_iterator_release(iterator); }
- if (context) {
+ if (context) {
destroy_all_ccaches(context);
cc_context_release(context);
}
-
+
END_TEST_AND_RETURN
}
@@ -212,10 +212,10 @@ cc_int32 check_once_cc_credentials_iterator_next(cc_credentials_iterator_t itera
cc_uint32 actual_count = 0;
cc_int32 possible_return_values[5] = {
- ccNoError,
- ccIteratorEnd,
- ccErrBadParam,
- ccErrNoMem,
+ ccNoError,
+ ccIteratorEnd,
+ ccErrBadParam,
+ ccErrNoMem,
ccErrInvalidCredentialsIterator,
};
@@ -234,13 +234,13 @@ cc_int32 check_once_cc_credentials_iterator_next(cc_credentials_iterator_t itera
if (err == ccIteratorEnd) {
err = ccNoError;
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
check_if(actual_count != expected_count, "iterator didn't iterate over all ccaches");
END_CHECK_ONCE;
- return err;
+ return err;
}
diff --git a/src/ccapi/test/test_ccapi_log.c b/src/ccapi/test/test_ccapi_log.c
index 348d55c..8ecb693 100644
--- a/src/ccapi/test/test_ccapi_log.c
+++ b/src/ccapi/test/test_ccapi_log.c
@@ -15,7 +15,7 @@ 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, ...)
-{
+{
va_list ap;
va_start(ap, format);
_log_error_v(file, line, format, ap);
@@ -36,7 +36,7 @@ void test_footer(const char *msg, int err) {
}
else {
fprintf(stdout, "\n*** %d failure%s in %s ***\n", err, (err == 1) ? "" : "s", msg);
- }
+ }
}
}
diff --git a/src/ccapi/test/test_ccapi_util.c b/src/ccapi/test/test_ccapi_util.c
index 1f66c99..9af1a6b 100644
--- a/src/ccapi/test/test_ccapi_util.c
+++ b/src/ccapi/test/test_ccapi_util.c
@@ -14,7 +14,7 @@
cc_int32 destroy_all_ccaches(cc_context_t context) {
cc_int32 err = ccNoError;
cc_ccache_t ccache = NULL;
-
+
while (!err) {
err = cc_context_open_default_ccache(context, &ccache);
if (!err) {
@@ -42,9 +42,9 @@ cc_int32 new_v5_creds_union (cc_credentials_union *out_union, const char *realm)
static int num_runs = 1;
char *client = NULL;
char *server = NULL;
-
+
if (!out_union) { err = ccErrBadParam; }
-
+
if (!err) {
v5creds = malloc (sizeof (*v5creds));
if (!v5creds) {
@@ -81,22 +81,22 @@ cc_int32 new_v5_creds_union (cc_credentials_union *out_union, const char *realm)
v5creds->second_ticket.data = NULL;
v5creds->authdata = NULL;
}
-
-
+
+
if (!err) {
cred_union = malloc (sizeof (*cred_union));
- if (cred_union) {
+ if (cred_union) {
cred_union->version = cc_credentials_v5;
cred_union->credentials.credentials_v5 = v5creds;
- } else {
- err = ccErrNoMem;
+ } else {
+ err = ccErrNoMem;
}
}
if (!err) {
*out_union = *cred_union;
cred_union = NULL;
}
-
+
return err;
}
@@ -105,7 +105,7 @@ cc_int32 new_v5_creds_union (cc_credentials_union *out_union, const char *realm)
void release_v5_creds_union(cc_credentials_union *creds_union) {
cc_credentials_v5_t *v5creds = NULL;
-
+
if (creds_union) {
if (creds_union->credentials.credentials_v5) {
v5creds = creds_union->credentials.credentials_v5;
@@ -115,7 +115,7 @@ void release_v5_creds_union(cc_credentials_union *creds_union) {
if (v5creds->ticket.data) { free(v5creds->ticket.data); }
if (v5creds->second_ticket.data) { free(v5creds->second_ticket.data); }
free(v5creds);
- }
+ }
//free(creds_union);
}
}
@@ -127,16 +127,16 @@ void release_v5_creds_union(cc_credentials_union *creds_union) {
int compare_v5_creds_unions(const cc_credentials_union *a, const cc_credentials_union *b) {
int retval = -1;
-
- if (a &&
+
+ if (a &&
b &&
(a->version == cc_credentials_v5) &&
- (a->version == b->version) &&
- (strcmp(a->credentials.credentials_v5->client, b->credentials.credentials_v5->client) == 0) &&
- (strcmp(a->credentials.credentials_v5->server, b->credentials.credentials_v5->server) == 0))
+ (a->version == b->version) &&
+ (strcmp(a->credentials.credentials_v5->client, b->credentials.credentials_v5->client) == 0) &&
+ (strcmp(a->credentials.credentials_v5->server, b->credentials.credentials_v5->server) == 0))
{
retval = 0;
}
-
+
return retval;
}
diff --git a/src/ccapi/test/test_ccapi_v2.c b/src/ccapi/test/test_ccapi_v2.c
index 054d216..9d9a7a5 100644
--- a/src/ccapi/test/test_ccapi_v2.c
+++ b/src/ccapi/test/test_ccapi_v2.c
@@ -12,23 +12,23 @@ static cc_result destroy_all_ccaches_v2(apiCB *context) {
cc_result err = CC_NOERROR;
infoNC **info = NULL;
int i = 0;
-
+
err = cc_get_NC_info(context, &info);
-
+
for (i = 0; !err && info[i]; i++) {
ccache_p *ccache = NULL;
-
+
err = cc_open(context, info[i]->name, info[i]->vers, 0, &ccache);
-
+
if (!err) { cc_destroy(context, &ccache); }
}
-
+
if (info) { cc_free_NC_info(context, &info); }
-
+
if (err) {
log_error("cc_get_NC_info or cc_open failed with %s (%d)", translate_ccapi_error(err), err);
}
-
+
return err;
}
@@ -37,31 +37,31 @@ static cc_result destroy_all_ccaches_v2(apiCB *context) {
static int compare_v5_creds_unions_compat(const cred_union *a, const cred_union *b) {
int retval = -1;
-
+
if (a && b && a->cred_type == b->cred_type) {
if (a->cred_type == CC_CRED_V5) {
- if (!strcmp(a->cred.pV5Cred->client, b->cred.pV5Cred->client) &&
+ if (!strcmp(a->cred.pV5Cred->client, b->cred.pV5Cred->client) &&
!strcmp(a->cred.pV5Cred->server, b->cred.pV5Cred->server) &&
a->cred.pV5Cred->starttime == b->cred.pV5Cred->starttime) {
retval = 0;
}
} else if (a->cred_type == CC_CRED_V4) {
- if (!strcmp (a->cred.pV4Cred->principal,
+ if (!strcmp (a->cred.pV4Cred->principal,
b->cred.pV4Cred->principal) &&
- !strcmp (a->cred.pV4Cred->principal_instance,
+ !strcmp (a->cred.pV4Cred->principal_instance,
b->cred.pV4Cred->principal_instance) &&
- !strcmp (a->cred.pV4Cred->service,
+ !strcmp (a->cred.pV4Cred->service,
b->cred.pV4Cred->service) &&
- !strcmp (a->cred.pV4Cred->service_instance,
+ !strcmp (a->cred.pV4Cred->service_instance,
b->cred.pV4Cred->service_instance) &&
- !strcmp (a->cred.pV4Cred->realm,
+ !strcmp (a->cred.pV4Cred->realm,
b->cred.pV4Cred->realm) &&
a->cred.pV4Cred->issue_date == b->cred.pV4Cred->issue_date) {
retval = 0;
- }
+ }
}
}
-
+
return retval;
}
@@ -75,16 +75,16 @@ static cc_result new_v5_creds_union_compat (cred_union *out_union, const char *r
static int num_runs = 1;
char *client = NULL;
char *server = NULL;
-
+
if (!out_union) { err = CC_BAD_PARM; }
-
+
if (!err) {
v5creds = malloc (sizeof (*v5creds));
if (!v5creds) {
err = CC_NOMEM;
}
}
-
+
if (!err) {
asprintf(&client, "client@%s", realm);
asprintf(&server, "host/%d%s@%s", num_runs++, realm, realm);
@@ -92,7 +92,7 @@ static cc_result new_v5_creds_union_compat (cred_union *out_union, const char *r
err = CC_NOMEM;
}
}
-
+
if (!err) {
v5creds->client = client;
v5creds->server = server;
@@ -114,22 +114,22 @@ static cc_result new_v5_creds_union_compat (cred_union *out_union, const char *r
v5creds->second_ticket.data = NULL;
v5creds->authdata = NULL;
}
-
-
+
+
if (!err) {
creds_union = malloc (sizeof (*creds_union));
- if (creds_union) {
+ if (creds_union) {
creds_union->cred_type = CC_CRED_V5;
creds_union->cred.pV5Cred = v5creds;
- } else {
- err = CC_NOMEM;
+ } else {
+ err = CC_NOMEM;
}
}
if (!err) {
*out_union = *creds_union;
creds_union = NULL;
}
-
+
return err;
}
@@ -137,7 +137,7 @@ static cc_result new_v5_creds_union_compat (cred_union *out_union, const char *r
static void release_v5_creds_union_compat(cred_union *creds_union) {
cc_credentials_v5_compat *v5creds = NULL;
-
+
if (creds_union) {
if (creds_union->cred.pV5Cred) {
v5creds = creds_union->cred.pV5Cred;
@@ -147,7 +147,7 @@ static void release_v5_creds_union_compat(cred_union *creds_union) {
if (v5creds->ticket.data) { free(v5creds->ticket.data); }
if (v5creds->second_ticket.data) { free(v5creds->second_ticket.data); }
free(v5creds);
- }
+ }
}
}
@@ -156,56 +156,56 @@ static void release_v5_creds_union_compat(cred_union *creds_union) {
int check_cc_shutdown(void) {
cc_result err = 0;
apiCB *context = NULL;
-
+
BEGIN_TEST("cc_shutdown");
-
+
// try with valid context
err = check_once_cc_shutdown(&context, CC_NOERROR, NULL);
-
+
// try with NULL
err = check_once_cc_shutdown(NULL, CC_BAD_PARM, NULL);
-
+
if (context) { cc_shutdown(&context); }
-
+
END_TEST_AND_RETURN
}
cc_result check_once_cc_shutdown(apiCB **out_context, cc_result expected_err, const char *description) {
cc_result err = 0;
apiCB *context = NULL;
-
+
cc_result possible_return_values[2] = {
- CC_NOERROR,
- CC_BAD_PARM,
+ CC_NOERROR,
+ CC_BAD_PARM,
};
-
+
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
if (out_context) {
err = cc_initialize(out_context, ccapi_version_2, NULL, NULL);
- if (!err) {
- context = *out_context;
+ if (!err) {
+ context = *out_context;
} else {
log_error("failure in cc_initialize, unable to perform check");
return err;
}
}
-
+
if (!err) {
err = cc_shutdown(&context);
// check returned error
check_err(err, expected_err, possible_return_values);
}
-
+
if (out_context) {
*out_context = NULL;
}
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -217,29 +217,29 @@ int check_cc_get_change_time(void) {
cc_time_t last_change_time = 0;
ccache_p *ccache = NULL;
cred_union creds_union;
-
+
BEGIN_TEST("cc_get_change_time");
-
+
/*
* Make a context
* make sure the change time changes after:
- * a ccache is created
- * a ccache is destroyed
- * a credential is stored
- * a credential is removed
- * a ccache principal is changed
+ * a ccache is created
+ * a ccache is destroyed
+ * a credential is stored
+ * a credential is removed
+ * a ccache principal is changed
* clean up memory
*/
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
if (!err) {
-
+
// try bad parameters first
err = check_once_cc_get_change_time(context, NULL, CC_BAD_PARM, "NULL param, should fail");
-
+
// get_change_time should always give something > 0
check_once_cc_get_change_time(context, &last_change_time, CC_NOERROR, "first-run, should be > 0");
-
+
// create a ccache
err = cc_create(context, "TEST_CCACHE", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
if (err) {
@@ -247,7 +247,7 @@ int check_cc_get_change_time(void) {
failure_count++;
}
check_once_cc_get_change_time(context, &last_change_time, CC_NOERROR, "after creating a new ccache");
-
+
if (!err) {
// change principal
err = cc_set_principal(context, ccache, CC_CRED_V5, "foo@BAR.ORG");
@@ -258,7 +258,7 @@ int check_cc_get_change_time(void) {
}
}
check_once_cc_get_change_time(context, &last_change_time, CC_NOERROR, "after changing a principle");
-
+
new_v5_creds_union_compat(&creds_union, "BAR.ORG");
// store a credential
@@ -271,7 +271,7 @@ int check_cc_get_change_time(void) {
}
}
check_once_cc_get_change_time(context, &last_change_time, CC_NOERROR, "after storing a credential");
-
+
// remove a credential
if (!err) {
err = cc_remove_cred(context, ccache, creds_union);
@@ -281,19 +281,19 @@ int check_cc_get_change_time(void) {
err = CC_NOERROR;
}
}
- check_once_cc_get_change_time(context, &last_change_time, CC_NOERROR, "after removing a credential");
+ check_once_cc_get_change_time(context, &last_change_time, CC_NOERROR, "after removing a credential");
release_v5_creds_union_compat(&creds_union);
-
+
if (ccache) {
// destroy a ccache
err = cc_destroy(context, &ccache);
check_once_cc_get_change_time(context, &last_change_time, CC_NOERROR, "after destroying a ccache");
}
}
-
+
if (context) { cc_shutdown(&context); }
-
+
END_TEST_AND_RETURN
}
@@ -303,33 +303,33 @@ cc_int32 check_once_cc_get_change_time(apiCB *context, cc_time_t *last_time, cc_
cc_result err = 0;
cc_time_t last_change_time;
cc_time_t current_change_time = 0;
-
+
cc_result possible_return_values[3] = {
- CC_NOERROR,
- CC_BAD_PARM,
+ CC_NOERROR,
+ CC_BAD_PARM,
CC_NO_EXIST,
};
-
+
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
if (last_time != NULL) { // if we were passed NULL, then we're looking to pass a bad param
err = cc_get_change_time(context, &current_change_time);
} else {
err = cc_get_change_time(context, NULL);
}
-
+
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
last_change_time = *last_time;
check_if(current_change_time <= last_change_time, "context change time did not increase when it was supposed to (%d <= %d)", current_change_time, last_change_time);
*last_time = current_change_time;
}
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -340,11 +340,11 @@ int check_cc_open(void) {
apiCB *context = NULL;
ccache_p *ccache = NULL;
char *name = "TEST_OPEN_CCACHE";
-
+
BEGIN_TEST("cc_open");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
- if (!err) {
+ if (!err) {
// create a ccache
err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
if (err) {
@@ -355,12 +355,12 @@ int check_cc_open(void) {
err = cc_close(context, &ccache);
ccache = NULL;
}
-
+
// try default ccache
if (!err) {
err = check_once_cc_open(context, name, CC_CRED_V5, &ccache, CC_NOERROR, NULL);
}
-
+
// check version
if (!err) {
err = check_once_cc_open(context, name, CC_CRED_V4, &ccache, CC_ERR_CRED_VERSION, NULL);
@@ -370,10 +370,10 @@ int check_cc_open(void) {
err = check_once_cc_open(context, name, CC_CRED_V5, NULL, CC_BAD_PARM, NULL);
err = check_once_cc_open(context, name, CC_CRED_UNKNOWN, &ccache, CC_ERR_CRED_VERSION, NULL);
}
-
+
if (context) { cc_shutdown(&context); }
-
- END_TEST_AND_RETURN
+
+ END_TEST_AND_RETURN
}
// ---------------------------------------------------------------------------
@@ -381,48 +381,48 @@ int check_cc_open(void) {
cc_result check_once_cc_open(apiCB *context, const char *name, cc_int32 version, ccache_p **ccache, cc_result expected_err, const char *description) {
cc_result err = 0;
char *stored_name = NULL;
-
+
cc_result possible_return_values[5] = {
- CC_NOERROR,
- CC_BAD_PARM,
+ CC_NOERROR,
+ CC_BAD_PARM,
CC_NO_EXIST,
CC_NOMEM,
CC_ERR_CRED_VERSION
};
-
+
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
if (ccache != NULL) { // if we were passed NULL, then we're looking to pass a bad param
err = cc_open(context, name, version, 0, ccache);
} else {
err = cc_open(context, name, version, 0, NULL);
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
check_if(*ccache == NULL, NULL);
-
+
if (!err) {
err = cc_get_name(context, *ccache, &stored_name);
}
- if (!err) {
- check_if(strcmp(stored_name, name), NULL);
+ if (!err) {
+ check_if(strcmp(stored_name, name), NULL);
}
if (stored_name) { cc_free_name(context, &stored_name); }
-
-
+
+
if (ccache && *ccache) {
cc_ccache_release(*ccache);
*ccache = NULL;
}
}
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -433,11 +433,11 @@ int check_cc_create(void) {
apiCB *context = NULL;
ccache_p *ccache = NULL;
char *name = "TEST_CC_CREATE";
-
+
BEGIN_TEST("cc_create");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
- if (!err) {
+ if (!err) {
if (!err) {
err = cc_open(context, name, CC_CRED_V5, 0, &ccache);
if (!err) {
@@ -450,22 +450,22 @@ int check_cc_create(void) {
if (!err) {
err = check_once_cc_create(context, name, CC_CRED_V5, "foo@BAR.ORG", &ccache, CC_NOERROR, NULL);
}
-
+
// try making a ccache with a non-unique name (the existing cache's name)
if (!err) {
err = check_once_cc_create(context, name, CC_CRED_V5, "foo/baz@BAR.ORG", &ccache, CC_NOERROR, NULL);
}
-
+
// try bad parameters
err = check_once_cc_create(context, NULL, CC_CRED_V5, "foo@BAR.ORG", &ccache, CC_BAD_PARM, "NULL name"); // NULL name
err = check_once_cc_create(context, "name", CC_CRED_MAX, "foo@BAR.ORG", &ccache, CC_ERR_CRED_VERSION, "invalid creds_vers"); // invalid creds_vers
err = check_once_cc_create(context, "name", CC_CRED_V5, NULL, &ccache, CC_BAD_PARM, "NULL principal"); // NULL principal
err = check_once_cc_create(context, "name", CC_CRED_V5, "foo@BAR.ORG", NULL, CC_BAD_PARM, "NULL ccache"); // NULL ccache
}
-
+
if (ccache) { cc_destroy(context, &ccache); }
if (context) { cc_shutdown(&context); }
-
+
END_TEST_AND_RETURN
}
@@ -476,27 +476,27 @@ cc_result check_once_cc_create(apiCB *context, const char *name, cc_int32 cred_
char *stored_name = NULL;
char *stored_principal = NULL;
cc_int32 stored_creds_vers = 0;
-
+
cc_result possible_return_values[6] = {
- CC_NOERROR,
- CC_BADNAME,
- CC_BAD_PARM,
- CC_NO_EXIST,
- CC_NOMEM,
- CC_ERR_CRED_VERSION,
+ CC_NOERROR,
+ CC_BADNAME,
+ CC_BAD_PARM,
+ CC_NO_EXIST,
+ CC_NOMEM,
+ CC_ERR_CRED_VERSION,
};
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_create(context, name, principal, cred_vers, 0, ccache);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
check_if(*ccache == NULL, NULL);
-
+
// make sure all of the ccache's info matches what we gave it
// name
err = cc_get_name(context, *ccache, &stored_name);
@@ -509,15 +509,15 @@ cc_result check_once_cc_create(apiCB *context, const char *name, cc_int32 cred_
err = cc_get_principal(context, *ccache, &stored_principal);
if (!err) { check_if(strcmp(stored_principal, principal), NULL); }
if (stored_principal) { cc_free_principal(context, &stored_principal); }
-
+
if (ccache && *ccache) {
cc_destroy(context, ccache);
*ccache = NULL;
}
}
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -528,22 +528,22 @@ int check_cc_close(void) {
apiCB *context = NULL;
ccache_p *ccache = NULL;
char *name = "TEST_CC_CLOSE";
-
+
BEGIN_TEST("cc_close");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
}
-
+
if (!err) {
check_once_cc_close(context, ccache, CC_NOERROR, NULL);
ccache = NULL;
}
-
+
if (context) { cc_shutdown(&context); }
-
+
END_TEST_AND_RETURN
}
@@ -551,36 +551,36 @@ int check_cc_close(void) {
cc_result check_once_cc_close(apiCB *context, ccache_p *ccache, cc_result expected_err, const char *description) {
cc_result err = CC_NOERROR;
-
+
cc_result possible_return_values[2] = {
CC_NOERROR,
- CC_BAD_PARM
+ CC_BAD_PARM
};
-
+
char *name = NULL;
-
+
err = cc_get_name(context, ccache, &name);
err = cc_close(context, &ccache);
ccache = NULL;
-
+
BEGIN_CHECK_ONCE(description);
-
+
#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);
-
+
if (!err && name) { // try opening released ccache to make sure it still exists
err = cc_open(context, name, CC_CRED_V5, 0, &ccache);
}
check_if(err == CC_NO_EXIST, "released ccache was actually destroyed instead");
check_if(err != CC_NOERROR, "released ccache cannot be opened");
-
+
if (ccache) { cc_destroy(context, &ccache); }
if (name) { cc_free_name(context, &name); }
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -591,22 +591,22 @@ int check_cc_destroy(void) {
apiCB *context = NULL;
ccache_p *ccache = NULL;
char *name = "TEST_CC_DESTROY";
-
+
BEGIN_TEST("cc_destroy");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
}
-
+
if (!err) {
check_once_cc_destroy(context, ccache, CC_NOERROR, NULL);
ccache = NULL;
}
-
+
if (context) { cc_shutdown(&context); }
-
+
END_TEST_AND_RETURN
}
@@ -614,39 +614,39 @@ int check_cc_destroy(void) {
cc_result check_once_cc_destroy(apiCB *context, ccache_p *ccache, cc_int32 expected_err, const char *description) {
cc_result err = CC_NOERROR;
-
+
cc_result possible_return_values[2] = {
- CC_NOERROR,
- CC_BAD_PARM,
+ CC_NOERROR,
+ CC_BAD_PARM,
};
-
+
char *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_get_name(context, ccache, &name);
err = cc_destroy(context, &ccache);
ccache = NULL;
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err && name) { // try opening released ccache to make sure it still exists
err = cc_open(context, name, CC_CRED_V5, 0, &ccache);
}
check_if(err != CC_NO_EXIST, "destroyed ccache was actually released instead");
-
+
if (ccache) { cc_destroy(context, &ccache); }
if (name) { cc_free_name(context, &name); }
-
+
#endif /* cc_ccache_destroy */
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -657,11 +657,11 @@ int check_cc_get_cred_version(void) {
apiCB *context = NULL;
ccache_p *ccache = NULL;
char *name = "TEST_CC_GET_CRED_VERSION_V5";
-
+
BEGIN_TEST("cc_get_cred_version");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
// try one created with v5 creds
if (!err) {
err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
@@ -673,14 +673,14 @@ int check_cc_get_cred_version(void) {
log_error("cc_context_create_new_ccache failed, can't complete test");
failure_count++;
}
-
+
if (ccache) {
cc_destroy(context, &ccache);
ccache = NULL;
}
-
+
err = CC_NOERROR;
-
+
// try one created with v4 creds
if (!err) {
err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V4, 0, &ccache);
@@ -696,9 +696,9 @@ int check_cc_get_cred_version(void) {
cc_destroy(context, &ccache);
ccache = NULL;
}
-
+
if (context) { cc_shutdown(&context); }
-
+
END_TEST_AND_RETURN
}
@@ -706,30 +706,30 @@ int check_cc_get_cred_version(void) {
cc_result check_once_cc_get_cred_version(apiCB *context, ccache_p *ccache, cc_int32 expected_cred_vers, cc_int32 expected_err, const char *description) {
cc_result err = CC_NOERROR;
-
+
cc_result possible_return_values[3] = {
- CC_NOERROR,
- CC_BAD_PARM,
- CC_NO_EXIST,
+ CC_NOERROR,
+ CC_BAD_PARM,
+ CC_NO_EXIST,
};
-
+
cc_int32 stored_cred_vers = 0;
-
+
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_get_cred_version(context, ccache, &stored_cred_vers);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
check_if(stored_cred_vers != expected_cred_vers, NULL);
}
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -739,15 +739,15 @@ int check_cc_get_name(void) {
cc_result err = 0;
apiCB *context = NULL;
ccache_p *ccache = NULL;
-
+
BEGIN_TEST("cc_get_name");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches_v2(context);
}
-
+
// try with unique ccache (which happens to be default)
if (!err) {
err = cc_create(context, "0", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
@@ -758,12 +758,12 @@ int check_cc_get_name(void) {
else {
log_error("cc_context_create_ccache failed, can't complete test");
failure_count++;
- }
+ }
if (ccache) {
cc_close(context, &ccache);
ccache = NULL;
}
-
+
// try with unique ccache (which is not default)
if (!err) {
err = cc_context_create_ccache(context, "1", CC_CRED_V5, "foo@BAR.ORG", &ccache);
@@ -775,7 +775,7 @@ int check_cc_get_name(void) {
log_error("cc_context_create_ccache failed, can't complete test");
failure_count++;
}
-
+
// try with bad param
if (!err) {
check_once_cc_get_name(context, ccache, NULL, CC_BAD_PARM, "NULL param");
@@ -784,51 +784,51 @@ int check_cc_get_name(void) {
cc_close(context, &ccache);
ccache = NULL;
}
-
- if (context) {
+
+ if (context) {
err = destroy_all_ccaches_v2(context);
cc_shutdown(&context);
}
-
- END_TEST_AND_RETURN
+
+ END_TEST_AND_RETURN
}
// ---------------------------------------------------------------------------
cc_int32 check_once_cc_get_name(apiCB *context, ccache_p *ccache, const char *expected_name, cc_int32 expected_err, const char *description) {
cc_result err = CC_NOERROR;
-
+
cc_result possible_return_values[4] = {
- CC_NOERROR,
- CC_NOMEM,
- CC_BAD_PARM,
- CC_NO_EXIST,
+ CC_NOERROR,
+ CC_NOMEM,
+ CC_BAD_PARM,
+ CC_NO_EXIST,
};
-
+
char *stored_name = NULL;
-
+
BEGIN_CHECK_ONCE(description);
-
+
#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_get_name(context, ccache, NULL);
}
else {
err = cc_get_name(context, ccache, &stored_name);
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
check_if(strcmp(stored_name, expected_name), NULL);
}
-
+
if (stored_name) { cc_free_name(context, &stored_name); }
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -841,15 +841,15 @@ int check_cc_get_principal(void) {
ccache_p *ccache = NULL;
char *name_v5 = "TEST_CC_GET_PRINCIPAL_V5";
char *name_v4 = "TEST_CC_GET_PRINCIPAL_V4";
-
+
BEGIN_TEST("cc_get_principal");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches_v2(context);
}
-
+
// try with krb5 principal
if (!err) {
err = cc_create(context, name_v5, "foo/BAR@BAZ.ORG", CC_CRED_V5, 0, &ccache);
@@ -865,7 +865,7 @@ int check_cc_get_principal(void) {
cc_close(context, &ccache);
ccache = NULL;
}
-
+
// try with krb4 principal
if (!err) {
err = cc_create(context, name_v4, "foo.BAR@BAZ.ORG", CC_CRED_V4, 0, &ccache);
@@ -877,64 +877,64 @@ int check_cc_get_principal(void) {
log_error("cc_create failed, can't complete test");
failure_count++;
}
-
+
// try with bad param
if (!err) {
check_once_cc_get_principal(context, ccache, NULL, CC_BAD_PARM, "passed null out param");
}
-
+
if (ccache) {
cc_close(context, &ccache);
ccache = NULL;
}
-
- if (context) {
+
+ if (context) {
err = destroy_all_ccaches_v2(context);
cc_shutdown(&context);
}
-
- END_TEST_AND_RETURN
+
+ END_TEST_AND_RETURN
}
// ---------------------------------------------------------------------------
-cc_result check_once_cc_get_principal(apiCB *context,
- ccache_p *ccache,
- const char *expected_principal,
- cc_int32 expected_err,
+cc_result check_once_cc_get_principal(apiCB *context,
+ ccache_p *ccache,
+ const char *expected_principal,
+ cc_int32 expected_err,
const char *description) {
cc_result err = CC_NOERROR;
char *stored_principal = NULL;
-
+
cc_result possible_return_values[4] = {
- CC_NOERROR,
- CC_NOMEM,
- CC_NO_EXIST,
+ CC_NOERROR,
+ CC_NOMEM,
+ CC_NO_EXIST,
CC_BAD_PARM
};
-
+
BEGIN_CHECK_ONCE(description);
-
+
#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_get_principal(context, ccache, NULL);
}
else {
err = cc_get_principal(context, ccache, &stored_principal);
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
check_if(strcmp(stored_principal, expected_principal), "expected princ == \"%s\" stored princ == \"%s\"", expected_principal, stored_principal);
}
-
+
if (stored_principal) { cc_free_principal(context, &stored_principal); }
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -946,15 +946,15 @@ int check_cc_set_principal(void) {
ccache_p *ccache = NULL;
char *name_v5 = "TEST_CC_GET_PRINCIPAL_V5";
char *name_v4 = "TEST_CC_GET_PRINCIPAL_V4";
-
+
BEGIN_TEST("cc_set_principal");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches_v2(context);
}
-
+
// bad params
if (!err) {
err = cc_create(context, name_v5, "foo@BAZ.ORG", CC_CRED_V5, 0, &ccache);
@@ -971,9 +971,9 @@ int check_cc_set_principal(void) {
cc_destroy(context, &ccache);
ccache = NULL;
}
-
+
// empty ccache
-
+
// replace v5 ccache's principal
if (!err) {
err = cc_create(context, name_v5, "foo@BAZ.ORG", CC_CRED_V5, 0, &ccache);
@@ -990,7 +990,7 @@ int check_cc_set_principal(void) {
cc_destroy(context, &ccache);
ccache = NULL;
}
-
+
// replace v4 ccache's principal
if (!err) {
err = cc_create(context, name_v4, "foo@BAZ.ORG", CC_CRED_V4, 0, &ccache);
@@ -1007,13 +1007,13 @@ int check_cc_set_principal(void) {
cc_destroy(context, &ccache);
ccache = NULL;
}
-
- if (context) {
+
+ if (context) {
err = destroy_all_ccaches_v2(context);
cc_shutdown(&context);
}
-
- END_TEST_AND_RETURN
+
+ END_TEST_AND_RETURN
}
// ---------------------------------------------------------------------------
@@ -1021,37 +1021,37 @@ int check_cc_set_principal(void) {
cc_int32 check_once_cc_set_principal(apiCB *context, ccache_p *ccache, cc_int32 cred_vers, const char *in_principal, cc_int32 expected_err, const char *description) {
cc_result err = CC_NOERROR;
char *stored_principal = NULL;
-
+
cc_result possible_return_values[5] = {
- CC_NOERROR,
- CC_NOMEM,
- CC_NO_EXIST,
- CC_ERR_CRED_VERSION,
+ CC_NOERROR,
+ CC_NOMEM,
+ CC_NO_EXIST,
+ CC_ERR_CRED_VERSION,
CC_BAD_PARM
};
-
+
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_set_principal(context, ccache, cred_vers, (char *) in_principal);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
if (!err) {
err = cc_get_principal(context, ccache, &stored_principal);
}
-
+
// compare stored with input
if (!err) {
check_if(strcmp(stored_principal, in_principal), "expected princ == \"%s\" stored princ == \"%s\"", in_principal, stored_principal);
}
-
+
if (stored_principal) { cc_free_principal(context, &stored_principal); }
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -1064,61 +1064,61 @@ int check_cc_store(void) {
ccache_p *dup_ccache = NULL;
cred_union creds_union;
char *name = NULL;
-
+
BEGIN_TEST("cc_store");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches_v2(context);
}
-
+
if (!err) {
err = cc_create(context, "TEST_CC_STORE", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
}
-
+
// cred with matching version and realm
if (!err) {
err = new_v5_creds_union_compat(&creds_union, "BAR.ORG");
-
+
if (!err) {
check_once_cc_store(context, ccache, creds_union, CC_NOERROR, "ok creds");
release_v5_creds_union_compat(&creds_union);
}
}
-
+
// invalid creds
if (!err) {
err = new_v5_creds_union_compat(&creds_union, "BAR.ORG");
-
+
if (!err) {
if (creds_union.cred.pV5Cred->client) {
free(creds_union.cred.pV5Cred->client);
creds_union.cred.pV5Cred->client = NULL;
}
check_once_cc_store(context, ccache, creds_union, CC_BAD_PARM, "invalid creds (NULL client string)");
-
+
release_v5_creds_union_compat(&creds_union);
}
}
-
+
// bad creds version
if (!err) {
err = new_v5_creds_union_compat(&creds_union, "BAR.ORG");
-
+
if (!err) {
creds_union.cred_type = CC_CRED_MAX;
check_once_cc_store(context, ccache, creds_union, CC_ERR_CRED_VERSION, "CC_CRED_MAX (invalid) into a ccache with only v5 princ");
creds_union.cred_type = CC_CRED_V4;
check_once_cc_store(context, ccache, creds_union, CC_ERR_CRED_VERSION, "v4 creds into a v5 ccache");
creds_union.cred_type = CC_CRED_V5;
-
+
release_v5_creds_union_compat(&creds_union);
}
}
-
+
// non-existent ccache
- if (ccache) {
+ if (ccache) {
err = cc_get_name(context, ccache, &name);
if (!err) {
err = cc_open(context, name, CC_CRED_V5, 0, &dup_ccache);
@@ -1126,23 +1126,23 @@ int check_cc_store(void) {
if (name) { cc_free_name(context, &name); }
if (dup_ccache) { cc_destroy(context, &dup_ccache); }
}
-
+
if (!err) {
err = new_v5_creds_union_compat(&creds_union, "BAR.ORG");
-
+
if (!err) {
check_once_cc_store(context, ccache, creds_union, CC_NO_EXIST, "invalid ccache");
-
+
release_v5_creds_union_compat(&creds_union);
}
}
-
+
if (ccache) { cc_close(context, &ccache); }
- if (context) {
+ if (context) {
destroy_all_ccaches_v2(context);
cc_shutdown(&context);
}
-
+
END_TEST_AND_RETURN
}
@@ -1152,24 +1152,24 @@ cc_result check_once_cc_store(apiCB *context, ccache_p *ccache, const cred_union
cc_result err = CC_NOERROR;
ccache_cit *iterator = NULL;
int found = 0;
-
+
cc_result possible_return_values[5] = {
- CC_NOERROR,
- CC_BAD_PARM,
- CC_ERR_CACHE_FULL,
- CC_ERR_CRED_VERSION,
- CC_NO_EXIST
+ CC_NOERROR,
+ CC_BAD_PARM,
+ CC_ERR_CACHE_FULL,
+ CC_ERR_CRED_VERSION,
+ CC_NO_EXIST
};
-
+
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_store(context, ccache, in_creds);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
// make sure credentials were truly stored
if (!err) {
err = cc_seq_fetch_creds_begin(context, ccache, &iterator);
@@ -1181,19 +1181,19 @@ cc_result check_once_cc_store(apiCB *context, ccache_p *ccache, const cred_union
if (!err) {
found = !compare_v5_creds_unions_compat(&in_creds, creds);
}
-
+
if (creds) { cc_free_creds(context, &creds); }
}
-
- if (err == CC_END) {
+
+ if (err == CC_END) {
check_if(found, "stored credentials not found in ccache");
err = CC_NOERROR;
}
-
+
if (iterator) { cc_seq_fetch_creds_end(context, &iterator); }
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -1207,19 +1207,19 @@ int check_cc_remove_cred(void) {
ccache_cit *iterator = NULL;
char *name = NULL;
unsigned int i;
-
+
BEGIN_TEST("cc_remove_cred");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches_v2(context);
}
-
+
if (!err) {
err = cc_create(context, "TEST_CC_REMOVE_CRED", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
}
-
+
// store 10 creds and retrieve their cc_credentials_t representations
for(i = 0; !err && (i < 10); i++) {
cred_union creds;
@@ -1231,55 +1231,55 @@ int check_cc_remove_cred(void) {
}
release_v5_creds_union_compat(&creds);
}
-
+
if (!err) {
err = cc_seq_fetch_creds_begin(context, ccache, &iterator);
}
-
+
for (i = 0; !err && i < 10; i++) {
creds_array[i] = NULL;
err = cc_seq_fetch_creds_next(context, &creds_array[i], iterator);
}
if (err == CC_END) { err = CC_NOERROR; }
-
+
// remove 10 valid creds
for (i = 0; !err && (i < 10); i++) {
check_once_cc_remove_cred(context, ccache, *creds_array[i], CC_NOERROR, "10 ok creds");
}
-
+
// non-existent creds (remove same one twice)
check_once_cc_remove_cred(context, ccache, *creds_array[0], CC_NOTFOUND, "removed same creds twice");
-
+
// non-existent ccache
- if (ccache) {
+ if (ccache) {
ccache_p *dup_ccache = NULL;
err = cc_get_name(context, ccache, &name);
-
+
if (!err) {
err = cc_open(context, name, CC_CRED_V5, 0, &dup_ccache);
}
-
+
if (!err) {
err = cc_destroy(context, &dup_ccache);
check_once_cc_remove_cred(context, ccache, *creds_array[0], CC_NO_EXIST, "invalid ccache");
}
-
+
if (name) { cc_free_name(context, &name); }
}
-
+
for(i = 0; i < 10 && creds_array[i]; i++) {
cc_free_creds(context, &creds_array[i]);
}
-
-
+
+
if (iterator) { cc_seq_fetch_creds_end(context, &iterator); iterator = NULL; }
if (ccache) { cc_close(context, &ccache); }
- if (context) {
+ if (context) {
destroy_all_ccaches_v2(context);
cc_shutdown(&context);
}
-
+
END_TEST_AND_RETURN
}
@@ -1289,49 +1289,49 @@ cc_result check_once_cc_remove_cred(apiCB *context, ccache_p *ccache, cred_union
cc_result err = CC_NOERROR;
ccache_cit *iterator = NULL;
int found = 0;
-
+
cc_result possible_return_values[5] = {
- CC_NOERROR,
- CC_BAD_PARM,
- CC_ERR_CRED_VERSION,
- CC_NOTFOUND,
+ CC_NOERROR,
+ CC_BAD_PARM,
+ CC_ERR_CRED_VERSION,
+ CC_NOTFOUND,
CC_NO_EXIST
};
-
+
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_remove_cred(context, ccache, in_creds);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
// make sure credentials were truly stored
if (!err) {
err = cc_seq_fetch_creds_begin(context, ccache, &iterator);
}
-
+
while (!err && !found) {
cred_union *creds = NULL;
-
+
err = cc_seq_fetch_creds_next(context, &creds, iterator);
if (!err) {
found = !compare_v5_creds_unions_compat(&in_creds, creds);
}
-
+
if (creds) { cc_free_creds(context, &creds); }
}
-
- if (err == CC_END) {
+
+ if (err == CC_END) {
check_if(found, "credentials not removed from ccache");
err = CC_NOERROR;
}
-
+
if (iterator) { cc_seq_fetch_creds_end(context, &iterator); }
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -1342,31 +1342,31 @@ int check_cc_seq_fetch_NCs_begin(void) {
apiCB *context = NULL;
ccache_p *ccache = NULL;
ccache_cit *iterator = NULL;
-
+
BEGIN_TEST("cc_seq_fetch_NCs_begin");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
- if (!err) {
+ if (!err) {
err = destroy_all_ccaches_v2(context);
}
- if (!err) {
+ if (!err) {
// try making when there are no existing ccaches (shouldn't make a difference, but just in case)
check_once_cc_seq_fetch_NCs_begin(context, &iterator, CC_NOERROR, "when there are no existing ccaches");
-
+
err = cc_create(context, "TEST_CC_SEQ_FETCH_NCS_BEGIN", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
}
- if (!err) {
+ if (!err) {
// try making when at least one ccache already exists (just to cover all our bases)
check_once_cc_seq_fetch_NCs_begin(context, &iterator, CC_NOERROR, "when at least one ccache already exists");
-
+
// try bad parameters
check_once_cc_seq_fetch_NCs_begin(context, NULL, CC_BAD_PARM, "NULL param"); // NULL iterator
}
// we'll do a comprehensive test of cc_ccache_iterator related functions later in the test suite
-
+
if (ccache ) { cc_close(context, &ccache); }
if (context) { cc_shutdown(&context); }
-
+
END_TEST_AND_RETURN
}
@@ -1374,25 +1374,25 @@ int check_cc_seq_fetch_NCs_begin(void) {
cc_result check_once_cc_seq_fetch_NCs_begin(apiCB *context, ccache_cit **iterator, cc_result expected_err, const char *description) {
cc_result err = CC_NOERROR;
-
+
cc_result possible_return_values[4] = {
- CC_NOERROR,
- CC_BAD_PARM,
- CC_NOMEM,
- CC_NO_EXIST
+ CC_NOERROR,
+ CC_BAD_PARM,
+ CC_NOMEM,
+ CC_NO_EXIST
};
-
+
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_seq_fetch_NCs_begin(context, iterator);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
// we'll do a comprehensive test of cc_ccache_iterator related functions later
-
+
return err;
}
@@ -1404,15 +1404,15 @@ int check_cc_seq_fetch_NCs_next(void) {
ccache_p *ccache = NULL;
ccache_cit *iterator = NULL;
unsigned int i;
-
+
BEGIN_TEST("cc_seq_fetch_NCs_next");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches_v2(context);
}
-
+
// iterate with no ccaches
if (!err) {
err = cc_seq_fetch_NCs_begin(context, &iterator);
@@ -1422,7 +1422,7 @@ int check_cc_seq_fetch_NCs_next(void) {
cc_seq_fetch_creds_end(context, &iterator);
iterator = NULL;
}
-
+
// iterate with one ccache
if (!err) {
destroy_all_ccaches_v2(context);
@@ -1440,7 +1440,7 @@ int check_cc_seq_fetch_NCs_next(void) {
cc_seq_fetch_creds_end(context, &iterator);
iterator = NULL;
}
-
+
// iterate with several ccaches
if (!err) {
destroy_all_ccaches_v2(context);
@@ -1448,8 +1448,8 @@ int check_cc_seq_fetch_NCs_next(void) {
for(i = 0; !err && (i < 1000); i++)
{
char *name = NULL;
-
- if (i%100 == 0) fprintf(stdout, ".");
+
+ if (i%100 == 0) fprintf(stdout, ".");
asprintf (&name, "TEST_CC_SEQ_FETCH_NCS_NEXT_%d", i);
err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
if (ccache) {
@@ -1466,15 +1466,15 @@ int check_cc_seq_fetch_NCs_next(void) {
cc_seq_fetch_creds_end(context, &iterator);
iterator = NULL;
}
-
-
+
+
if (ccache) { cc_close(context, &ccache); }
if (iterator) { cc_seq_fetch_creds_end(context, &iterator); }
- if (context) {
+ if (context) {
destroy_all_ccaches_v2(context);
cc_shutdown(&context);
}
-
+
END_TEST_AND_RETURN
}
@@ -1482,21 +1482,21 @@ int check_cc_seq_fetch_NCs_next(void) {
cc_result check_once_cc_seq_fetch_NCs_next(apiCB *context, ccache_cit *iterator, cc_uint32 expected_count, cc_result expected_err, const char *description) {
cc_result err = CC_NOERROR;
-
+
cc_result possible_return_values[5] = {
- CC_NOERROR,
- CC_END,
- CC_BAD_PARM,
- CC_NOMEM,
+ CC_NOERROR,
+ CC_END,
+ CC_BAD_PARM,
+ CC_NOMEM,
CC_NO_EXIST
};
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
ccache_p *ccache = NULL;
cc_uint32 actual_count = 0;
-
+
BEGIN_CHECK_ONCE(description);
-
+
while (!err) {
err = cc_seq_fetch_NCs_next(context, &ccache, iterator);
if (ccache) {
@@ -1508,15 +1508,15 @@ cc_result check_once_cc_seq_fetch_NCs_next(apiCB *context, ccache_cit *iterator,
if (err == CC_END) {
err = CC_NOERROR;
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
check_if(actual_count != expected_count, "iterator didn't iterate over all ccaches");
-
+
END_CHECK_ONCE;
-
- return err;
+
+ return err;
}
// ---------------------------------------------------------------------------
@@ -1526,18 +1526,18 @@ int check_cc_get_NC_info(void) {
apiCB *context = NULL;
ccache_p *ccache = NULL;
unsigned int i;
-
+
BEGIN_TEST("cc_get_NC_info");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches_v2(context);
}
-
+
// iterate with no ccaches
check_once_cc_get_NC_info(context, "", "", CC_CRED_MAX, 0, CC_NOERROR, "iterating over an empty collection");
-
+
// iterate with one ccache
if (!err) {
destroy_all_ccaches_v2(context);
@@ -1548,7 +1548,7 @@ int check_cc_get_NC_info(void) {
ccache = NULL;
}
check_once_cc_get_NC_info(context, "TEST_CC_GET_NC_INFO", "foo@BAR.ORG", CC_CRED_V5, 1, CC_NOERROR, "iterating over a collection of 1 ccache");
-
+
// iterate with several ccaches
if (!err) {
destroy_all_ccaches_v2(context);
@@ -1556,8 +1556,8 @@ int check_cc_get_NC_info(void) {
for(i = 0; !err && (i < 1000); i++)
{
char *name = NULL;
-
- if (i%100 == 0) fprintf(stdout, ".");
+
+ if (i%100 == 0) fprintf(stdout, ".");
asprintf (&name, "TEST_CC_GET_NC_INFO_%d", i);
err = cc_create(context, name, "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
if (ccache) {
@@ -1566,58 +1566,58 @@ int check_cc_get_NC_info(void) {
}
free (name);
}
- check_once_cc_get_NC_info(context, "TEST_CC_GET_NC_INFO", "foo@BAR.ORG", CC_CRED_V5, 1000, CC_NOERROR, "iterating over a collection of 1000 ccache");
-
+ check_once_cc_get_NC_info(context, "TEST_CC_GET_NC_INFO", "foo@BAR.ORG", CC_CRED_V5, 1000, CC_NOERROR, "iterating over a collection of 1000 ccache");
+
if (ccache) { cc_close(context, &ccache); }
- if (context) {
+ if (context) {
destroy_all_ccaches_v2(context);
cc_shutdown(&context);
}
-
+
END_TEST_AND_RETURN
}
// ---------------------------------------------------------------------------
-cc_result check_once_cc_get_NC_info(apiCB *context,
- const char *expected_name_prefix,
- const char *expected_principal,
- cc_int32 expected_version,
- cc_uint32 expected_count,
- cc_result expected_err,
+cc_result check_once_cc_get_NC_info(apiCB *context,
+ const char *expected_name_prefix,
+ const char *expected_principal,
+ cc_int32 expected_version,
+ cc_uint32 expected_count,
+ cc_result expected_err,
const char *description) {
cc_result err = CC_NOERROR;
infoNC **info = NULL;
-
+
cc_result possible_return_values[4] = {
CC_NOERROR,
- CC_BAD_PARM,
- CC_NOMEM,
+ CC_BAD_PARM,
+ CC_NOMEM,
CC_NO_EXIST
};
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
cc_uint32 actual_count = 0;
-
+
BEGIN_CHECK_ONCE(description);
-
+
err = cc_get_NC_info(context, &info);
-
+
for (actual_count = 0; !err && info[actual_count]; actual_count++) {
check_if(strncmp(info[actual_count]->name, expected_name_prefix, strlen(expected_name_prefix)), "got incorrect ccache name");
check_if(strcmp(info[actual_count]->principal, expected_principal), "got incorrect principal name");
check_if(info[actual_count]->vers != expected_version, "got incorrect cred version");
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
check_if(actual_count != expected_count, "NC info didn't list all ccaches");
-
+
if (info) { cc_free_NC_info (context, &info); }
END_CHECK_ONCE;
-
- return err;
+
+ return err;
}
// ---------------------------------------------------------------------------
@@ -1629,39 +1629,39 @@ int check_cc_seq_fetch_creds_begin(void) {
ccache_p *dup_ccache = NULL;
ccache_cit *creds_iterator = NULL;
char *name = NULL;
-
+
BEGIN_TEST("cc_seq_fetch_creds_begin");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches_v2(context);
}
-
+
if (!err) {
err = cc_create(context, "TEST_CC_SEQ_FETCH_CREDS_BEGIN", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
}
-
+
// valid params
if (!err) {
check_once_cc_seq_fetch_creds_begin(context, ccache, &creds_iterator, CC_NOERROR, "valid params");
}
- if (creds_iterator) {
- cc_seq_fetch_creds_end(context, &creds_iterator);
+ if (creds_iterator) {
+ cc_seq_fetch_creds_end(context, &creds_iterator);
creds_iterator = NULL;
}
-
+
// NULL out param
if (!err) {
check_once_cc_seq_fetch_creds_begin(context, ccache, NULL, CC_BAD_PARM, "NULL out iterator param");
}
- if (creds_iterator) {
- cc_seq_fetch_creds_end(context, &creds_iterator);
+ if (creds_iterator) {
+ cc_seq_fetch_creds_end(context, &creds_iterator);
creds_iterator = NULL;
}
-
+
// non-existent ccache
- if (ccache) {
+ if (ccache) {
err = cc_get_name(context, ccache, &name);
if (!err) {
err = cc_open(context, name, CC_CRED_V5, 0, &dup_ccache);
@@ -1669,21 +1669,21 @@ int check_cc_seq_fetch_creds_begin(void) {
if (name) { cc_free_name(context, &name); }
if (dup_ccache) { cc_destroy(context, &dup_ccache); }
}
-
+
if (!err) {
check_once_cc_seq_fetch_creds_begin(context, ccache, &creds_iterator, CC_NO_EXIST, "invalid ccache");
}
-
- if (creds_iterator) {
- cc_seq_fetch_creds_end(context, &creds_iterator);
+
+ if (creds_iterator) {
+ cc_seq_fetch_creds_end(context, &creds_iterator);
creds_iterator = NULL;
}
if (ccache) { cc_close(context, &ccache); }
- if (context) {
+ if (context) {
destroy_all_ccaches_v2(context);
cc_shutdown(&context);
}
-
+
END_TEST_AND_RETURN
}
@@ -1691,25 +1691,25 @@ int check_cc_seq_fetch_creds_begin(void) {
cc_result check_once_cc_seq_fetch_creds_begin(apiCB *context, ccache_p *ccache, ccache_cit **iterator, cc_result expected_err, const char *description) {
cc_result err = CC_NOERROR;
-
+
cc_result possible_return_values[5] = {
- CC_NOERROR,
- CC_BAD_PARM,
- CC_NOMEM,
+ CC_NOERROR,
+ CC_BAD_PARM,
+ CC_NOMEM,
CC_NO_EXIST
};
-
+
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
err = cc_seq_fetch_creds_begin(context, ccache, iterator);
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
END_CHECK_ONCE;
-
+
return err;
}
@@ -1722,15 +1722,15 @@ int check_cc_seq_fetch_creds_next(void) {
cred_union creds_union;
ccache_cit *iterator = NULL;
unsigned int i;
-
+
BEGIN_TEST("cc_seq_fetch_creds_next");
-
+
err = cc_initialize(&context, ccapi_version_2, NULL, NULL);
-
+
if (!err) {
err = destroy_all_ccaches_v2(context);
}
-
+
// iterate with no creds
if (!err) {
err = cc_create(context, "TEST_CC_SEQ_FETCH_CREDS_NEXT", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
@@ -1747,7 +1747,7 @@ int check_cc_seq_fetch_creds_next(void) {
cc_close(context, &ccache);
ccache = NULL;
}
-
+
// iterate with one cred
if (!err) {
destroy_all_ccaches_v2(context);
@@ -1770,14 +1770,14 @@ int check_cc_seq_fetch_creds_next(void) {
cc_close(context, &ccache);
ccache = NULL;
}
-
+
// iterate with several creds
if (!err) {
destroy_all_ccaches_v2(context);
err = cc_create(context, "TEST_CC_SEQ_FETCH_CREDS_NEXT", "foo@BAR.ORG", CC_CRED_V5, 0, &ccache);
}
for(i = 0; !err && (i < 1000); i++) {
- if (i%100 == 0) fprintf(stdout, ".");
+ if (i%100 == 0) fprintf(stdout, ".");
new_v5_creds_union_compat(&creds_union, "BAR.ORG");
err = cc_store(context, ccache, creds_union);
release_v5_creds_union_compat(&creds_union);
@@ -1785,15 +1785,15 @@ int check_cc_seq_fetch_creds_next(void) {
if (!err) {
err = cc_seq_fetch_creds_begin(context, ccache, &iterator);
}
- check_once_cc_seq_fetch_creds_next(context, iterator, 1000, CC_NOERROR, "iterating over a ccache with 1000 creds");
-
+ check_once_cc_seq_fetch_creds_next(context, iterator, 1000, CC_NOERROR, "iterating over a ccache with 1000 creds");
+
if (ccache) { cc_close(context, &ccache); }
if (iterator) { cc_seq_fetch_creds_end(context, &iterator); }
- if (context) {
+ if (context) {
destroy_all_ccaches_v2(context);
cc_shutdown(&context);
}
-
+
END_TEST_AND_RETURN
}
@@ -1803,19 +1803,19 @@ cc_result check_once_cc_seq_fetch_creds_next(apiCB *context, ccache_cit *iterato
cc_result err = CC_NOERROR;
cred_union *creds = NULL;
cc_uint32 actual_count = 0;
-
+
cc_result possible_return_values[5] = {
- CC_NOERROR,
- CC_END,
- CC_BAD_PARM,
- CC_NOMEM,
+ CC_NOERROR,
+ CC_END,
+ CC_BAD_PARM,
+ CC_NOMEM,
CC_NO_EXIST,
};
-
+
BEGIN_CHECK_ONCE(description);
-
+
#define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0])
-
+
while (!err) {
err = cc_seq_fetch_creds_next(context, &creds, iterator);
if (creds) {
@@ -1827,14 +1827,13 @@ cc_result check_once_cc_seq_fetch_creds_next(apiCB *context, ccache_cit *iterato
if (err == CC_END) {
err = CC_NOERROR;
}
-
+
// check returned error
check_err(err, expected_err, possible_return_values);
-
+
check_if(actual_count != expected_count, "iterator didn't iterate over all ccaches");
-
+
END_CHECK_ONCE;
-
- return err;
-}
+ return err;
+}
diff --git a/src/ccapi/test/test_ccapi_v2.h b/src/ccapi/test/test_ccapi_v2.h
index 55abdff..8508daa 100644
--- a/src/ccapi/test/test_ccapi_v2.h
+++ b/src/ccapi/test/test_ccapi_v2.h
@@ -34,10 +34,10 @@ int check_cc_get_name(void);
cc_int32 check_once_cc_get_name(apiCB *context, ccache_p *ccache, const char *expected_name, cc_int32 expected_err, const char *description);
int check_cc_get_principal(void);
-cc_result check_once_cc_get_principal(apiCB *context,
- ccache_p *ccache,
- const char *expected_principal,
- cc_int32 expected_err,
+cc_result check_once_cc_get_principal(apiCB *context,
+ ccache_p *ccache,
+ const char *expected_principal,
+ cc_int32 expected_err,
const char *description);
int check_cc_set_principal(void);
@@ -56,18 +56,18 @@ int check_cc_seq_fetch_NCs_next(void);
cc_result check_once_cc_seq_fetch_NCs_next(apiCB *context, ccache_cit *iterator, cc_uint32 expected_count, cc_result expected_err, const char *description);
int check_cc_get_NC_info(void);
-cc_result check_once_cc_get_NC_info(apiCB *context,
- const char *expected_name,
- const char *expected_principal,
- cc_int32 expected_version,
- cc_uint32 expected_count,
- cc_result expected_err,
+cc_result check_once_cc_get_NC_info(apiCB *context,
+ const char *expected_name,
+ const char *expected_principal,
+ cc_int32 expected_version,
+ cc_uint32 expected_count,
+ cc_result expected_err,
const char *description);
int check_cc_seq_fetch_creds_begin(void);
cc_result check_once_cc_seq_fetch_creds_begin(apiCB *context, ccache_p *ccache, ccache_cit **iterator, cc_result expected_err, const char *description);
int check_cc_seq_fetch_creds_next(void);
-cc_result check_once_cc_seq_fetch_creds_next(apiCB *context, ccache_cit *iterator, cc_uint32 expected_count, cc_result expected_err, const char *description);
+cc_result check_once_cc_seq_fetch_creds_next(apiCB *context, ccache_cit *iterator, cc_uint32 expected_count, cc_result expected_err, const char *description);
#endif /* _TEST_CCAPI_V2_H_ */
diff --git a/src/ccapi/test/test_constants.c b/src/ccapi/test/test_constants.c
index 367baac..f4f272c 100644
--- a/src/ccapi/test/test_constants.c
+++ b/src/ccapi/test/test_constants.c
@@ -7,7 +7,7 @@
#include "test_ccapi_ccache.h"
int main (int argc, const char * argv[]) {
-
+
cc_int32 err = ccNoError;
T_CCAPI_INIT;
err = check_constants();