Grid Community Toolkit  6.2.1629922860 (tag: v6.2.20210826)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_i_gsi_credential.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_DONT_DOCUMENT_INTERNAL
18 
25 #ifndef GLOBUS_I_GSI_CREDENTIAL_H
26 #define GLOBUS_I_GSI_CREDENTIAL_H
27 
28 #include "globus_gsi_credential.h"
29 #include "openssl/x509v3.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /* DEBUG MACROS */
36 #ifdef BUILD_DEBUG
37 
38 extern int globus_i_gsi_cred_debug_level;
39 extern FILE * globus_i_gsi_cred_debug_fstream;
40 
41 #define GLOBUS_I_GSI_CRED_DEBUG(_LEVEL_) \
42  (globus_i_gsi_cred_debug_level >= (_LEVEL_))
43 
44 #define GLOBUS_I_GSI_CRED_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
45  { \
46  if (GLOBUS_I_GSI_CRED_DEBUG(_LEVEL_)) \
47  { \
48  globus_libc_fprintf _MESSAGE_; \
49  } \
50  }
51 
52 
53 #define GLOBUS_I_GSI_CRED_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
54  { \
55  if (GLOBUS_I_GSI_CRED_DEBUG(_LEVEL_)) \
56  { \
57  char * _tmp_str_ = \
58  globus_common_create_nstring _MESSAGE_; \
59  globus_libc_fprintf(globus_i_gsi_cred_debug_fstream, \
60  _tmp_str_); \
61  globus_libc_free(_tmp_str_); \
62  } \
63  }
64 
65 #define GLOBUS_I_GSI_CRED_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
66  { \
67  if (GLOBUS_I_GSI_CRED_DEBUG(_LEVEL_)) \
68  { \
69  globus_libc_fprintf(globus_i_gsi_cred_debug_fstream, _MESSAGE_); \
70  } \
71  }
72 
73 #define GLOBUS_I_GSI_CRED_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) \
74  { \
75  if (GLOBUS_I_GSI_CRED_DEBUG(_LEVEL_)) \
76  { \
77  _OBJ_NAME_##_print_fp(globus_i_gsi_cred_debug_fstream, _OBJ_); \
78  } \
79  }
80 
81 #else
82 
83 #define GLOBUS_I_GSI_CRED_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) {}
84 #define GLOBUS_I_GSI_CRED_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) {}
85 #define GLOBUS_I_GSI_CRED_DEBUG_PRINT(_LEVEL_, _MESSAGE_) {}
86 #define GLOBUS_I_GSI_CRED_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) {}
87 
88 #endif
89 
90 #define GLOBUS_I_GSI_CRED_DEBUG_ENTER \
91  GLOBUS_I_GSI_CRED_DEBUG_FPRINTF( \
92  2, (globus_i_gsi_cred_debug_fstream, \
93  "%s entering\n", __func__))
94 
95 #define GLOBUS_I_GSI_CRED_DEBUG_EXIT \
96  GLOBUS_I_GSI_CRED_DEBUG_FPRINTF( \
97  2, (globus_i_gsi_cred_debug_fstream, \
98  "%s exiting\n", __func__))
99 
100 /* ERROR MACROS */
101 
102 #define GLOBUS_GSI_CRED_OPENSSL_ERROR_RESULT(_RESULT_, _ERRORTYPE_, _ERRSTR_) \
103  { \
104  char * _tmp_str_ = \
105  globus_common_create_string _ERRSTR_; \
106  _RESULT_ = globus_i_gsi_cred_openssl_error_result(_ERRORTYPE_, \
107  __FILE__, \
108  __func__, \
109  __LINE__, \
110  _tmp_str_, \
111  NULL); \
112  globus_libc_free(_tmp_str_); \
113  }
114 
115 #define GLOBUS_GSI_CRED_ERROR_RESULT(_RESULT_, _ERRORTYPE_, _ERRSTR_) \
116  { \
117  char * _tmp_str_ = \
118  globus_common_create_string _ERRSTR_; \
119  _RESULT_ = globus_i_gsi_cred_error_result(_ERRORTYPE_, \
120  __FILE__, \
121  __func__, \
122  __LINE__, \
123  _tmp_str_, \
124  NULL); \
125  globus_libc_free(_tmp_str_); \
126  }
127 
128 #define GLOBUS_GSI_CRED_ERROR_CHAIN_RESULT(_TOP_RESULT_, _ERRORTYPE_) \
129  _TOP_RESULT_ = globus_i_gsi_cred_error_chain_result(_TOP_RESULT_, \
130  _ERRORTYPE_, \
131  __FILE__, \
132  __func__, \
133  __LINE__, \
134  NULL, \
135  NULL)
136 
137 #define GLOBUS_GSI_CRED_OPENSSL_LONG_ERROR_RESULT(_RESULT_, \
138  _ERRORTYPE_, \
139  _ERRSTR_, \
140  _LONG_DESC_) \
141  { \
142  char * _tmp_str_ = \
143  globus_common_create_string _ERRSTR_; \
144  _RESULT_ = globus_i_gsi_cred_openssl_error_result(_ERRORTYPE_, \
145  __FILE__, \
146  __func__, \
147  __LINE__, \
148  _tmp_str_, \
149  _LONG_DESC_); \
150  globus_libc_free(_tmp_str_); \
151  }
152 
153 #define GLOBUS_GSI_CRED_LONG_ERROR_RESULT(_RESULT_, \
154  _ERRORTYPE_, \
155  _ERRSTR_) \
156  { \
157  char * _tmp_str_ = \
158  globus_common_create_string _ERRSTR_; \
159  _RESULT_ = globus_i_gsi_cred_error_result(_ERRORTYPE_, \
160  __FILE__, \
161  __func__, \
162  __LINE__, \
163  _tmp_str_, \
164  _LONG_DESC_); \
165  globus_libc_free(_tmp_str_); \
166  }
167 
168 #define GLOBUS_GSI_CRED_LONG_ERROR_CHAIN_RESULT(_TOP_RESULT_, \
169  _ERRORTYPE_, \
170  _LONG_DESC_) \
171  _TOP_RESULT_ = globus_i_gsi_cred_error_chain_result(_TOP_RESULT_, \
172  _ERRORTYPE_, \
173  __FILE__, \
174  __func__, \
175  __LINE__, \
176  NULL, \
177  _LONG_DESC_)
178 
179 extern char * globus_l_gsi_cred_error_strings[];
180 
189 typedef struct globus_l_gsi_cred_handle_attrs_s
190 {
191  /* the order to search in for a certificate */
192  globus_gsi_cred_type_t * search_order; /*{PROXY,USER,HOST}*/
193 } globus_i_gsi_cred_handle_attrs_t;
194 
204 typedef struct globus_l_gsi_cred_handle_s
205 {
207  X509 * cert;
209  EVP_PKEY * key;
211  STACK_OF(X509) * cert_chain;
215  time_t goodtill;
216 } globus_i_gsi_cred_handle_t;
217 
218 
220 globus_i_gsi_cred_goodtill(
221  globus_gsi_cred_handle_t cred_handle,
222  time_t * goodtill);
223 
224 globus_result_t globus_i_gsi_cred_get_proxycertinfo(
225  X509 * cert,
226  PROXY_CERT_INFO_EXTENSION ** proxycertinfo);
227 
228 int
229 globus_i_gsi_cred_password_callback_no_prompt(
230  char * buffer,
231  int size,
232  int w);
233 
235 globus_i_gsi_cred_openssl_error_result(
236  int error_type,
237  const char * filename,
238  const char * function_name,
239  int line_number,
240  const char * short_desc,
241  const char * long_desc);
242 
244 globus_i_gsi_cred_error_result(
245  int error_type,
246  const char * filename,
247  const char * function_name,
248  int line_number,
249  const char * short_desc,
250  const char * long_desc);
251 
253 globus_i_gsi_cred_error_chain_result(
254  globus_result_t chain_result,
255  int error_type,
256  const char * filename,
257  const char * function_name,
258  int line_number,
259  const char * short_desc,
260  const char * long_desc);
261 
263 globus_i_gsi_cred_error_join_chains_result(
264  globus_result_t outter_error,
265  globus_result_t inner_error);
266 
267 #ifdef __cplusplus
268 }
269 #endif
270 
271 #endif /* GLOBUS_I_GSI_CREDENTIAL_H */
272 
273 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
Globus GSI Credential Library.
struct globus_l_gsi_cred_handle_s * globus_gsi_cred_handle_t
Definition: globus_gsi_credential.h:162
globus_gsi_cred_type_t
Definition: globus_gsi_cred_constants.h:104
uint32_t globus_result_t
Definition: globus_types.h:99
struct globus_l_gsi_cred_handle_attrs_s * globus_gsi_cred_handle_attrs_t
Definition: globus_gsi_credential.h:175