1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
/*
* Copyright 1999-2006 University of Chicago
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
/**
* @file globus_gsi_proxy_error.c
* @brief GSI Proxy Error Handling
*/
#include "globus_i_gsi_proxy.h"
#include "globus_gsi_proxy_constants.h"
static char *
globus_l_gsi_proxy_error_strings[GLOBUS_GSI_PROXY_ERROR_LAST] =
{
/* 0 */ "Success",
/* 1 */ "Error with the proxy handle",
/* 2 */ "Error with the proxy handle attributes",
/* 3 */ "Error with ASN.1 proxycertinfo structure",
/* 4 */ "Error with ASN.1 proxypolicy structure",
/* 5 */ "Error with proxy path length",
/* 6 */ "Error with X.509 request structure",
/* 7 */ "Error with X.509 structure",
/* 8 */ "Error with X.509 extensions",
/* 9 */ "Error with private key",
/* 10 */ "Error with OpenSSL's BIO handle",
/* 11 */ "Error with credential",
/* 12 */ "Error with credential handle",
/* 13 */ "Error with credential handle attributes",
/* 14 */ "System error",
/* 15 */ "Unable to set proxy type",
/* 16 */ "Invalid parameter",
/* 17 */ "Error signing proxy certificate"
};
globus_result_t
globus_i_gsi_proxy_openssl_error_result(
int error_type,
const char * filename,
const char * function_name,
int line_number,
const char * short_desc,
const char * long_desc)
{
globus_object_t * error_object;
globus_result_t result;
static char * _function_name_ =
"globus_i_gsi_proxy_openssl_error_result";
GLOBUS_I_GSI_PROXY_DEBUG_ENTER;
error_object =
globus_error_wrap_openssl_error(
GLOBUS_GSI_PROXY_MODULE,
error_type,
filename,
function_name,
line_number,
"%s%s%s",
_PCSL(globus_l_gsi_proxy_error_strings[error_type]),
short_desc ? ": " : "",
short_desc ? short_desc : "");
if(long_desc)
{
globus_error_set_long_desc(error_object, long_desc);
}
result = globus_error_put(error_object);
GLOBUS_I_GSI_PROXY_DEBUG_EXIT;
return result;
}
globus_result_t
globus_i_gsi_proxy_error_result(
int error_type,
const char * filename,
const char * function_name,
int line_number,
const char * short_desc,
const char * long_desc)
{
globus_object_t * error_object;
globus_result_t result;
static char * _function_name_ =
"globus_i_gsi_proxy_error_result";
GLOBUS_I_GSI_PROXY_DEBUG_ENTER;
error_object = globus_error_construct_error(
GLOBUS_GSI_PROXY_MODULE,
NULL,
error_type,
filename,
function_name,
line_number,
"%s%s%s",
_PCSL(globus_l_gsi_proxy_error_strings[error_type]),
short_desc ? ": " : "",
short_desc ? short_desc : "");
if(long_desc)
{
globus_error_set_long_desc(error_object, long_desc);
}
result = globus_error_put(error_object);
GLOBUS_I_GSI_PROXY_DEBUG_EXIT;
return result;
}
globus_result_t
globus_i_gsi_proxy_error_chain_result(
globus_result_t chain_result,
int error_type,
const char * filename,
const char * function_name,
int line_number,
const char * short_desc,
const char * long_desc)
{
globus_result_t result;
globus_object_t * error_object;
static char * _function_name_ =
"globus_i_gsi_proxy_error_chain_result";
GLOBUS_I_GSI_PROXY_DEBUG_ENTER;
error_object =
globus_error_construct_error(
GLOBUS_GSI_PROXY_MODULE,
globus_error_get(chain_result),
error_type,
filename,
function_name,
line_number,
"%s%s%s",
_PCSL(globus_l_gsi_proxy_error_strings[error_type]),
short_desc ? ": " : "",
short_desc ? short_desc : "");
if(long_desc)
{
globus_error_set_long_desc(error_object, long_desc);
}
result = globus_error_put(error_object);
GLOBUS_I_GSI_PROXY_DEBUG_EXIT;
return result;
}
#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
|