~ubuntu-branches/ubuntu/trusty/globus-gssapi-gsi/trusty

« back to all changes in this revision

Viewing changes to .pc/globus-gssapi-gsi-format.patch/library/globus_i_gsi_gss_utils.h

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2012-04-28 23:15:24 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20120428231524-7xkkedz5ci6lqt9x
Tags: 10.6-1
* Update to Globus Toolkit 5.2.1
* Drop patches globus-gssapi-gsi-deps.patch, globus-gssapi-gsi-format.patch
  and globus-gssapi-gsi-doxygen.patch (fixed upstream)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
/**
19
 
 * @file globus_i_gsi_gss_utils.c
20
 
 * @author Sam Lang, Sam Meder
21
 
 * 
22
 
 * $RCSfile: globus_i_gsi_gss_utils.h,v $
23
 
 * $Revision: 1.24 $
24
 
 * $Date: 2011/11/02 13:47:22 $
25
 
 */
26
 
#endif
27
 
 
28
 
#ifndef GLOBUS_I_GSI_GSS_UTILS_H
29
 
#define GLOBUS_I_GSI_GSS_UTILS_H
30
 
 
31
 
#include "gssapi.h"
32
 
#include "gssapi_openssl.h"
33
 
 
34
 
/* ERROR MACROS */
35
 
 
36
 
#define GLOBUS_GSI_GSSAPI_ERROR_RESULT(_MIN_RESULT_, _MIN_, \
37
 
                                       _ERRSTR_) \
38
 
    if (_MIN_RESULT_ != NULL) \
39
 
    { \
40
 
         char *                         tmpstr = \
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); \
46
 
    }
47
 
 
48
 
#define GLOBUS_GSI_GSSAPI_OPENSSL_ERROR_RESULT(_MIN_RESULT_, \
49
 
                                               _ERRORTYPE_, _ERRORSTR_) \
50
 
    { \
51
 
         char *                         tmpstr = \
52
 
             globus_common_create_string _ERRORSTR_; \
53
 
         *_MIN_RESULT_ = \
54
 
             (OM_uint32) globus_i_gsi_gssapi_openssl_error_result( \
55
 
             _ERRORTYPE_, __FILE__, _function_name_, __LINE__, tmpstr, NULL); \
56
 
         globus_libc_free(tmpstr); \
57
 
    }
58
 
 
59
 
#define GLOBUS_GSI_GSSAPI_ERROR_CHAIN_RESULT(_MIN_RESULT_, _TOP_RESULT_, \
60
 
                                             _ERRORTYPE_) \
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)
65
 
 
66
 
#define GLOBUS_GSI_GSSAPI_LONG_ERROR_RESULT(_MIN_RESULT_, _MIN_, \
67
 
                                            _ERRSTR_, _LONG_DESC_) \
68
 
    { \
69
 
         char *                         tmpstr = \
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); \
75
 
    }
76
 
 
77
 
#define GLOBUS_GSI_GSSAPI_OPENSSL_LONG_ERROR_RESULT(_MIN_RESULT_, \
78
 
                                                    _ERRORTYPE_, \
79
 
                                                    _ERRORSTR_, \
80
 
                                                    _LONG_DESC_) \
81
 
    { \
82
 
         char *                         tmpstr = \
83
 
             globus_common_create_string _ERRORSTR_; \
84
 
         *_MIN_RESULT_ = \
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); \
89
 
    }
90
 
 
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_)
97
 
 
98
 
#define GLOBUS_GSI_GSSAPI_MALLOC_ERROR(_MIN_RESULT_) \
99
 
    { \
100
 
        char *                          _tmp_str_ = \
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, \
106
 
                errno, \
107
 
                GLOBUS_GSI_GSSAPI_ERROR_OUT_OF_MEMORY, \
108
 
                __FILE__, \
109
 
                _function_name_, \
110
 
                __LINE__, \
111
 
                "%s", \
112
 
                _tmp_str_)); \
113
 
    }
114
 
 
115
 
#define GLOBUS_GSI_GSSAPI_ERRNO_ERROR_RESULT(_MIN_RESULT_, \
116
 
                                               _ERRORTYPE_, _ERRORSTR_) \
117
 
    { \
118
 
        char *                          _tmp_str_ = \
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, \
123
 
                errno, \
124
 
                _ERRORTYPE_, \
125
 
                __FILE__, \
126
 
                _function_name_, \
127
 
                __LINE__, \
128
 
                "%s", \
129
 
                _tmp_str_)); \
130
 
        globus_libc_free(_tmp_str_); \
131
 
    }
132
 
 
133
 
 
134
 
/* DEBUG MACROS */
135
 
 
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;
140
 
 
141
 
 
142
 
#ifdef BUILD_DEBUG
143
 
 
144
 
#define GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_) \
145
 
    (globus_i_gsi_gssapi_debug_level >= (_LEVEL_))
146
 
 
147
 
#define GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
148
 
{                                                             \
149
 
    if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_))                   \
150
 
    {                                                         \
151
 
        globus_libc_fprintf _MESSAGE_;                        \
152
 
    }                                                         \
153
 
154
 
 
155
 
#define GLOBUS_I_GSI_GSSAPI_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
156
 
{ \
157
 
        if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_)) \
158
 
        { \
159
 
           char *                       _tmp_str_ = \
160
 
               globus_common_create_nstring _MESSAGE_; \
161
 
           globus_libc_fprintf(globus_i_gsi_gssapi_debug_fstream, \
162
 
                               _tmp_str_); \
163
 
           globus_libc_free(_tmp_str_); \
164
 
        } \
165
 
}
166
 
 
167
 
#define GLOBUS_I_GSI_GSSAPI_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
168
 
{                                                           \
169
 
    if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_))                 \
170
 
    {                                                       \
171
 
        globus_libc_fprintf(                                \
172
 
            globus_i_gsi_gssapi_debug_fstream,              \
173
 
            _MESSAGE_);                                     \
174
 
    }                                                       \
175
 
}
176
 
 
177
 
#define GLOBUS_I_GSI_GSSAPI_DEBUG_PRINT_OBJECT(_LEVEL_, _TYPE_, _OBJ_) \
178
 
{                                                                      \
179
 
    if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_))                            \
180
 
    {                                                                  \
181
 
        _TYPE_##_print_fp(                                             \
182
 
            globus_i_gsi_gssapi_debug_fstream,                         \
183
 
            _OBJ_);                                                    \
184
 
    }                                                                  \
185
 
}
186
 
 
187
 
#else
188
 
 
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_)
194
 
 
195
 
#endif
196
 
 
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_))
201
 
 
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))
207
 
 
208
 
#define GLOBUS_I_GSI_GSSAPI_INTERNAL_DEBUG_EXIT \
209
 
            GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF( \
210
 
                1, (globus_i_gsi_gssapi_debug_fstream, \
211
 
                    "%s exiting\n", \
212
 
                    _function_name_))
213
 
 
214
 
extern int                              globus_i_gsi_gssapi_force_tls;
215
 
 
216
 
typedef enum
217
 
{
218
 
    GLOBUS_I_GSI_GSS_DEFAULT_CONTEXT,
219
 
    GLOBUS_I_GSI_GSS_ANON_CONTEXT
220
 
} globus_i_gsi_gss_context_type_t;
221
 
 
222
 
OM_uint32
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);
227
 
 
228
 
OM_uint32
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);
235
 
 
236
 
OM_uint32
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);
241
 
 
242
 
#if LINK_WITH_INTERNAL_OPENSSL_API
243
 
OM_uint32
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,
248
 
    BIO *                               bp);
249
 
 
250
 
OM_uint32
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 */
257
 
 
258
 
OM_uint32
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);
264
 
 
265
 
int globus_i_gsi_gss_verify_extensions_callback(
266
 
    globus_gsi_callback_data_t          callback_data,
267
 
    X509_EXTENSION *                    extension);
268
 
 
269
 
OM_uint32
270
 
globus_i_gsi_gss_handshake(
271
 
    OM_uint32 *                         minor_status,
272
 
    gss_ctx_id_desc *                   context_handle);
273
 
 
274
 
OM_uint32
275
 
globus_i_gsi_gss_get_token(
276
 
    OM_uint32 *                         minor_status,
277
 
    const gss_ctx_id_desc *             context_handle,
278
 
    BIO *                               bio,
279
 
    const gss_buffer_t                  output_token);
280
 
 
281
 
OM_uint32
282
 
globus_i_gsi_gss_put_token(
283
 
    OM_uint32 *                         minor_status,
284
 
    const gss_ctx_id_desc *             context_handle,
285
 
    BIO *                               bio,
286
 
    const gss_buffer_t                  input_token);
287
 
 
288
 
OM_uint32
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);
293
 
 
294
 
OM_uint32
295
 
globus_i_gsi_gss_SSL_write_bio(
296
 
    OM_uint32 *                         minor_status,
297
 
    gss_ctx_id_desc *                   context,
298
 
    BIO *                               bp);
299
 
 
300
 
OM_uint32
301
 
globus_i_gsi_gss_SSL_read_bio(
302
 
    OM_uint32 *                         minor_status,
303
 
    gss_ctx_id_desc *                   context,
304
 
    BIO *                               bp);
305
 
 
306
 
OM_uint32
307
 
globus_i_gsi_gss_get_context_goodtill(
308
 
    OM_uint32 *                         minor_status,
309
 
    gss_ctx_id_t                        context,
310
 
    time_t *                            goodtill);
311
 
 
312
 
OM_uint32
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);
317
 
 
318
 
globus_result_t
319
 
globus_i_gsi_gssapi_openssl_error_result(
320
 
    int                                 error_type,
321
 
    const char *                        filename,
322
 
    const char *                        function_name,
323
 
    int                                 line_number,
324
 
    const char *                        short_desc,
325
 
    const char *                        long_desc);
326
 
 
327
 
globus_result_t
328
 
globus_i_gsi_gssapi_error_result(
329
 
    const OM_uint32                     minor_status,
330
 
    const char *                        filename,
331
 
    const char *                        function_name,
332
 
    int                                 line_number,
333
 
    const char *                        short_desc,
334
 
    const char *                        long_desc);
335
 
 
336
 
globus_result_t
337
 
globus_i_gsi_gssapi_error_chain_result(
338
 
    globus_result_t                     chain_result,
339
 
    int                                 error_type,
340
 
    const char *                        filename,
341
 
    const char *                        function_name,
342
 
    int                                 line_number,
343
 
    const char *                        short_desc,
344
 
    const char *                        long_desc);
345
 
 
346
 
globus_result_t
347
 
globus_i_gsi_gssapi_error_join_chains_result(
348
 
    globus_result_t                     outter_error,
349
 
    globus_result_t                     inner_error);
350
 
 
351
 
OM_uint32
352
 
globus_i_gsi_gssapi_get_hostname(
353
 
    OM_uint32 *                         minor_status,
354
 
    gss_name_desc *                     name);
355
 
 
356
 
 
357
 
typedef enum
358
 
{
359
 
    GSS_I_COMPATIBILITY_HYBRID,
360
 
    GSS_I_COMPATIBILITY_STRICT_GT2,
361
 
    GSS_I_COMPATIBILITY_STRICT_RFC2818
362
 
}
363
 
gss_i_name_compatibility_mode_t;
364
 
 
365
 
extern gss_i_name_compatibility_mode_t  gss_i_name_compatibility_mode;
366
 
 
367
 
#endif /* GLOBUS_I_GSI_GSS_UTILS_H */