cc_uint32 cci_identifier_read (cci_identifier_t *out_identifier, k5_ipc_stream io_stream) { cc_int32 err = ccNoError; cci_uuid_string_t server_id = NULL; cci_uuid_string_t object_id = NULL; if (!out_identifier) { err = cci_check_error (ccErrBadParam); } if (!io_stream ) { err = cci_check_error (ccErrBadParam); } if (!err) { err = krb5int_ipc_stream_read_string (io_stream, &server_id); } if (!err) { err = krb5int_ipc_stream_read_string (io_stream, &object_id); } if (!err) { err = cci_identifier_alloc (out_identifier, server_id, object_id); } krb5int_ipc_stream_free_string (server_id); krb5int_ipc_stream_free_string (object_id); return cci_check_error (err); }
static cc_int32 ccs_cache_collection_create_ccache (ccs_cache_collection_t io_cache_collection, k5_ipc_stream in_request_data, k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; char *name = NULL; cc_uint32 cred_vers; char *principal = NULL; ccs_ccache_t ccache = NULL; if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); } if (!in_request_data ) { err = cci_check_error (ccErrBadParam); } if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { err = krb5int_ipc_stream_read_string (in_request_data, &name); } if (!err) { err = krb5int_ipc_stream_read_uint32 (in_request_data, &cred_vers); } if (!err) { err = krb5int_ipc_stream_read_string (in_request_data, &principal); } if (!err) { cc_int32 terr = ccs_cache_collection_find_ccache_by_name (io_cache_collection, name, &ccache); if (!terr) { err = ccs_ccache_reset (ccache, io_cache_collection, cred_vers, principal); } else { err = ccs_ccache_new (&ccache, cred_vers, name, principal, io_cache_collection->ccaches); } } if (!err) { err = ccs_ccache_write (ccache, io_reply_data); } if (!err) { err = ccs_cache_collection_changed (io_cache_collection); } krb5int_ipc_stream_free_string (name); krb5int_ipc_stream_free_string (principal); return cci_check_error (err); }
static cc_int32 ccs_cache_collection_open_ccache (ccs_cache_collection_t io_cache_collection, k5_ipc_stream in_request_data, k5_ipc_stream io_reply_data) { cc_int32 err = ccNoError; char *name = NULL; ccs_ccache_t ccache = NULL; if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); } if (!in_request_data ) { err = cci_check_error (ccErrBadParam); } if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { err = krb5int_ipc_stream_read_string (in_request_data, &name); } if (!err) { err = ccs_cache_collection_find_ccache_by_name (io_cache_collection, name, &ccache); } if (!err) { err = ccs_ccache_write (ccache, io_reply_data); } krb5int_ipc_stream_free_string (name); return cci_check_error (err); }
static cc_int32 ccs_ccache_set_principal (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; cc_uint32 version = 0; char *principal = NULL; if (!io_ccache ) { err = cci_check_error (ccErrBadParam); } if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); } if (!in_request_data ) { err = cci_check_error (ccErrBadParam); } if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { err = krb5int_ipc_stream_read_uint32 (in_request_data, &version); } if (!err) { err = krb5int_ipc_stream_read_string (in_request_data, &principal); } if (!err) { /* reset KDC time offsets because they are per-KDC */ if (version == cc_credentials_v5) { io_ccache->kdc_time_offset_v5 = 0; io_ccache->kdc_time_offset_v5_valid = 0; if (io_ccache->v5_principal) { free (io_ccache->v5_principal); } io_ccache->v5_principal = principal; principal = NULL; /* take ownership */ } else { err = cci_check_error (ccErrBadCredentialsVersion); } } if (!err) { io_ccache->creds_version |= version; err = ccs_ccache_changed (io_ccache, io_cache_collection); } krb5int_ipc_stream_free_string (principal); return cci_check_error (err); }