17 #ifndef GLOBUS_I_XIO_GSI_H
18 #define GLOBUS_I_XIO_GSI_H
21 #include "globus_xio_driver.h"
22 #include "globus_xio_load.h"
27 #include "globus_error_gssapi.h"
29 #define GLOBUS_XIO_GSI_DRIVER_MODULE GlobusXIOMyModule(gsi)
33 #define GlobusLXIOGSICreateHeader(__iovec, __length) \
35 *(((unsigned char *) (__iovec).iov_base)) = \
36 (unsigned char) (((__length) >> 24) & 0xff); \
37 *(((unsigned char *) (__iovec).iov_base)+1) = \
38 (unsigned char) (((__length) >> 16) & 0xff); \
39 *(((unsigned char *) (__iovec).iov_base)+2) = \
40 (unsigned char) (((__length) >> 8) & 0xff); \
41 *(((unsigned char *) (__iovec).iov_base)+3) = \
42 (unsigned char) (((__length) ) & 0xff); \
47 #define GlobusLXIOGSIGetTokenLength(__iovec, __length) \
50 c = (__iovec).iov_base; \
51 (__length) = ((globus_size_t) (*((c)++))) << 24; \
52 (__length) |= ((globus_size_t) (*((c)++))) << 16; \
53 (__length) |= ((globus_size_t) (*((c)++))) << 8; \
54 (__length) |= ((globus_size_t) (*((c)++))); \
60 #define GlobusXIOErrorWrapGSSFailed(failed_func, major_status, minor_status) \
62 globus_error_wrap_gssapi_error( \
63 GLOBUS_XIO_GSI_DRIVER_MODULE, \
66 GLOBUS_XIO_GSI_ERROR_WRAP_GSSAPI, \
70 _XIOSL("%s failed."), \
74 #define GlobusXioGSIErrorBadProtectionLevel() \
76 globus_error_construct_error( \
77 GLOBUS_XIO_GSI_DRIVER_MODULE, \
79 GLOBUS_XIO_GSI_ERROR_INVALID_PROTECTION_LEVEL, \
83 _XIOSL("Peer specified lower protection level")))
85 #define GlobusXioGSIErrorTokenTooBig() \
87 globus_error_construct_error( \
88 GLOBUS_XIO_GSI_DRIVER_MODULE, \
90 GLOBUS_XIO_GSI_ERROR_TOKEN_TOO_BIG, \
94 _XIOSL("Token size exceeds limit. Usually happens when someone tries to establish a insecure connection with a secure endpoint, e.g. when someone sends plain HTTP to a HTTPS endpoint without first establishing a SSL session.")))
96 #define GlobusXioGSIErrorEmptyTargetName() \
98 globus_error_construct_error( \
99 GLOBUS_XIO_GSI_DRIVER_MODULE, \
101 GLOBUS_XIO_GSI_ERROR_EMPTY_TARGET_NAME, \
105 _XIOSL("Identity authorization requested, but no target name set")))
107 #define GlobusXioGSIErrorEmptyHostName() \
109 globus_error_construct_error( \
110 GLOBUS_XIO_GSI_DRIVER_MODULE, \
112 GLOBUS_XIO_GSI_ERROR_EMPTY_HOST_NAME, \
116 _XIOSL("Host authorization requested, but no host name set")))
118 #define GlobusXioGSIAuthorizationFailed(_peer_name, _expected_name) \
120 globus_error_construct_error( \
121 GLOBUS_XIO_GSI_DRIVER_MODULE, \
123 GLOBUS_XIO_GSI_AUTHORIZATION_FAILED, \
127 _XIOSL("The peer authenticated as %s. Expected the peer " \
128 "to authenticate as %s"), (_peer_name), (_expected_name)))
133 GlobusDebugDeclare(GLOBUS_XIO_GSI);
135 #define GLOBUS_XIO_GSI_DEBUG_TRACE 4
136 #define GLOBUS_XIO_GSI_DEBUG_INTERNAL_TRACE 8
138 #define GlobusXIOGSIDebugPrintf(level, message) \
139 GlobusDebugPrintf(GLOBUS_XIO_GSI, level, message)
141 #define GlobusXIOGSIDebugEnter() \
142 GlobusXIOGSIDebugPrintf( \
143 GLOBUS_XIO_GSI_DEBUG_TRACE, \
144 (_XIOSL("[%s] Entering\n"), _xio_name))
146 #define GlobusXIOGSIDebugExit() \
147 GlobusXIOGSIDebugPrintf( \
148 GLOBUS_XIO_GSI_DEBUG_TRACE, \
149 (_XIOSL("[%s] Exiting\n"), _xio_name))
151 #define GlobusXIOGSIDebugExitWithError() \
152 GlobusXIOGSIDebugPrintf( \
153 GLOBUS_XIO_GSI_DEBUG_TRACE, \
154 (_XIOSL("[%s] Exiting with error\n"), _xio_name))
156 #define GlobusXIOGSIDebugInternalEnter() \
157 GlobusXIOGSIDebugPrintf( \
158 GLOBUS_XIO_GSI_DEBUG_INTERNAL_TRACE, \
159 (_XIOSL("[%s] I Entering\n"), _xio_name))
161 #define GlobusXIOGSIDebugInternalExit() \
162 GlobusXIOGSIDebugPrintf( \
163 GLOBUS_XIO_GSI_DEBUG_INTERNAL_TRACE, \
164 (_XIOSL("[%s] I Exiting\n"), _xio_name))
166 #define GlobusXIOGSIDebugInternalExitWithError() \
167 GlobusXIOGSIDebugPrintf( \
168 GLOBUS_XIO_GSI_DEBUG_INTERNAL_TRACE, \
169 (_XIOSL("[%s] I Exiting with error\n"), _xio_name))
176 gss_cred_id_t credential;
180 gss_channel_bindings_t channel_bindings;
184 gss_name_t target_name;
187 char * credentials_dir;
188 unsigned char * alpn_list;
189 size_t alpn_list_len;
198 globus_l_attr_t * attr;
201 OM_uint32 max_wrap_size;
202 gss_ctx_id_t context;
203 gss_cred_id_t delegated_cred;
204 gss_cred_id_t credential;
206 gss_name_t peer_name;
207 gss_name_t local_name;
208 size_t write_iovec_count;
209 globus_xio_iovec_t * write_iovec;
211 size_t write_header_count;
212 unsigned char * write_headers;
214 globus_xio_iovec_t read_iovec[2];
215 unsigned char header[4];
216 unsigned char * read_buffer;
218 globus_xio_iovec_t * user_iovec;
219 size_t user_iovec_count;
220 size_t user_iovec_index;
221 size_t user_iovec_offset;
222 unsigned char * unwrapped_buffer;
227 globus_object_t * result_obj;
230 globus_xio_driver_handle_t xio_driver_handle;
232 gss_cred_id_t *cred_array;
233 size_t cred_array_length;
243 globus_l_handle_t * xio_handle;
250 gss_OID_set restriction_oids;
251 gss_buffer_set_t restriction_buffers;
254 globus_xio_iovec_t iovec[2];
255 unsigned char header[4];
257 globus_object_t * result_obj;
259 } globus_l_delegation_handle_t;
267 OM_uint32 * time_rec;
268 gss_cred_id_t * cred;
269 } globus_l_xio_gsi_delegation_arg_t;
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
void(* globus_xio_gsi_delegation_init_callback_t)(globus_result_t result, void *user_arg)
Definition: globus_xio_gsi.h:379
Mutex.
Definition: globus_thread.h:107
globus_xio_gsi_authorization_mode_t
Definition: globus_xio_gsi.h:357
Condition variable.
Definition: globus_thread.h:124
globus_xio_gsi_protection_level_t
Definition: globus_xio_gsi.h:312
size_t globus_size_t
Standard size of memory objectThe globus_size_t is the size of a memory object. It is identical to si...
Definition: globus_types.h:48
Headers common to all of Globus.
uint32_t globus_result_t
Definition: globus_types.h:99
void(* globus_xio_gsi_delegation_accept_callback_t)(globus_result_t result, gss_cred_id_t delegated_cred, OM_uint32 time_rec, void *user_arg)
Definition: globus_xio_gsi.h:387