globus_gss_assist.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef _GLOBUS_GSS_ASSIST_H
00018 #define _GLOBUS_GSS_ASSIST_H
00019 
00025 #include "gssapi.h"
00026 
00027 #include <stdio.h>
00028 #include <stdlib.h>
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 #ifndef GLOBUS_GLOBAL_DOCUMENT_SET
00035 
00039 #endif
00040 
00092 #define GLOBUS_GSI_GSS_ASSIST_MODULE  (&globus_i_gsi_gss_assist_module)
00093 
00094 extern
00095 globus_module_descriptor_t              globus_i_gsi_gss_assist_module;
00096 
00097 #define _GASL(s) globus_common_i18n_get_string( \
00098                     GLOBUS_GSI_GSS_ASSIST_MODULE, \
00099                     s)
00100 #include "globus_gss_assist_constants.h"
00101 
00102 
00103 #define GLOBUS_GSS_ASSIST_TOKEN_ERR_MALLOC              1
00104 #define GLOBUS_GSS_ASSIST_TOKEN_ERR_BAD_SIZE            2
00105 #define GLOBUS_GSS_ASSIST_TOKEN_EOF                     3
00106 #define GLOBUS_GSS_ASSIST_TOKEN_NOT_FOUND               4
00107 
00108 /* for kerberos v5.1.0.5 compatability we need this */
00109 #ifndef GSS_C_NO_NAME
00110 #define GSS_C_NO_NAME ((gss_name_t *) 0)
00111 #define GSS_ASSIST_KRB5_HACK
00112 #endif
00113 
00114 /* for the globus_gss_assist_ex flags: */
00115 
00116 #define GLOBUS_GSS_ASSIST_EX_SEND_WITHOUT_LENGTH  1
00117 
00118 typedef struct globus_gss_assist_ex_st
00119 {
00120         void * arg;
00121         int    flags;
00122 } globus_gss_assist_ex;
00123 
00133 extern int
00134 globus_gss_assist_token_get_fd(
00135     void *                              arg, 
00136     void **                             bufp, 
00137     size_t *                            sizep);
00138 
00139 extern int
00140 globus_gss_assist_token_send_fd(
00141     void *                              arg, 
00142     void *                              buf, 
00143     size_t                              size);
00144 
00145 extern int
00146 globus_gss_assist_token_send_fd_ex(
00147     void *                              arg, 
00148     void *                              buf, 
00149     size_t                              size);
00150 
00151 extern int
00152 globus_gss_assist_token_send_fd_without_length(
00153     void *                              arg, 
00154     void *                              buf, 
00155     size_t                              size);
00156 
00165 extern OM_uint32
00166 globus_gss_assist_acquire_cred(
00167     OM_uint32 *,             /*  minor_status */
00168     gss_cred_usage_t,        /* cred_usage */
00169     gss_cred_id_t *          /* output_cred_handle */);
00170 
00171 /*
00172  * globus_gss_assist_acquire_cred_ext, assist with the gss_acquire_cred
00173  */
00174 extern OM_uint32
00175 globus_gss_assist_acquire_cred_ext(
00176     OM_uint32 *,             /* minor_status */
00177     char *,                  /* desired_name_char */
00178     OM_uint32,               /* time_req */
00179     const gss_OID_set,       /* desired_mechs */
00180     gss_cred_usage_t,        /* cred_usage */
00181     gss_cred_id_t *,         /* output_cred_handle */
00182     gss_OID_set *,           /* actual_mechs */
00183     OM_uint32 *              /* time_rec */);
00184 
00196 extern OM_uint32
00197 globus_gss_assist_accept_sec_context(
00198     OM_uint32 *,                        /* minor_status */
00199     gss_ctx_id_t *,                     /* context_handle */
00200     const gss_cred_id_t,                /* acceptor_cred_handle */
00201     char **,                            /* src_name as char ** */
00202     OM_uint32 *,                        /* ret_flags */
00203     int *,                              /* user_to_user_flag */
00204     int *,                              /* token_status */
00205     gss_cred_id_t *,                    /* delegated_cred_handle */
00206     int (* get_token)(void *, void **, size_t *),
00207     void *                              get_context,
00208     int (* send_token)(void *, void *, size_t),
00209     void *                              send_context);
00210 
00211 /*
00212  * globus_gss_assist_accept_sec_context_async - async version of
00213  * globus_gss_assist_accept_sec_context().
00214  */
00215 extern OM_uint32
00216 globus_gss_assist_accept_sec_context_async(
00217     OM_uint32 *                         minor_status,
00218     gss_ctx_id_t *                      context_handle,
00219     const gss_cred_id_t                 cred_handle,
00220     char **                             src_name_char,
00221     OM_uint32 *                         ret_flags,
00222     int *                               user_to_user_flag,
00223     void *                              input_buffer,
00224     size_t                              input_buffer_len,
00225     void **                             output_bufferp,
00226     size_t *                            output_buffer_lenp,
00227     gss_cred_id_t *                     delegated_cred_handle);
00228 
00229 /*
00230  * globus_gss_assist_init_sec_context - takes care of looping
00231  * over multiple tokens using the get and send tokens
00232  * routines
00233  */
00234 extern OM_uint32
00235 globus_gss_assist_init_sec_context(
00236     OM_uint32 *,                        /* minor_status */
00237     const gss_cred_id_t,                /* initiator_cred_handle */
00238     gss_ctx_id_t *,                     /* context_handle */
00239     char *,                             /* target_name as char * */
00240     OM_uint32,                          /* req_flags */
00241     OM_uint32 *,                        /* ret_flags */
00242     int *,                              /* token_status */
00243     int (* get_token)(void *, void **, size_t *),
00244     void *                              get_arg,
00245     int (* send_token)(void *, void *, size_t),
00246     void *                              send_arg);
00247 
00248 /*
00249  * globus_gss_assist_init_sec_context_async - async version of
00250  * globus_gss_assist_init_sec_context().
00251  */
00252 extern OM_uint32
00253 globus_gss_assist_init_sec_context_async(
00254     OM_uint32 *                         minor_status,
00255     const gss_cred_id_t                 cred_handle,
00256     gss_ctx_id_t *                      context_handle,
00257     char *                              target_name_char,
00258     OM_uint32                           req_flags,
00259     OM_uint32 *                         ret_flags,
00260     void *                              input_buffer,
00261     size_t                              input_buffer_len,
00262     void **                             output_bufferp,
00263     size_t *                            output_buffer_lenp);
00264 
00273 extern OM_uint32
00274 globus_gss_assist_display_status(
00275     FILE *,                             /* where to print */
00276     char *,                             /* comment */
00277     OM_uint32,                          /* major_status */
00278     OM_uint32,                          /* minor_status */
00279     int                                 /* token_status */);
00280 
00281 extern OM_uint32
00282 globus_gss_assist_display_status_str(
00283     char **,                            /* string returned with newlines */
00284     char *,                             /* comment */
00285     OM_uint32,                          /* major_status */
00286     OM_uint32,                          /* minor_status */
00287     int                                 /* token_status */);
00288 
00289 /*
00290  * globus_gss_assist_wrap_send - used to wrap a 
00291  * simple message and send it
00292  */
00293 extern OM_uint32
00294 globus_gss_assist_wrap_send(
00295     OM_uint32 *                         minor_status,
00296     const gss_ctx_id_t                  context_handle,
00297     char *                              data,
00298     size_t                              length,
00299     int *                               token_status,
00300     int (*gss_assist_send_token)(void *, void *, size_t),
00301     void *                              gss_assist_send_context,
00302     FILE *                              fperr);
00303 
00304 /*
00305  * globus_gss_assist_get_unwrap - used to get and unwrap a message
00306  */
00307 extern OM_uint32
00308 globus_gss_assist_get_unwrap(
00309     OM_uint32 *                         minor_status,
00310     const gss_ctx_id_t                  context_handle,
00311     char **                             data,
00312     size_t *                            length,
00313     int *                               token_status,
00314     int (*gss_assist_get_token)(void *, void **, size_t *),
00315     void *                              gss_assist_get_context,
00316     FILE *                              fperr);
00317 
00318 /*
00319  * globus_gss_assist_will_handle_restrictions - used to tell openssl
00320  * that the application will deal with the restrictions extension
00321  */
00322 OM_uint32
00323 globus_gss_assist_will_handle_restrictions(
00324     OM_uint32 *                         minor_status,
00325     gss_ctx_id_t *                      context_handle);
00326 
00327 
00328 /*
00329  * globus_gss_assist_import_sec_context - read a security context
00330  */
00331 extern OM_uint32
00332 globus_gss_assist_export_sec_context(
00333     OM_uint32 *                         minor_status,
00334     gss_ctx_id_t *                      context_handle,
00335     int *                               token_status,
00336     int                                 fdp,
00337     FILE *                              fperr);
00338 
00339 /*
00340  * globus_gss_assist_import_sec_context - read a security context
00341  */
00342 extern OM_uint32
00343 globus_gss_assist_import_sec_context(
00344     OM_uint32 *                         minor_status,
00345     gss_ctx_id_t *                      context_handle,
00346     int *                               token_status,
00347     int                                 fdp,
00348     FILE *                              fperr);
00349 
00350 
00351 globus_result_t
00352 globus_gss_assist_authorization_host_name(
00353     char *                              hostname,
00354     gss_name_t *                        authorization_hostname);
00355 
00365 extern int
00366 globus_gss_assist_gridmap(
00367     char *                              globusidp, 
00368     char **                             useridp);
00369 
00370 extern int
00371 globus_gss_assist_userok(
00372     char *                              globusid,
00373     char *                              userid);
00374 
00375 extern int
00376 globus_gss_assist_map_local_user(
00377     char *                              local_user,
00378     char **                             globusidp);
00379 
00380 globus_result_t
00381 globus_gss_assist_lookup_all_globusid(
00382     char *                                      username,
00383     char **                                     dns[],
00384     int *                                       dn_count);
00385 
00386 globus_result_t
00387 globus_gss_assist_map_and_authorize(
00388     gss_ctx_id_t                        context,
00389     char *                              service,
00390     char *                              desired_identity,
00391     char *                              identity_buffer,
00392     unsigned int                        identity_buffer_length);
00393 
00394 globus_result_t
00395 globus_gss_assist_map_and_authorize_sharing(
00396     char *                              shared_user_certificate,
00397     gss_ctx_id_t                        context,
00398     char *                              desired_identity,
00399     char *                              identity_buffer,
00400     unsigned int                        identity_buffer_length);
00401 
00402 
00417 #define GlobusGssAssistFreeDNArray(dn_a)                    \
00418 {                                                           \
00419     int __ctr = 0;                                          \
00420     while(dn_a[__ctr] != NULL)                              \
00421     {                                                       \
00422         free(dn_a[__ctr]);                                  \
00423         __ctr++;                                            \
00424     }                                                       \
00425     free(dn_a);                                             \
00426 }
00427 
00428 
00429 #ifdef __cplusplus
00430 }
00431 #endif
00432 
00433 #endif /* _GLOBUS_GSS_ASSIST_H */

Generated on 15 Sep 2014 for globus_gss_assist by  doxygen 1.4.7