static cc_int32 ccs_ccache_remove_credentials (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, k5_ipc_stream in_request_data, k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cci_identifier_t credentials_identifier = NULL; if (!io_ccache ) { err = cci_check_error (ccErrBadParam); } if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); } if (!in_request_data ) { err = cci_check_error (ccErrBadParam); } if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { err = cci_identifier_read (&credentials_identifier, in_request_data); } if (!err) { err = ccs_credentials_list_remove (io_ccache->credentials, credentials_identifier); } if (!err) { err = ccs_ccache_changed (io_ccache, io_cache_collection); } cci_identifier_release (credentials_identifier); return cci_check_error (err); }
static cc_int32 ccs_ccache_move (ccs_ccache_t io_ccache, ccs_cache_collection_t io_cache_collection, k5_ipc_stream in_request_data, k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; cci_identifier_t source_identifier = NULL; if (!io_ccache ) { err = cci_check_error (ccErrBadParam); } if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); } if (!in_request_data ) { err = cci_check_error (ccErrBadParam); } if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { /* Note: message is sent as the destination ccache to avoid */ /* extra work on the server when deleting it the source ccache. */ err = cci_identifier_read (&source_identifier, in_request_data); } if (!err) { err = ccs_ccache_collection_move_ccache (io_cache_collection, source_identifier, io_ccache); } if (!err) { err = ccs_ccache_changed (io_ccache, io_cache_collection); } cci_identifier_release (source_identifier); return cci_check_error (err); }
cc_int32 ccapi_ccache_new_credentials_iterator (cc_ccache_t in_ccache, cc_credentials_iterator_t *out_credentials_iterator) { cc_int32 err = ccNoError; 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); } k5_ipc_stream_release (reply); cci_identifier_release (identifier); return cci_check_error (err); }
static cc_int32 ccs_list_iterator_object_release (cci_array_object_t io_list_iterator) { cc_int32 err = ccNoError; ccs_list_iterator_t list_iterator = (ccs_list_iterator_t) io_list_iterator; if (!io_list_iterator) { err = ccErrBadParam; } if (!err && ccs_pipe_valid (list_iterator->client_pipe)) { ccs_client_t client = NULL; err = ccs_server_client_for_pipe (list_iterator->client_pipe, &client); if (!err && client) { /* if client object still has a reference to us, remove it */ err = ccs_client_remove_iterator (client, list_iterator); } } if (!err) { ccs_pipe_release (list_iterator->client_pipe); cci_identifier_release (list_iterator->identifier); free (io_list_iterator); } return err; }
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", __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; }
static cc_int32 cci_context_change_time_update_identifier (cci_identifier_t in_new_identifier, cc_uint32 *out_server_ids_match, cc_uint32 *out_old_server_running, cc_uint32 *out_new_server_running) { cc_int32 err = ccNoError; 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; err = cci_identifier_copy (&new_change_time_identifer, in_new_identifier); if (!err) { /* Save the new identifier */ if (g_change_time_identifer) { cci_identifier_release (g_change_time_identifer); } 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); }
cc_int32 ccs_credentials_release (ccs_credentials_t io_credentials) { cc_int32 err = ccNoError; if (!err && io_credentials) { cci_credentials_union_release (io_credentials->cred_union); cci_identifier_release (io_credentials->identifier); free (io_credentials); } return cci_check_error (err); }
static cc_int32 ccs_list_iterator_object_release (cci_array_object_t io_list_iterator) { cc_int32 err = ccNoError; ccs_list_iterator_t list_iterator = (ccs_list_iterator_t) io_list_iterator; if (!io_list_iterator) { err = ccErrBadParam; } if (!err) { cci_identifier_release (list_iterator->identifier); free (io_list_iterator); } return err; }
cc_int32 ccs_cache_collection_release (ccs_cache_collection_t io_cache_collection) { cc_int32 err = ccNoError; if (!err && io_cache_collection) { cci_identifier_release (io_cache_collection->identifier); ccs_lock_state_release (io_cache_collection->lock_state); ccs_ccache_list_release (io_cache_collection->ccaches); ccs_callback_array_release (io_cache_collection->change_callbacks); free (io_cache_collection); } return cci_check_error (err); }
cc_int32 ccs_ccache_release (ccs_ccache_t io_ccache) { cc_int32 err = ccNoError; if (!err && io_ccache) { cci_identifier_release (io_ccache->identifier); ccs_lock_state_release (io_ccache->lock_state); free (io_ccache->name); free (io_ccache->v5_principal); ccs_credentials_list_release (io_ccache->credentials); ccs_callback_array_release (io_ccache->change_callbacks); free (io_ccache); } return cci_check_error (err); }
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; }
static cc_int32 test_obj_release (ccs_object_t in_object) { cc_int32 err = 0; test_object_t object = (test_object_t) in_object; if (!in_object) { err = ccErrBadParam; } if (!err) { printf ("Releasing object '%s'.\n", object->string); cci_identifier_release (object->identifier); free (object->string); free (in_object); } return err; }
cc_int32 ccapi_ccache_iterator_clone (cc_ccache_iterator_t in_ccache_iterator, cc_ccache_iterator_t *out_ccache_iterator) { cc_int32 err = ccNoError; cci_ccache_iterator_t ccache_iterator = (cci_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); } if (!err) { if (initialized) { err = cci_ipc_send (cci_ccache_iterator_next_msg_id, ccache_iterator->identifier, NULL, &reply); if (!err) { err = cci_identifier_read (&identifier, reply); } } else { /* server doesn't actually exist. Make another dummy one. */ 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); }
cc_int32 ccapi_ccache_iterator_next (cc_ccache_iterator_t in_ccache_iterator, cc_ccache_t *out_ccache) { cc_int32 err = ccNoError; 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; err = cci_identifier_is_initialized (ccache_iterator->identifier, &initialized); if (!err && !initialized) { /* server doesn't actually exist. Pretend we're empty. */ 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); }
static cc_int32 cci_identifier_alloc (cci_identifier_t *out_identifier, cci_uuid_string_t in_server_id, cci_uuid_string_t in_object_id) { 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) { *identifier = cci_identifier_initializer; } else { err = cci_check_error (ccErrNoMem); } } if (!err) { identifier->server_id = strdup (in_server_id); 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 (!err) { *out_identifier = identifier; identifier = NULL; /* take ownership */ } cci_identifier_release (identifier); return cci_check_error (err); }