diff options
Diffstat (limited to 'src/ccapi/lib')
-rw-r--r-- | src/ccapi/lib/ccapi_ccache.c | 264 | ||||
-rw-r--r-- | src/ccapi/lib/ccapi_ccache_iterator.c | 94 | ||||
-rw-r--r-- | src/ccapi/lib/ccapi_context.c | 295 | ||||
-rw-r--r-- | src/ccapi/lib/ccapi_context.h | 8 | ||||
-rw-r--r-- | src/ccapi/lib/ccapi_context_change_time.c | 64 | ||||
-rw-r--r-- | src/ccapi/lib/ccapi_credentials.c | 58 | ||||
-rw-r--r-- | src/ccapi/lib/ccapi_credentials_iterator.c | 82 | ||||
-rw-r--r-- | src/ccapi/lib/ccapi_ipc.c | 22 | ||||
-rw-r--r-- | src/ccapi/lib/ccapi_string.c | 46 | ||||
-rw-r--r-- | src/ccapi/lib/ccapi_v2.c | 454 | ||||
-rw-r--r-- | src/ccapi/lib/mac/ccapi_vector.c | 26 | ||||
-rw-r--r-- | src/ccapi/lib/mac/ccapi_vector.h | 26 | ||||
-rw-r--r-- | src/ccapi/lib/win/OldCC/ccapi.h | 64 | ||||
-rw-r--r-- | src/ccapi/lib/win/ccs_reply_proc.c | 2 | ||||
-rw-r--r-- | src/ccapi/lib/win/dllmain.h | 4 |
15 files changed, 752 insertions, 757 deletions
diff --git a/src/ccapi/lib/ccapi_ccache.c b/src/ccapi/lib/ccapi_ccache.c index ec64c44d2..9104c8e0f 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 0df9e0f8e..aa10e1e42 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 9b1d05dc8..da8aa59f0 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 564f49db9..8bc2e3613 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 4efc7db60..602ab26cb 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 6a3b4cb91..c94b551df 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 59ffc7c64..0ff614849 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 8d8b2d209..54b5faa86 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 4f4db6f43..d0386c3bb 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 08100481b..04edd863e 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 ea749c089..3893bc9b3 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 80840f111..4bce9a358 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 c40bd1158..82512771a 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 b3ef3f740..4ac8940ae 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 abf6afd4a..a43262d52 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 |