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 00008 /* 00009 * Copyright (c) 2001 EU DataGrid. 00010 * For license conditions see http://www.eu-datagrid.org/license.html 00011 * 00012 * Copyright (c) 2001, 2002 by 00013 * Martijn Steenbakkers <martijn@nikhef.nl>, 00014 * David Groep <davidg@nikhef.nl>, 00015 * NIKHEF Amsterdam, the Netherlands 00016 */ 00017 00055 #ifndef LCMAPS_H 00056 #define LCMAPS_H 00057 00058 #ifndef LCMAPS_C 00059 # define LCMAPS_C_STORAGE_CLASS extern 00060 #else 00061 # define LCMAPS_C_STORAGE_CLASS 00062 #endif 00063 00064 00065 /****************************************************************************** 00066 Include header files 00067 ******************************************************************************/ 00068 #ifdef LCMAPS_GSI_MODE 00069 # include <gssapi.h> 00070 #endif 00071 #include "lcmaps_types.h" 00072 00073 /****************************************************************************** 00074 * Module definition 00075 *****************************************************************************/ 00076 00077 00078 /****************************************************************************** 00079 Function: lcmaps_init 00080 Description: 00081 Initialize LCMAPS module: 00082 setup logging, error handling 00083 start PluginManager 00084 00085 Parameters: 00086 fp: file handle for logging (from gatekeeper) 00087 Returns: 00088 0: initialization succeeded 00089 1: initialization failed 00090 ******************************************************************************/ 00107 LCMAPS_C_STORAGE_CLASS int lcmaps_init( 00108 FILE* fp 00109 ); 00110 00111 /****************************************************************************** 00112 Function: lcmaps_init_and_log 00113 Description: 00114 Select logging type 00115 Start PluginManager: 00116 read from LCMAPS config file, the plugins to be loaded 00117 00118 Parameters: 00119 fp: file handle for logging (from gatekeeper or other previously opened file handle) 00120 If the file handle is zero, assume that only syslogging is requested 00121 logtype: type of logging (usrlog and/or syslog) 00122 00123 Returns: 00124 0: initialization succeeded 00125 1: initialization failed 00126 ******************************************************************************/ 00145 LCMAPS_C_STORAGE_CLASS int lcmaps_init_and_log( 00146 FILE* fp, 00147 unsigned short logtype 00148 ); 00149 00150 /****************************************************************************** 00151 Function: lcmaps_init_and_logfile 00152 Description: 00153 Select logging type 00154 Setup logging by providing a file handle or file name, error handling (not yet). 00155 Start PluginManager: 00156 read from LCMAPS config file, the plugins to be loaded 00157 00158 Parameters: 00159 logfile: name of logfile 00160 fp: file handle for logging (from gatekeeper or other previously opened file handle) 00161 If the file handle is zero, assume that only syslogging is requested 00162 logtype: type of logging (usrlog and/or syslog) 00163 00164 Returns: 00165 0: initialization succeeded 00166 1: initialization failed 00167 ******************************************************************************/ 00188 LCMAPS_C_STORAGE_CLASS int lcmaps_init_and_logfile( 00189 char * logfile, 00190 FILE* fp, 00191 unsigned short logtype 00192 ); 00193 00194 00195 /****************************************************************************** 00196 Function: lcmaps_term 00197 Description: 00198 Terminate LCMAPS module: 00199 00200 Parameters: 00201 Returns: 00202 0: termination succeeded 00203 1: termination failed 00204 ******************************************************************************/ 00216 LCMAPS_C_STORAGE_CLASS int lcmaps_term(); 00217 00218 00219 /****************************************************************************** 00220 Function: lcmaps_run_without_credentials_and_return_username 00221 Description: 00222 Based on the only the user DN do the following: 00223 Do the user mapping based on the provided list of policies (first successful 00224 policy found in the lcmaps policy file (lcmaps.db) will result in the user 00225 mapping) and return user name. 00226 This interface can be used to provide the legacy 00227 GLOBUS_GSS_ASSIST_GRIDMAP() 00228 interface. 00229 00230 Parameters: 00231 user_dn_tmp : user DN 00232 request : RSL string 00233 usernamep : pointer to user name (to be freed by calling application) 00234 npols : number of policies to be considered for evaluation 00235 policynames : the names of the policies to be considered for evaluation 00236 00237 Returns: 00238 0: mapping succeeded 00239 1: mapping failed 00240 ******************************************************************************/ 00269 LCMAPS_C_STORAGE_CLASS int lcmaps_run_without_credentials_and_return_username( 00270 char * user_dn_tmp, 00271 lcmaps_request_t request, 00272 char ** usernamep, 00273 int npols, 00274 char ** policynames 00275 ); 00276 00277 00278 /****************************************************************************** 00279 Function: lcmaps_run_with_fqans_and_return_account 00280 Description: 00281 LCMAPS will run with a list of FQANs and the DN as an input. In addition a 00282 list of policies may be provided. 00283 The allocated uid, gids and the poolindex will be returned to the calling 00284 application. 00285 This interface is intended to be used by a wrapper function for the 00286 DYNAMIC ACCOUNTS SERVICE (DAS). 00287 00288 Parameters: 00289 user_dn : the DN of the user 00290 fqan_list : the list of (VOMS) FQANs that have been asserted to the user 00291 nfqan : the number of FQANs in fqan_list 00292 request : RSL string 00293 npols : number of policies to be considered for evaluation 00294 policynames : the names of the policies to be considered for evaluation 00295 puid : pointer to the uid found (output parameter) 00296 ppgid_list : pointer to the list of primary gids found (output parameter) 00297 psgid_list : pointer to the list of secondary gids found (output parameter) 00298 poolindexp : pointer to poolindex string (output parameter) 00299 00300 Returns: 00301 0: mapping succeeded 00302 1: mapping failed 00303 ******************************************************************************/ 00345 LCMAPS_C_STORAGE_CLASS int lcmaps_run_with_fqans_and_return_account( 00346 char * user_dn, 00347 char ** fqan_list, 00348 int nfqan, 00349 lcmaps_request_t request, 00350 int npols, 00351 char ** policynames, 00352 uid_t * puid, 00353 gid_t ** ppgid_list, 00354 int * pnpgid, 00355 gid_t ** psgid_list, 00356 int * pnsgid, 00357 char ** poolindexp 00358 ); 00359 00360 00361 #ifdef LCMAPS_GSI_MODE 00362 /****************************************************************************** 00363 Function: lcmaps_run 00364 Description: 00365 Do the user mapping based on the user's gss (gsi) credential and the job 00366 request. 00367 This is the legacy lcmaps interface and is used by 00368 the GATEKEEPER. 00369 00370 Parameters: 00371 request: RSL string 00372 user_cred : user globus credential handle 00373 Returns: 00374 0: mapping succeeded 00375 1: mapping failed 00376 ******************************************************************************/ 00377 #if ALLOW_EMPTY_CREDENTIALS 00378 00400 LCMAPS_C_STORAGE_CLASS int lcmaps_run( 00401 char * user_dn_tmp, 00402 gss_cred_id_t user_cred, 00403 lcmaps_request_t request 00404 ); 00405 #else 00406 00424 LCMAPS_C_STORAGE_CLASS int lcmaps_run( 00425 gss_cred_id_t user_cred, 00426 lcmaps_request_t request 00427 ); 00428 #endif 00429 00430 00431 /****************************************************************************** 00432 Function: lcmaps_run_and_return_username 00433 Description: 00434 do the user mapping based on the provided list of policies (first successful 00435 policy found in the lcmaps policy file (lcmaps.db) will result in the user 00436 mapping) and return user name. 00437 This interface is used by the 00438 GRIDFTP SERVER. 00439 00440 Parameters: 00441 request : RSL string 00442 user_cred : user globus credential handle 00443 usernamep : pointer to user name (to be freed by calling application) 00444 npols : number of policies to be considered for evaluation 00445 policynames : the names of the policies to be considered for evaluation 00446 00447 Returns: 00448 0: mapping succeeded 00449 1: mapping failed 00450 ******************************************************************************/ 00451 #if ALLOW_EMPTY_CREDENTIALS 00452 00483 LCMAPS_C_STORAGE_CLASS int lcmaps_run_and_return_username( 00484 char * user_dn_tmp, 00485 gss_cred_id_t user_cred, 00486 lcmaps_request_t request, 00487 char ** usernamep, 00488 int npols, 00489 char ** policynames 00490 ); 00491 #else 00492 00519 LCMAPS_C_STORAGE_CLASS int lcmaps_run_and_return_username( 00520 gss_cred_id_t user_cred, 00521 lcmaps_request_t request, 00522 char ** usernamep, 00523 int npols, 00524 char ** policynames 00525 ); 00526 #endif 00527 00528 00529 /****************************************************************************** 00530 Function: lcmaps_run_and_return_poolindex 00531 Description: 00532 do the user mapping based on the provided list of policies (first successful 00533 policy found in the lcmaps policy file (lcmaps.db) will result in the user 00534 mapping) and return the poolindex 00535 This interface was intended to be used by a wrapper function for the 00536 DYNAMIC ACCOUNTS SERVICE (DAS). 00537 00538 Parameters: 00539 request : RSL string 00540 user_cred : user globus credential handle 00541 poolindexp : pointer to poolindex (to be freed by calling application). 00542 Note: poolindexp should be non-NULL at the start ! 00543 npols : number of policies to be considered for evaluation 00544 policynames : the names of the policies to be considered for evaluation 00545 00546 Returns: 00547 0: mapping succeeded 00548 1: mapping failed 00549 ******************************************************************************/ 00550 #if ALLOW_EMPTY_CREDENTIALS 00551 00581 LCMAPS_C_STORAGE_CLASS int lcmaps_run_and_return_poolindex( 00582 char * user_dn_tmp, 00583 gss_cred_id_t user_cred, 00584 lcmaps_request_t request, 00585 char ** poolindexp, 00586 int npols, 00587 char ** policynames 00588 ); 00589 #else 00590 00616 LCMAPS_C_STORAGE_CLASS int lcmaps_run_and_return_poolindex( 00617 gss_cred_id_t user_cred, 00618 lcmaps_request_t request, 00619 char ** poolindexp, 00620 int npols, 00621 char ** policynames 00622 ); 00623 #endif 00624 #endif /* LCMAPS_GSI_MODE*/ 00625 00626 #endif /* LCMAPS_H */ 00627 00628 /****************************************************************************** 00629 CVS Information: 00630 $Source: /cvs/jra1mw/org.glite.security.lcmaps-interface/interface/lcmaps.h,v $ 00631 $Date: 2005/05/27 16:22:21 $ 00632 $Revision: 1.7 $ 00633 $Author: msteenba $ 00634 ******************************************************************************/