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 = k5_ipc_stream_read_string (io_stream, &server_id);
    }

    if (!err) {
        err = k5_ipc_stream_read_string (io_stream, &object_id);
    }

    if (!err) {
        err = cci_identifier_alloc (out_identifier, server_id, object_id);
    }

    k5_ipc_stream_free_string (server_id);
    k5_ipc_stream_free_string (object_id);

    return cci_check_error (err);
}
Example #2
0
cc_int32 ccapi_ccache_get_name (cc_ccache_t  in_ccache,
                                cc_string_t *out_name)
{
    cc_int32 err = ccNoError;
    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 = k5_ipc_stream_read_string (reply, &name);
    }
    
    if (!err) {
        err = cci_string_new (out_name, name);
    }
    
    k5_ipc_stream_release (reply);
    k5_ipc_stream_free_string (name);
        
    return cci_check_error (err);
}
Example #3
0
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 = k5_ipc_stream_read_uint32 (in_request_data, &version);
    }

    if (!err) {
        err = k5_ipc_stream_read_string (in_request_data, &principal);
    }

    if (!err) {
        /* reset KDC time offsets because they are per-KDC */
        if (version == cc_credentials_v4) {
            io_ccache->kdc_time_offset_v4 = 0;
            io_ccache->kdc_time_offset_v4_valid = 0;

            if (io_ccache->v4_principal) { free (io_ccache->v4_principal); }
            io_ccache->v4_principal = principal;
            principal = NULL; /* take ownership */


        } else 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);
    }

    k5_ipc_stream_free_string (principal);

    return cci_check_error (err);
}
Example #4
0
kim_error kim_options_read_from_stream (kim_options    io_options,
                                        k5_ipc_stream  io_stream)
{
    kim_error err = KIM_NO_ERROR;
    
    if (!err && !io_options) { err = check_error (KIM_NULL_PARAMETER_ERR); }
    if (!err && !io_stream ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
    
    if (!err) {
        err = k5_ipc_stream_read_int64 (io_stream, &io_options->start_time);
    }
    
    if (!err) {
        err = k5_ipc_stream_read_int64 (io_stream, &io_options->lifetime);
    }
    
    if (!err) {
        err = k5_ipc_stream_read_int32 (io_stream, &io_options->renewable);
    }
    
    if (!err) {
        err = k5_ipc_stream_read_int64 (io_stream, 
                                        &io_options->renewal_lifetime);
    }
    
    if (!err) {
        err = k5_ipc_stream_read_int32 (io_stream, &io_options->forwardable);
    }
    
    if (!err) {
        err = k5_ipc_stream_read_int32 (io_stream, &io_options->proxiable);
    }
    
    if (!err) {
        err = k5_ipc_stream_read_int32 (io_stream, &io_options->addressless);
    }
    
    if (!err) {
        char *service_name = NULL;
        err = k5_ipc_stream_read_string (io_stream, &service_name);
        
        if (!err) {
            kim_string_free (&io_options->service_name);
            if (service_name[0]) {
                err = kim_string_copy (&io_options->service_name, service_name);
            } else {
                io_options->service_name = kim_empty_string;
            }
        }
        
        k5_ipc_stream_free_string (service_name);
    }
    
    return check_error (err);    
}
Example #5
0
cc_int32 ccapi_ccache_get_principal (cc_ccache_t  in_ccache,
                                     cc_uint32    in_credentials_version,
                                     cc_string_t *out_principal)
{
    cc_int32 err = ccNoError;
    cci_ccache_t ccache = (cci_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 = k5_ipc_stream_new (&request);
    }
    
    if (!err) {
        err = k5_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 = k5_ipc_stream_read_string (reply, &principal);
    }
    
    if (!err) {
        err = cci_string_new (out_principal, principal);
    }
    
    k5_ipc_stream_release (request);
    k5_ipc_stream_release (reply);
    k5_ipc_stream_free_string (principal);
    
    return cci_check_error (err);
}