static void s_base_instance_copy (void * instance_datavp, void ** copyvp) { globus_error_base_instance_t * instance_data; globus_error_base_instance_t * copy; instance_data = ((globus_error_base_instance_t *) instance_datavp); if (copyvp!=NULL) { if (instance_datavp==NULL) { (*copyvp) = (void *) NULL; return; } copy = globus_malloc (sizeof(globus_error_base_instance_t)); if (copy!=NULL) { if (instance_data!=NULL) { copy->source_module = instance_data->source_module; copy->causal_error = globus_object_copy(instance_data->causal_error); } } (*copyvp) = (void *) copy; } }
static void restart_marker_plugin_fault_cb( globus_ftp_client_plugin_t * plugin, void * plugin_specific, globus_ftp_client_handle_t * handle, const char * url, globus_object_t * error) { restart_marker_plugin_info_t * ps; ps = (restart_marker_plugin_info_t *) plugin_specific; if(ps->error_url || ps->error_obj) { /* already received error (before restart attempt) */ return; } ps->error_url = globus_libc_strdup(url); ps->error_obj = globus_object_copy(error); }
/** * Retrieve the minor status from a gssapi error object. * @ingroup globus_gssapi_error_accessor * * @param error * The error from which to retrieve the minor status * @return * The minor status stored in the object */ OM_uint32 globus_error_gssapi_get_minor_status( globus_object_t * error) { globus_l_gssapi_error_data_t * data; data = (globus_l_gssapi_error_data_t *) globus_object_get_local_instance_data(error); if(data) { if(data->is_globus_gsi) { return (OM_uint32) globus_error_put( globus_object_copy(globus_error_get_cause(error))); } else { return data->minor_status; } } return 0; }
/** * @brief Wrap * @ingroup globus_gsi_gss_assist * * @param minor_status * GSSAPI return code. If the call was successful, the minor * status is equal to GLOBUS_SUCCESS. Otherwise, it is an * error object ID for which * globus_error_get() and globus_object_free() * can be used to get and destroy it. * @param context_handle * the context. * @param data * pointer to application data to wrap and send * @param length * length of the @a data array * @param token_status * assist routine get/send token status * @param gss_assist_send_token * a send_token routine * @param gss_assist_send_context * first arg for the send_token * @param fperr * file handle to write error message to. * * @return * GSS_S_COMPLETE on success * Other GSSAPI errors on failure. * * @see gss_wrap() */ OM_uint32 globus_gss_assist_wrap_send( OM_uint32 * minor_status, const gss_ctx_id_t context_handle, char * data, size_t length, int * token_status, int (*gss_assist_send_token)(void *, void *, size_t), void * gss_assist_send_context, FILE * fperr) { OM_uint32 major_status = GSS_S_COMPLETE; OM_uint32 local_minor_status; globus_result_t local_result = GLOBUS_SUCCESS; gss_buffer_desc input_token_desc = GSS_C_EMPTY_BUFFER; gss_buffer_t input_token = &input_token_desc; gss_buffer_desc output_token_desc = GSS_C_EMPTY_BUFFER; gss_buffer_t output_token = &output_token_desc; static char * _function_name_ = "globus_gss_assist_wrap_send"; GLOBUS_I_GSI_GSS_ASSIST_DEBUG_ENTER; *token_status = 0; input_token->value = data; input_token->length = length; major_status = gss_wrap(&local_minor_status, context_handle, 0, GSS_C_QOP_DEFAULT, input_token, NULL, output_token); GLOBUS_I_GSI_GSS_ASSIST_DEBUG_FPRINTF( 3, (globus_i_gsi_gss_assist_debug_fstream, _GASL("Wrap_send:maj:%8.8x min:%8.8x inlen:%u outlen:%u\n"), (unsigned int) major_status, (unsigned int) *minor_status, input_token->length = length, output_token->length)); if (major_status != GSS_S_COMPLETE) { globus_object_t * error_obj; globus_object_t * error_copy; error_obj = globus_error_get((globus_result_t) local_minor_status); error_copy = globus_object_copy(error_obj); local_minor_status = (OM_uint32) globus_error_put(error_obj); if(fperr) { globus_gss_assist_display_status( stderr, _GASL("gss_assist_wrap_send failure:"), major_status, local_minor_status, *token_status); } local_result = globus_error_put(error_copy); GLOBUS_GSI_GSS_ASSIST_ERROR_CHAIN_RESULT( local_result, GLOBUS_GSI_GSS_ASSIST_ERROR_WITH_WRAP); *minor_status = (OM_uint32) local_result; goto release_output_token; } *token_status = (*gss_assist_send_token)(gss_assist_send_context, output_token->value, output_token->length); if(*token_status != 0) { GLOBUS_GSI_GSS_ASSIST_ERROR_RESULT( local_result, GLOBUS_GSI_GSS_ASSIST_ERROR_WITH_WRAP, (_GASL("Error sending output token. token status: %d\n"), *token_status)); *minor_status = (OM_uint32) local_result; major_status = GSS_S_FAILURE; goto release_output_token; } major_status = gss_release_buffer(& local_minor_status, output_token); if(GSS_ERROR(major_status)) { GLOBUS_GSI_GSS_ASSIST_ERROR_CHAIN_RESULT( local_result, GLOBUS_GSI_GSS_ASSIST_ERROR_WITH_WRAP); *minor_status = (OM_uint32) local_result; } goto exit; release_output_token: gss_release_buffer(&local_minor_status, output_token); exit: GLOBUS_I_GSI_GSS_ASSIST_DEBUG_EXIT; return major_status; }
/** * Initialize a gass_transfer request handle. * * This function creates a #globus_gass_transfer_request_struct_t and * associates it with a #gass_transfer_request_t handle. The structure * is initialized with the information passed as the arguments to the * function. * * @note This function must be called with the request handle mutex lock. * * @param request * The request handle to initialize. If this function is successful, * the value pointed to by this will be initialized to the new * handle id; otherwise, the it will be set to * GLOBUS_NULL_HANDLE. * @param attr * The request attributes to use to create the handle. If non-NULL, * they are copied into the request structure. * @param url * An URL string containing the location of the file to access. A * copy of this is stored in the request handle. * @param type * The type of file transfer that this request will be used for. * @param callback * The callback function to be called once the request is in the * ready state. * @param user_arg * User-supplied argument to the callback function. * * @retval void */ void globus_i_gass_transfer_request_init( globus_gass_transfer_request_t * request, globus_gass_transfer_requestattr_t * attr, char * url, globus_gass_transfer_request_type_t type, globus_gass_transfer_callback_t callback, void * user_arg) { globus_gass_transfer_request_struct_t * req; req = globus_malloc(sizeof(globus_gass_transfer_request_struct_t)); if(req == GLOBUS_NULL) { goto error_exit; } if(url) { req->url = globus_libc_strdup(url); if(req->url == GLOBUS_NULL) { goto free_req; } } else { req->url = GLOBUS_NULL; } req->type = type; req->status = GLOBUS_GASS_TRANSFER_REQUEST_STARTING; req->referral_url = GLOBUS_NULL; req->referral_count = 0; req->callback = callback; req->callback_arg = user_arg; req->proto = GLOBUS_NULL; req->subject = GLOBUS_NULL; req->denial_reason = 0; req->denial_message = GLOBUS_NULL; req->handled_length = 0; req->posted_length = 0; req->fail_callback = GLOBUS_NULL; req->client_side = GLOBUS_FALSE; req->user_pointer = GLOBUS_NULL; globus_fifo_init(&req->pending_data); if(attr) { if(*attr) { req->attr = globus_object_copy(*attr); if(req->attr == GLOBUS_NULL) { goto free_fifo; } } else { req->attr = GLOBUS_NULL; } } else { req->attr = GLOBUS_NULL; } *request = globus_handle_table_insert(&globus_i_gass_transfer_request_handles, (void *) req, 2); globus_list_insert(&globus_i_gass_transfer_requests, (void *) (intptr_t) (*request)); return; free_fifo: globus_fifo_destroy(&req->pending_data); globus_free(req->url); free_req: globus_free(req); error_exit: *request = GLOBUS_NULL_HANDLE; return; }