summaryrefslogtreecommitdiffstats
path: root/src/ccapi/common
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/common
parent162ab371748cba0cc6f172419bd6e71fa04bb878 (diff)
downloadkrb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.gz
krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.xz
krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.zip
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/common')
-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
14 files changed, 429 insertions, 433 deletions
diff --git a/src/ccapi/common/cci_array_internal.c b/src/ccapi/common/cci_array_internal.c
index b5a0f693b..6e8bf2163 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 94aebddf2..a2f8ca877 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 4545b402e..d6b9c62c0 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 8875e1a03..aa2f1491b 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 a027c70c5..f1cc0cf92 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 0e12c0d48..af1f96153 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 8c1795b05..01085ac41 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 43f7100ce..c3046331e 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 5f3d0651a..e87e400fc 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 cf881cda1..220b1d1d2 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 6e6a7158d..5a8c9e723 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 5e0e11d7a..60c8ea160 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 32854f076..d688ed230 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 f60ee3b8f..3795ca544 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
+ }