globus_i_gsi_callback.h

00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef _GLOBUS_I_GSI_CALLBACK_H_
00018 #define _GLOBUS_I_GSI_CALLBACK_H_
00019 
00020 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
00021 
00027 #include "globus_gsi_callback.h"
00028 #include "globus_gsi_cert_utils.h"
00029 
00030 /* DEBUG MACROS */
00031 
00032 #ifdef BUILD_DEBUG
00033 
00034 extern int                              globus_i_gsi_callback_debug_level;
00035 extern FILE *                           globus_i_gsi_callback_debug_fstream;
00036 
00037 #define GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_) \
00038     (globus_i_gsi_callback_debug_level >= (_LEVEL_))
00039 
00040 #define GLOBUS_I_GSI_CALLBACK_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
00041     { \
00042         if (GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_)) \
00043         { \
00044            globus_libc_fprintf _MESSAGE_; \
00045         } \
00046     }
00047 
00048 #define GLOBUS_I_GSI_CALLBACK_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
00049     { \
00050         if (GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_)) \
00051         { \
00052            char *                          _tmp_str_ = \
00053                globus_common_create_nstring _MESSAGE_; \
00054            globus_libc_fprintf(globus_i_gsi_callback_debug_fstream, \
00055                                _tmp_str_); \
00056            globus_libc_free(_tmp_str_); \
00057         } \
00058     }
00059 
00060 #define GLOBUS_I_GSI_CALLBACK_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
00061     { \
00062         if (GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_)) \
00063         { \
00064            globus_libc_fprintf(globus_i_gsi_callback_debug_fstream, \
00065                                _MESSAGE_); \
00066         } \
00067     }
00068 
00069 #define GLOBUS_I_GSI_CALLBACK_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) \
00070     { \
00071         if (GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_)) \
00072         { \
00073            _OBJ_NAME_##_print_fp(globus_i_gsi_callback_debug_fstream, _OBJ_); \
00074         } \
00075     }
00076 
00077 #else
00078 
00079 #define GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_) 0
00080 #define GLOBUS_I_GSI_CALLBACK_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) {}
00081 #define GLOBUS_I_GSI_CALLBACK_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) {}
00082 #define GLOBUS_I_GSI_CALLBACK_DEBUG_PRINT(_LEVEL_, _MESSAGE_) {}
00083 #define GLOBUS_I_GSI_CALLBACK_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) {}
00084 
00085 #endif
00086          
00087 #define GLOBUS_I_GSI_CALLBACK_DEBUG_ENTER \
00088             GLOBUS_I_GSI_CALLBACK_DEBUG_FPRINTF( \
00089                 1, (globus_i_gsi_callback_debug_fstream, \
00090                     "%s entering\n", _function_name_))
00091 
00092 #define GLOBUS_I_GSI_CALLBACK_DEBUG_EXIT \
00093             GLOBUS_I_GSI_CALLBACK_DEBUG_FPRINTF( \
00094                 2, (globus_i_gsi_callback_debug_fstream, \
00095                     "%s exiting\n", _function_name_))
00096 
00097 /* ERROR MACROS */
00098 
00099 #define GLOBUS_GSI_CALLBACK_OPENSSL_ERROR_RESULT(_RESULT_, \
00100                                                  _ERRORTYPE_, \
00101                                                  _ERRSTR_) \
00102     { \
00103         char *                          _tmp_str_ = \
00104             globus_common_create_string _ERRSTR_; \
00105         _RESULT_ = globus_i_gsi_callback_openssl_error_result( \
00106                        _ERRORTYPE_, \
00107                        __FILE__, \
00108                        _function_name_, \
00109                        __LINE__, \
00110                        _tmp_str_, \
00111                        NULL); \
00112         globus_libc_free(_tmp_str_); \
00113     }
00114 
00115 #define GLOBUS_GSI_CALLBACK_ERROR_RESULT(_RESULT_, _ERRORTYPE_, _ERRSTR_) \
00116     { \
00117         char *                          _tmp_str_ = \
00118             globus_common_create_string _ERRSTR_; \
00119         _RESULT_ = globus_i_gsi_callback_error_result(_ERRORTYPE_, \
00120                                                   __FILE__, \
00121                                                   _function_name_, \
00122                                                   __LINE__, \
00123                                                   _tmp_str_, \
00124                                                   NULL); \
00125         globus_libc_free(_tmp_str_); \
00126     }
00127 
00128 #define GLOBUS_GSI_CALLBACK_ERROR_CHAIN_RESULT(_TOP_RESULT_, _ERRORTYPE_) \
00129     _TOP_RESULT_ = globus_i_gsi_callback_error_chain_result( \
00130                        _TOP_RESULT_, \
00131                        _ERRORTYPE_, \
00132                        __FILE__, \
00133                        _function_name_, \
00134                        __LINE__, \
00135                        NULL, \
00136                        NULL)
00137 
00138 
00139 #define GLOBUS_GSI_CALLBACK_OPENSSL_LONG_ERROR_RESULT(_RESULT_, \
00140                                                       _ERRORTYPE_, \
00141                                                       _ERRSTR_, \
00142                                                       _LONG_DESC_) \
00143     { \
00144         char *                          _tmp_str_ = \
00145             globus_common_create_string _ERRSTR_; \
00146         _RESULT_ = globus_i_gsi_callback_openssl_error_result( \
00147                        _ERRORTYPE_, \
00148                        __FILE__, \
00149                        _function_name_, \
00150                        __LINE__, \
00151                        _tmp_str_, \
00152                        _LONG_DESC_); \
00153         globus_libc_free(_tmp_str_); \
00154     }
00155 
00156 #define GLOBUS_GSI_CALLBACK_LONG_ERROR_RESULT(_RESULT_, \
00157                                               _ERRORTYPE_, \
00158                                               _ERRSTR_, \
00159                                               _LONG_DESC_) \
00160     { \
00161         char *                          _tmp_str_ = \
00162             globus_common_create_string _ERRSTR_; \
00163         _RESULT_ = globus_i_gsi_callback_error_result(_ERRORTYPE_, \
00164                                                   __FILE__, \
00165                                                   _function_name_, \
00166                                                   __LINE__, \
00167                                                   _tmp_str_, \
00168                                                   _LONG_DESC_); \
00169         globus_libc_free(_tmp_str_); \
00170     }
00171 
00172 #define GLOBUS_GSI_CALLBACK_LONG_ERROR_CHAIN_RESULT(_TOP_RESULT_, \
00173                                                     _ERRORTYPE_, \
00174                                                     _LONG_DESC_) \
00175     _TOP_RESULT_ = globus_i_gsi_callback_error_chain_result( \
00176                        _TOP_RESULT_, \
00177                        _ERRORTYPE_, \
00178                        __FILE__, \
00179                        _function_name_, \
00180                        __LINE__, \
00181                        NULL, \
00182                        _LONG_DESC_)
00183 
00184 extern char *                    globus_l_gsi_callback_error_strings[];
00185 
00193 typedef struct globus_l_gsi_callback_data_s {    
00194 
00195     int                                 cert_depth;
00196     int                                 proxy_depth;
00197     int                                 max_proxy_depth;
00198     globus_gsi_cert_utils_cert_type_t   cert_type;
00199     STACK_OF(X509) *                    cert_chain;
00200     char *                              cert_dir;
00201     globus_gsi_extension_callback_t     extension_cb;
00202     void *                              extension_oids;
00203     globus_bool_t                       check_self_signed_policy;
00204     globus_bool_t                       allow_missing_signing_policy;
00205     globus_result_t                     error;
00206 
00207 } globus_i_gsi_callback_data_t;
00208 
00209 globus_result_t
00210 globus_i_gsi_callback_check_path_length(
00211     X509_STORE_CTX *                    x509_context,
00212     globus_gsi_callback_data_t          callback_data);
00213 
00214 globus_result_t
00215 globus_i_gsi_callback_check_critical_extensions(
00216     X509_STORE_CTX *                    x509_context,
00217     globus_gsi_callback_data_t          callback_data);
00218 
00219 globus_result_t
00220 globus_i_gsi_callback_check_signing_policy(
00221     X509_STORE_CTX *                    x509_context,
00222     globus_gsi_callback_data_t          callback_data);
00223 
00224 globus_result_t
00225 globus_i_gsi_callback_check_revoked(
00226     X509_STORE_CTX *                    x509_context,
00227     globus_gsi_callback_data_t          callback_data);
00228 
00229 globus_result_t
00230 globus_i_gsi_callback_check_proxy(
00231     X509_STORE_CTX *                    x509_context,
00232     globus_gsi_callback_data_t          callback_data);
00233 
00234 globus_result_t
00235 globus_i_gsi_callback_check_gaa_auth(
00236     X509_STORE_CTX *                    x509_context,
00237     globus_gsi_callback_data_t          callback_data);
00238 
00239 globus_result_t
00240 globus_i_gsi_callback_cred_verify(
00241     int                                 preverify_ok,
00242     globus_gsi_callback_data_t          callback_data,
00243     X509_STORE_CTX *                    x509_context);
00244 
00245 globus_result_t
00246 globus_i_gsi_callback_openssl_error_result(
00247     int                                 error_type,
00248     const char *                        filename,
00249     const char *                        function_name,
00250     int                                 line_number,
00251     const char *                        short_desc,
00252     const char *                        long_desc);
00253 
00254 globus_result_t
00255 globus_i_gsi_callback_error_result(
00256     int                                 error_type,
00257     const char *                        filename,
00258     const char *                        function_name,
00259     int                                 line_number,
00260     const char *                        short_desc,
00261     const char *                        long_desc);
00262 
00263 globus_result_t
00264 globus_i_gsi_callback_error_chain_result(
00265     globus_result_t                     chain_result,
00266     int                                 error_type,
00267     const char *                        filename,
00268     const char *                        function_name,
00269     int                                 line_number,
00270     const char *                        short_desc,
00271     const char *                        long_desc);
00272 
00273 #endif /* _GLOBUS_I_GSI_CALLBACK_H_ */
00274 
00275 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */

Generated on 28 Oct 2014 for globus_gsi_callback by  doxygen 1.4.7