00001 /* 00002 * Copyright (c) Members of the EGEE Collaboration. 2004. 00003 * See http://eu-egee.org/partners/ for details on the copyright holders. 00004 * For license conditions see the license file or 00005 * http://eu-egee.org/license.html 00006 */ 00007 00027 #ifndef _LCMAPS_CREDENTIAL_H 00028 #define _LCMAPS_CREDENTIAL_H 00029 00030 /****************************************************************************** 00031 Include header files 00032 ******************************************************************************/ 00033 #ifdef LCMAPS_GSI_MODE 00034 # include <gssapi.h> 00035 #endif 00036 #include <grp.h> 00037 00038 /****************************************************************************** 00039 Type definitions 00040 ******************************************************************************/ 00041 00050 typedef struct lcmaps_cred_id_s 00051 { 00052 #ifdef LCMAPS_GSI_MODE 00053 gss_cred_id_t cred; 00054 gss_ctx_id_t context; 00055 #endif 00056 char * dn; 00057 char ** fqan; 00058 int nfqan; 00059 } 00060 lcmaps_cred_id_t; 00061 00062 00063 /****************************************************************************** 00064 * Module definition 00065 *****************************************************************************/ 00066 00067 #ifndef LCMAPS_CREDENTIAL_C 00068 # define LCMAPS_CREDENTIAL_STORAGE_CLASS extern 00069 #else 00070 # define LCMAPS_CREDENTIAL_STORAGE_CLASS 00071 #endif 00072 00074 /* Beginning of credential functions */ 00075 00076 #ifdef LCMAPS_GSI_MODE 00077 00078 /****************************************************************************** 00079 Function: lcmaps_credential_store_gss_cred_id_t() 00080 Description: Fill credential with gss_cred_id_t (internally gsi credential) 00081 If the lcmaps credential does not yet contain the DN, 00082 try to retrieve it from the gss credential. 00083 If the lcmaps credential does not yet contain VOMS 00084 attributes, try to retrieve them from the gss credential. 00085 Parameters: 00086 gss_credential: gss credential (internally gsi credential) 00087 plcmaps_credential: pointer to lcmaps_credential 00088 Returns: 0: succes 00089 1: failed to retrieve DN from gss_credential 00090 2: failed to retrieve VOMS attributes 00091 -1: other failure 00092 ******************************************************************************/ 00093 LCMAPS_CREDENTIAL_STORAGE_CLASS int lcmaps_credential_store_gss_cred_id_t( 00094 gss_cred_id_t gss_credential, 00095 lcmaps_cred_id_t * plcmaps_credential 00096 ); 00097 00098 /****************************************************************************** 00099 Function: lcmaps_credential_get_gss_cred_id_t() 00100 Description: returns gss credential (internally gsi credential) 00101 Parameters: 00102 lcmaps_credential: lcmaps_credential 00103 Returns: gss credential 00104 ******************************************************************************/ 00105 LCMAPS_CREDENTIAL_STORAGE_CLASS gss_cred_id_t lcmaps_credential_get_gss_cred_id_t( 00106 lcmaps_cred_id_t lcmaps_credential 00107 ); 00108 00109 /****************************************************************************** 00110 Function: lcmaps_credential_store_gss_ctx_id_t() 00111 Description: Fill credential with gss_ctx_id_t (gss security context) 00112 Parameters: 00113 gss_context: gss security context 00114 plcmaps_credential: pointer to lcmaps_credential 00115 Returns: 0: succes 00116 1: failure 00117 ******************************************************************************/ 00118 LCMAPS_CREDENTIAL_STORAGE_CLASS int lcmaps_credential_store_gss_ctx_id_t( 00119 gss_ctx_id_t gss_context, 00120 lcmaps_cred_id_t * plcmaps_credential 00121 ); 00122 00123 /****************************************************************************** 00124 Function: lcmaps_credential_get_gss_ctx_id_t() 00125 Description: returns gss security context 00126 Parameters: 00127 lcmaps_credential: lcmaps_credential 00128 Returns: gss security context 00129 ******************************************************************************/ 00130 LCMAPS_CREDENTIAL_STORAGE_CLASS gss_ctx_id_t lcmaps_credential_get_gss_ctx_id_t( 00131 lcmaps_cred_id_t lcmaps_credential 00132 ); 00133 00134 #endif /* LCMAPS_GSI_MODE */ 00135 00136 00137 /****************************************************************************** 00138 Function: lcmaps_credential_store_dn() 00139 Description: Fill credential with dn 00140 Parameters: 00141 dn: distinguished name 00142 plcmaps_credential: pointer to lcmaps_credential 00143 Returns: 0: succes 00144 1: failed to fill dn 00145 -1: other failure 00146 ******************************************************************************/ 00147 LCMAPS_CREDENTIAL_STORAGE_CLASS int lcmaps_credential_store_dn( 00148 char * dn, 00149 lcmaps_cred_id_t * plcmaps_credential 00150 ); 00151 00152 /****************************************************************************** 00153 Function: lcmaps_credential_get_dn() 00154 Description: returns user dn 00155 Parameters: 00156 lcmaps_credential: lcmaps_credential 00157 Returns: user dn 00158 ******************************************************************************/ 00159 LCMAPS_CREDENTIAL_STORAGE_CLASS char * lcmaps_credential_get_dn( 00160 lcmaps_cred_id_t lcmaps_credential 00161 ); 00162 00163 /****************************************************************************** 00164 Function: lcmaps_credential_store_fqan_list() 00165 Description: Fill credential with list of FQANs 00166 Parameters: 00167 nfqan: number of elements of the FQAN list 00168 fqan_list: FQAN list (list of strings) 00169 plcmaps_credential: pointer to lcmaps_credential 00170 Returns: 0: succes 00171 1: failure 00172 ******************************************************************************/ 00173 LCMAPS_CREDENTIAL_STORAGE_CLASS int lcmaps_credential_store_fqan_list( 00174 int nfqan, 00175 char ** fqan_list, 00176 lcmaps_cred_id_t * plcmaps_credential 00177 ); 00178 00179 /****************************************************************************** 00180 Function: lcmaps_credential_get_fqan_list() 00181 Description: returns the list of FQANs and number of elements 00182 Parameters: 00183 pnfqan: pointer to the number of FQANs in the list 00184 lcmaps_credential: lcmaps_credential 00185 Returns: list of FQANs 00186 ******************************************************************************/ 00187 LCMAPS_CREDENTIAL_STORAGE_CLASS char ** lcmaps_credential_get_fqan_list( 00188 int * pnfqan, 00189 lcmaps_cred_id_t lcmaps_credential 00190 ); 00191 00192 /****************************************************************************** 00193 Function: lcmaps_credential_init() 00194 Description: initialize the lcmaps_cred_id_t: set the member values to 00195 the default values 00196 Parameters: 00197 plcmaps_credential: pointer to lcmaps_credential 00198 Returns: 0: succes 00199 1: failed to set the member values 00200 -1: other failure 00201 ******************************************************************************/ 00202 LCMAPS_CREDENTIAL_STORAGE_CLASS int lcmaps_credential_init( 00203 lcmaps_cred_id_t * plcmaps_credential 00204 ); 00205 00206 /****************************************************************************** 00207 Function: lcmaps_release_cred() 00208 Description: release lcmaps credential 00209 Parameters: 00210 plcmaps_credential: pointer to lcmaps_credential 00211 Returns: 0: succes 00212 1: failure 00213 ******************************************************************************/ 00214 LCMAPS_CREDENTIAL_STORAGE_CLASS int lcmaps_release_cred( 00215 lcmaps_cred_id_t * plcmaps_credential 00216 ); 00217 /* End of credential functions */ 00219 00220 #endif /* _LCMAPS_CREDENTIAL_H */ 00221 00222 /****************************************************************************** 00223 CVS Information: 00224 $Source: /cvs/jra1mw/org.glite.security.lcmaps/src/grid_credential_handling/_lcmaps_credential.h,v $ 00225 $Date: 2005/02/27 01:30:41 $ 00226 $Revision: 1.2 $ 00227 $Author: msteenba $ 00228 ******************************************************************************/