2
* Copyright 1999-2006 University of Chicago
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
17
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
19
* @file globus_i_gsi_gss_utils.c
20
* @author Sam Lang, Sam Meder
22
* $RCSfile: globus_i_gsi_gss_utils.h,v $
24
* $Date: 2011/11/02 13:47:22 $
28
#ifndef GLOBUS_I_GSI_GSS_UTILS_H
29
#define GLOBUS_I_GSI_GSS_UTILS_H
32
#include "gssapi_openssl.h"
36
#define GLOBUS_GSI_GSSAPI_ERROR_RESULT(_MIN_RESULT_, _MIN_, \
38
if (_MIN_RESULT_ != NULL) \
41
globus_common_create_string _ERRSTR_; \
42
*_MIN_RESULT_ = (OM_uint32) globus_i_gsi_gssapi_error_result( \
43
_MIN_, __FILE__, _function_name_, \
44
__LINE__, tmpstr, NULL); \
45
globus_libc_free(tmpstr); \
48
#define GLOBUS_GSI_GSSAPI_OPENSSL_ERROR_RESULT(_MIN_RESULT_, \
49
_ERRORTYPE_, _ERRORSTR_) \
52
globus_common_create_string _ERRORSTR_; \
54
(OM_uint32) globus_i_gsi_gssapi_openssl_error_result( \
55
_ERRORTYPE_, __FILE__, _function_name_, __LINE__, tmpstr, NULL); \
56
globus_libc_free(tmpstr); \
59
#define GLOBUS_GSI_GSSAPI_ERROR_CHAIN_RESULT(_MIN_RESULT_, _TOP_RESULT_, \
61
*_MIN_RESULT_ = (OM_uint32) globus_i_gsi_gssapi_error_chain_result( \
62
(globus_result_t)_TOP_RESULT_, \
63
_ERRORTYPE_, __FILE__, \
64
_function_name_, __LINE__, NULL, NULL)
66
#define GLOBUS_GSI_GSSAPI_LONG_ERROR_RESULT(_MIN_RESULT_, _MIN_, \
67
_ERRSTR_, _LONG_DESC_) \
70
globus_common_create_string _ERRSTR_; \
71
*_MIN_RESULT_ = (OM_uint32) globus_i_gsi_gssapi_error_result( \
72
_MIN_, __FILE__, _function_name_, \
73
__LINE__, tmpstr, _LONG_DESC_); \
74
globus_libc_free(tmpstr); \
77
#define GLOBUS_GSI_GSSAPI_OPENSSL_LONG_ERROR_RESULT(_MIN_RESULT_, \
83
globus_common_create_string _ERRORSTR_; \
85
(OM_uint32) globus_i_gsi_gssapi_openssl_error_result( \
86
_ERRORTYPE_, __FILE__, _function_name_, \
87
__LINE__, tmpstr, _LONG_DESC_); \
88
globus_libc_free(tmpstr); \
91
#define GLOBUS_GSI_GSSAPI_LONG_ERROR_CHAIN_RESULT(_MIN_RESULT_, _TOP_RESULT_, \
92
_ERRORTYPE_, _LONG_DESC_) \
93
*_MIN_RESULT_ = (OM_uint32) globus_i_gsi_gssapi_error_chain_result( \
94
(globus_result_t)_TOP_RESULT_, \
95
_ERRORTYPE_, __FILE__, \
96
_function_name_, __LINE__, NULL, _LONG_DESC_)
98
#define GLOBUS_GSI_GSSAPI_MALLOC_ERROR(_MIN_RESULT_) \
101
globus_l_gsi_gssapi_error_strings[ \
102
GLOBUS_GSI_GSSAPI_ERROR_OUT_OF_MEMORY]; \
103
*_MIN_RESULT_ = (OM_uint32) globus_error_put( \
104
globus_error_wrap_errno_error( \
105
GLOBUS_GSI_GSSAPI_MODULE, \
107
GLOBUS_GSI_GSSAPI_ERROR_OUT_OF_MEMORY, \
115
#define GLOBUS_GSI_GSSAPI_ERRNO_ERROR_RESULT(_MIN_RESULT_, \
116
_ERRORTYPE_, _ERRORSTR_) \
119
globus_common_create_string _ERRORSTR_; \
120
*_MIN_RESULT_ = (OM_uint32) globus_error_put( \
121
globus_error_wrap_errno_error( \
122
GLOBUS_GSI_GSSAPI_MODULE, \
130
globus_libc_free(_tmp_str_); \
136
extern int globus_i_gsi_gssapi_debug_level;
137
extern FILE * globus_i_gsi_gssapi_debug_fstream;
138
extern globus_mutex_t globus_i_gssapi_activate_mutex;
139
extern globus_bool_t globus_i_gssapi_active;
144
#define GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_) \
145
(globus_i_gsi_gssapi_debug_level >= (_LEVEL_))
147
#define GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
149
if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_)) \
151
globus_libc_fprintf _MESSAGE_; \
155
#define GLOBUS_I_GSI_GSSAPI_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
157
if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_)) \
160
globus_common_create_nstring _MESSAGE_; \
161
globus_libc_fprintf(globus_i_gsi_gssapi_debug_fstream, \
163
globus_libc_free(_tmp_str_); \
167
#define GLOBUS_I_GSI_GSSAPI_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
169
if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_)) \
171
globus_libc_fprintf( \
172
globus_i_gsi_gssapi_debug_fstream, \
177
#define GLOBUS_I_GSI_GSSAPI_DEBUG_PRINT_OBJECT(_LEVEL_, _TYPE_, _OBJ_) \
179
if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_)) \
182
globus_i_gsi_gssapi_debug_fstream, \
189
#define GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_) 0
190
#define GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_)
191
#define GLOBUS_I_GSI_GSSAPI_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_)
192
#define GLOBUS_I_GSI_GSSAPI_DEBUG_PRINT(_LEVEL_, _MESSAGE_)
193
#define GLOBUS_I_GSI_GSSAPI_DEBUG_PRINT_OBJECT(_LEVEL,_TYPE_, _OBJ_)
197
#define GLOBUS_I_GSI_GSSAPI_DEBUG_ENTER \
198
GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF( \
199
1, (globus_i_gsi_gssapi_debug_fstream, \
200
"%s entering\n", _function_name_))
202
#define GLOBUS_I_GSI_GSSAPI_DEBUG_EXIT \
203
GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF( \
204
1, (globus_i_gsi_gssapi_debug_fstream, \
205
"%s exiting: major_status=%d\n", \
206
_function_name_, (int)major_status))
208
#define GLOBUS_I_GSI_GSSAPI_INTERNAL_DEBUG_EXIT \
209
GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF( \
210
1, (globus_i_gsi_gssapi_debug_fstream, \
214
extern int globus_i_gsi_gssapi_force_tls;
218
GLOBUS_I_GSI_GSS_DEFAULT_CONTEXT,
219
GLOBUS_I_GSI_GSS_ANON_CONTEXT
220
} globus_i_gsi_gss_context_type_t;
223
globus_i_gsi_gss_copy_name_to_name(
224
OM_uint32 * minor_status,
225
gss_name_desc ** output,
226
const gss_name_desc * input);
229
globus_i_gsi_gss_create_and_fill_context(
230
OM_uint32 * minor_status,
231
gss_ctx_id_desc ** context_handle,
232
gss_cred_id_desc * cred_handle,
233
const gss_cred_usage_t cred_usage,
234
OM_uint32 req_flags);
237
globus_i_gsi_gss_create_anonymous_cred(
238
OM_uint32 * minor_status,
239
gss_cred_id_t * output_cred_handle,
240
const gss_cred_usage_t cred_usage);
242
#if LINK_WITH_INTERNAL_OPENSSL_API
244
globus_i_gsi_gss_cred_read_bio(
245
OM_uint32 * minor_status,
246
const gss_cred_usage_t cred_usage,
247
gss_cred_id_t * cred_id_handle,
251
globus_i_gsi_gss_cred_read(
252
OM_uint32 * minor_status,
253
const gss_cred_usage_t cred_usage,
254
gss_cred_id_t * cred_handle,
255
const X509_NAME * desired_subject);
256
#endif /* LINK_WITH_INTERNAL_OPENSSL_API */
259
globus_i_gsi_gss_create_cred(
260
OM_uint32 * minor_status,
261
const gss_cred_usage_t cred_usage,
262
gss_cred_id_t * output_cred_handle_P,
263
globus_gsi_cred_handle_t * cred_handle);
265
int globus_i_gsi_gss_verify_extensions_callback(
266
globus_gsi_callback_data_t callback_data,
267
X509_EXTENSION * extension);
270
globus_i_gsi_gss_handshake(
271
OM_uint32 * minor_status,
272
gss_ctx_id_desc * context_handle);
275
globus_i_gsi_gss_get_token(
276
OM_uint32 * minor_status,
277
const gss_ctx_id_desc * context_handle,
279
const gss_buffer_t output_token);
282
globus_i_gsi_gss_put_token(
283
OM_uint32 * minor_status,
284
const gss_ctx_id_desc * context_handle,
286
const gss_buffer_t input_token);
289
globus_i_gsi_gss_retrieve_peer(
290
OM_uint32 * minor_status,
291
gss_ctx_id_desc * context_handle,
292
const gss_cred_usage_t cred_usage);
295
globus_i_gsi_gss_SSL_write_bio(
296
OM_uint32 * minor_status,
297
gss_ctx_id_desc * context,
301
globus_i_gsi_gss_SSL_read_bio(
302
OM_uint32 * minor_status,
303
gss_ctx_id_desc * context,
307
globus_i_gsi_gss_get_context_goodtill(
308
OM_uint32 * minor_status,
309
gss_ctx_id_t context,
313
globus_i_gsi_gssapi_init_ssl_context(
314
OM_uint32 * minor_status,
315
gss_cred_id_t credential,
316
globus_i_gsi_gss_context_type_t anon_ctx);
319
globus_i_gsi_gssapi_openssl_error_result(
321
const char * filename,
322
const char * function_name,
324
const char * short_desc,
325
const char * long_desc);
328
globus_i_gsi_gssapi_error_result(
329
const OM_uint32 minor_status,
330
const char * filename,
331
const char * function_name,
333
const char * short_desc,
334
const char * long_desc);
337
globus_i_gsi_gssapi_error_chain_result(
338
globus_result_t chain_result,
340
const char * filename,
341
const char * function_name,
343
const char * short_desc,
344
const char * long_desc);
347
globus_i_gsi_gssapi_error_join_chains_result(
348
globus_result_t outter_error,
349
globus_result_t inner_error);
352
globus_i_gsi_gssapi_get_hostname(
353
OM_uint32 * minor_status,
354
gss_name_desc * name);
359
GSS_I_COMPATIBILITY_HYBRID,
360
GSS_I_COMPATIBILITY_STRICT_GT2,
361
GSS_I_COMPATIBILITY_STRICT_RFC2818
363
gss_i_name_compatibility_mode_t;
365
extern gss_i_name_compatibility_mode_t gss_i_name_compatibility_mode;
367
#endif /* GLOBUS_I_GSI_GSS_UTILS_H */