Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_i_gsi_callback.h
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _GLOBUS_I_GSI_CALLBACK_H_
18 #define _GLOBUS_I_GSI_CALLBACK_H_
19 
20 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
21 
27 #include "globus_gsi_callback.h"
28 #include "globus_gsi_cert_utils.h"
29 
30 /* DEBUG MACROS */
31 
32 #ifdef BUILD_DEBUG
33 
34 extern int globus_i_gsi_callback_debug_level;
35 extern FILE * globus_i_gsi_callback_debug_fstream;
36 
37 #define GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_) \
38  (globus_i_gsi_callback_debug_level >= (_LEVEL_))
39 
40 #define GLOBUS_I_GSI_CALLBACK_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
41  { \
42  if (GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_)) \
43  { \
44  globus_libc_fprintf _MESSAGE_; \
45  } \
46  }
47 
48 #define GLOBUS_I_GSI_CALLBACK_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
49  { \
50  if (GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_)) \
51  { \
52  char * _tmp_str_ = \
53  globus_common_create_nstring _MESSAGE_; \
54  globus_libc_fprintf(globus_i_gsi_callback_debug_fstream, \
55  _tmp_str_); \
56  globus_libc_free(_tmp_str_); \
57  } \
58  }
59 
60 #define GLOBUS_I_GSI_CALLBACK_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
61  { \
62  if (GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_)) \
63  { \
64  globus_libc_fprintf(globus_i_gsi_callback_debug_fstream, \
65  _MESSAGE_); \
66  } \
67  }
68 
69 #define GLOBUS_I_GSI_CALLBACK_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) \
70  { \
71  if (GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_)) \
72  { \
73  _OBJ_NAME_##_print_fp(globus_i_gsi_callback_debug_fstream, _OBJ_); \
74  } \
75  }
76 
77 #else
78 
79 #define GLOBUS_I_GSI_CALLBACK_DEBUG(_LEVEL_) 0
80 #define GLOBUS_I_GSI_CALLBACK_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) {}
81 #define GLOBUS_I_GSI_CALLBACK_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) {}
82 #define GLOBUS_I_GSI_CALLBACK_DEBUG_PRINT(_LEVEL_, _MESSAGE_) {}
83 #define GLOBUS_I_GSI_CALLBACK_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) {}
84 
85 #endif
86 
87 #define GLOBUS_I_GSI_CALLBACK_DEBUG_ENTER \
88  GLOBUS_I_GSI_CALLBACK_DEBUG_FPRINTF( \
89  1, (globus_i_gsi_callback_debug_fstream, \
90  "%s entering\n", _function_name_))
91 
92 #define GLOBUS_I_GSI_CALLBACK_DEBUG_EXIT \
93  GLOBUS_I_GSI_CALLBACK_DEBUG_FPRINTF( \
94  2, (globus_i_gsi_callback_debug_fstream, \
95  "%s exiting\n", _function_name_))
96 
97 /* ERROR MACROS */
98 
99 #define GLOBUS_GSI_CALLBACK_OPENSSL_ERROR_RESULT(_RESULT_, \
100  _ERRORTYPE_, \
101  _ERRSTR_) \
102  { \
103  char * _tmp_str_ = \
104  globus_common_create_string _ERRSTR_; \
105  _RESULT_ = globus_i_gsi_callback_openssl_error_result( \
106  _ERRORTYPE_, \
107  __FILE__, \
108  _function_name_, \
109  __LINE__, \
110  _tmp_str_, \
111  NULL); \
112  globus_libc_free(_tmp_str_); \
113  }
114 
115 #define GLOBUS_GSI_CALLBACK_ERROR_RESULT(_RESULT_, _ERRORTYPE_, _ERRSTR_) \
116  { \
117  char * _tmp_str_ = \
118  globus_common_create_string _ERRSTR_; \
119  _RESULT_ = globus_i_gsi_callback_error_result(_ERRORTYPE_, \
120  __FILE__, \
121  _function_name_, \
122  __LINE__, \
123  _tmp_str_, \
124  NULL); \
125  globus_libc_free(_tmp_str_); \
126  }
127 
128 #define GLOBUS_GSI_CALLBACK_ERROR_CHAIN_RESULT(_TOP_RESULT_, _ERRORTYPE_) \
129  _TOP_RESULT_ = globus_i_gsi_callback_error_chain_result( \
130  _TOP_RESULT_, \
131  _ERRORTYPE_, \
132  __FILE__, \
133  _function_name_, \
134  __LINE__, \
135  NULL, \
136  NULL)
137 
138 
139 #define GLOBUS_GSI_CALLBACK_OPENSSL_LONG_ERROR_RESULT(_RESULT_, \
140  _ERRORTYPE_, \
141  _ERRSTR_, \
142  _LONG_DESC_) \
143  { \
144  char * _tmp_str_ = \
145  globus_common_create_string _ERRSTR_; \
146  _RESULT_ = globus_i_gsi_callback_openssl_error_result( \
147  _ERRORTYPE_, \
148  __FILE__, \
149  _function_name_, \
150  __LINE__, \
151  _tmp_str_, \
152  _LONG_DESC_); \
153  globus_libc_free(_tmp_str_); \
154  }
155 
156 #define GLOBUS_GSI_CALLBACK_LONG_ERROR_RESULT(_RESULT_, \
157  _ERRORTYPE_, \
158  _ERRSTR_, \
159  _LONG_DESC_) \
160  { \
161  char * _tmp_str_ = \
162  globus_common_create_string _ERRSTR_; \
163  _RESULT_ = globus_i_gsi_callback_error_result(_ERRORTYPE_, \
164  __FILE__, \
165  _function_name_, \
166  __LINE__, \
167  _tmp_str_, \
168  _LONG_DESC_); \
169  globus_libc_free(_tmp_str_); \
170  }
171 
172 #define GLOBUS_GSI_CALLBACK_LONG_ERROR_CHAIN_RESULT(_TOP_RESULT_, \
173  _ERRORTYPE_, \
174  _LONG_DESC_) \
175  _TOP_RESULT_ = globus_i_gsi_callback_error_chain_result( \
176  _TOP_RESULT_, \
177  _ERRORTYPE_, \
178  __FILE__, \
179  _function_name_, \
180  __LINE__, \
181  NULL, \
182  _LONG_DESC_)
183 
184 extern char * globus_l_gsi_callback_error_strings[];
185 
193 typedef struct globus_l_gsi_callback_data_s {
194 
195  int cert_depth;
196  int proxy_depth;
197  int max_proxy_depth;
199  STACK_OF(X509) * cert_chain;
200  char * cert_dir;
201  globus_gsi_extension_callback_t extension_cb;
202  void * extension_oids;
203  globus_bool_t check_self_signed_policy;
204  globus_bool_t allow_missing_signing_policy;
205  globus_result_t error;
206 
207 } globus_i_gsi_callback_data_t;
208 
210 globus_i_gsi_callback_check_path_length(
211  X509_STORE_CTX * x509_context,
212  globus_gsi_callback_data_t callback_data);
213 
215 globus_i_gsi_callback_check_critical_extensions(
216  X509_STORE_CTX * x509_context,
217  globus_gsi_callback_data_t callback_data);
218 
220 globus_i_gsi_callback_check_signing_policy(
221  X509_STORE_CTX * x509_context,
222  globus_gsi_callback_data_t callback_data);
223 
225 globus_i_gsi_callback_check_revoked(
226  X509_STORE_CTX * x509_context,
227  globus_gsi_callback_data_t callback_data);
228 
230 globus_i_gsi_callback_check_proxy(
231  X509_STORE_CTX * x509_context,
232  globus_gsi_callback_data_t callback_data);
233 
235 globus_i_gsi_callback_check_gaa_auth(
236  X509_STORE_CTX * x509_context,
237  globus_gsi_callback_data_t callback_data);
238 
240 globus_i_gsi_callback_cred_verify(
241  int preverify_ok,
242  globus_gsi_callback_data_t callback_data,
243  X509_STORE_CTX * x509_context);
244 
246 globus_i_gsi_callback_openssl_error_result(
247  int error_type,
248  const char * filename,
249  const char * function_name,
250  int line_number,
251  const char * short_desc,
252  const char * long_desc);
253 
255 globus_i_gsi_callback_error_result(
256  int error_type,
257  const char * filename,
258  const char * function_name,
259  int line_number,
260  const char * short_desc,
261  const char * long_desc);
262 
264 globus_i_gsi_callback_error_chain_result(
265  globus_result_t chain_result,
266  int error_type,
267  const char * filename,
268  const char * function_name,
269  int line_number,
270  const char * short_desc,
271  const char * long_desc);
272 
273 #endif /* _GLOBUS_I_GSI_CALLBACK_H_ */
274 
275 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
Globus GSI Callback.
int(* globus_gsi_extension_callback_t)(globus_gsi_callback_data_t callback_data, X509_EXTENSION *extension)
Definition: globus_gsi_callback.h:128
Globus GSI Cert Utils Library.
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
uint32_t globus_result_t
Definition: globus_types.h:99
enum globus_gsi_cert_utils_cert_type_e globus_gsi_cert_utils_cert_type_t
struct globus_l_gsi_callback_data_s * globus_gsi_callback_data_t
Definition: globus_gsi_callback.h:121