Exemple #1
0
static cc_int32 ccs_cache_collection_get_default_ccache (ccs_cache_collection_t  in_cache_collection,
                                                         ccs_ccache_t           *out_ccache)
{
    cc_int32 err = ccNoError;
    cc_uint64 count = 0;

    if (!in_cache_collection) { err = cci_check_error (ccErrBadParam); }
    if (!out_ccache         ) { err = cci_check_error (ccErrBadParam); }

    if (!err) {
        err = ccs_ccache_list_count (in_cache_collection->ccaches, &count);
    }

    if (!err) {
        if (count > 0) {
            /* First ccache is the default */
            ccs_ccache_list_iterator_t iterator = NULL;

            err = ccs_ccache_list_new_iterator (in_cache_collection->ccaches,
                                                CCS_PIPE_NULL,
                                                &iterator);

            if (!err) {
                err = ccs_ccache_list_iterator_next (iterator, out_ccache);
            }

            ccs_ccache_list_iterator_release (iterator);

        } else {
            err = cci_check_error (ccErrCCacheNotFound);
        }
    }

    return cci_check_error (err);
}
static  cc_int32 ccs_ccache_iterator_release (ccs_ccache_iterator_t  io_ccache_iterator,
                                              ccs_cache_collection_t io_cache_collection,
                                              k5_ipc_stream           in_request_data,
                                              k5_ipc_stream           io_reply_data)
{
    cc_int32 err = ccNoError;

    if (!io_ccache_iterator ) { err = cci_check_error (ccErrBadParam); }
    if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
    if (!in_request_data    ) { err = cci_check_error (ccErrBadParam); }
    if (!io_reply_data      ) { err = cci_check_error (ccErrBadParam); }

    if (!err) {
        err = ccs_ccache_list_iterator_release (io_ccache_iterator);
    }

    return cci_check_error (err);
}
Exemple #3
0
cc_int32 ccs_cache_collection_find_credentials_iterator (ccs_cache_collection_t      in_cache_collection,
                                                         cci_identifier_t            in_identifier,
                                                         ccs_ccache_t               *out_ccache,
                                                         ccs_credentials_iterator_t *out_credentials_iterator)
{
    cc_int32 err = ccNoError;
    ccs_ccache_list_iterator_t iterator = NULL;

    if (!in_cache_collection     ) { err = cci_check_error (ccErrBadParam); }
    if (!in_identifier           ) { err = cci_check_error (ccErrBadParam); }
    if (!out_credentials_iterator) { err = cci_check_error (ccErrBadParam); }

    if (!err) {
        err = ccs_ccache_list_new_iterator (in_cache_collection->ccaches,
                                            CCS_PIPE_NULL,
                                            &iterator);
    }

    while (!err) {
        ccs_ccache_t ccache = NULL;

        err = ccs_ccache_list_iterator_next (iterator, &ccache);

        if (!err) {
            cc_int32 terr = ccs_ccache_find_credentials_iterator (ccache,
                                                                  in_identifier,
                                                                  out_credentials_iterator);
            if (!terr) {
                *out_ccache = ccache;
                break;
            }
        }
    }
    if (err == ccIteratorEnd) { err = cci_check_error (ccErrInvalidCredentialsIterator); }

    if (iterator) { ccs_ccache_list_iterator_release (iterator); }

    return cci_check_error (err);
}
Exemple #4
0
static cc_int32 ccs_cache_collection_find_ccache_by_name (ccs_cache_collection_t  in_cache_collection,
                                                          const char             *in_name,
                                                          ccs_ccache_t           *out_ccache)
{
    cc_int32 err = ccNoError;
    ccs_ccache_list_iterator_t iterator = NULL;

    if (!in_cache_collection) { err = cci_check_error (ccErrBadParam); }
    if (!in_name            ) { err = cci_check_error (ccErrBadParam); }
    if (!out_ccache         ) { err = cci_check_error (ccErrBadParam); }

    if (!err) {
        err = ccs_ccache_list_new_iterator (in_cache_collection->ccaches,
                                            CCS_PIPE_NULL,
                                            &iterator);
    }

    while (!err) {
        ccs_ccache_t ccache = NULL;

        err = ccs_ccache_list_iterator_next (iterator, &ccache);

        if (!err) {
            cc_uint32 equal = 0;

            err = ccs_ccache_compare_name (ccache, in_name, &equal);

            if (!err && equal) {
                *out_ccache = ccache;
                break;
            }
        }
    }
    if (err == ccIteratorEnd) { err = ccErrCCacheNotFound; }

    if (iterator) { ccs_ccache_list_iterator_release (iterator); }

    return cci_check_error (err);
}