00001 /* 00002 * Copyright (c) 2001 EU DataGrid. 00003 * For license conditions see http://www.eu-datagrid.org/license.html 00004 * 00005 * Copyright (c) 2001, 2002 by 00006 * Martijn Steenbakkers <martijn@nikhef.nl>, 00007 * David Groep <davidg@nikhef.nl>, 00008 * NIKHEF Amsterdam, the Netherlands 00009 */ 00010 00026 #ifndef LCMAPS_UTILS_H 00027 #define LCMAPS_UTILS_H 00028 00029 /****************************************************************************** 00030 Include header files 00031 ******************************************************************************/ 00032 #include <gssapi.h> 00033 #include "lcmaps_types.h" 00034 #include <grp.h> 00035 00036 /****************************************************************************** 00037 * Module definition 00038 *****************************************************************************/ 00039 00041 /* Beginning of credential functions */ 00042 /****************************************************************************** 00043 Function: lcmaps_get_dn() 00044 Description: returns user dn 00045 Parameters: 00046 lcmaps_cred: lcmaps_credential 00047 Returns: user dn 00048 ******************************************************************************/ 00049 extern char * lcmaps_get_dn( 00050 lcmaps_cred_id_t lcmaps_credential 00051 ); /* End of credential functions */ 00053 00055 /* Beginning of filename functions */ 00056 /****************************************************************************** 00057 Function: lcmaps_genfilename() (copied from GLOBUS gatekeeper.c) 00058 Description: generate an absolute file name given a starting prefix, 00059 a relative or absolute path, and a suffix 00060 Only use prefix if path is relative. 00061 Parameters: 00062 Returns: a pointer to a string which could be freeded. 00063 ******************************************************************************/ 00064 extern char * lcmaps_genfilename( 00065 char * prefix, 00066 char * path, 00067 char * suffix 00068 ); 00069 00070 /****************************************************************************** 00071 Function: lcmaps_getfexist() 00072 Description: picks the first existing file in argument list 00073 Parameters: n : number of paths, 00074 ... : list of paths 00075 Returns: returns filename found or NULL 00076 ******************************************************************************/ 00077 extern char * lcmaps_getfexist( 00078 int n, 00079 ... 00080 ); 00081 00082 /****************************************************************************** 00083 Function: lcmaps_findfile() 00084 Description: Checks for file in standard directories 00085 Parameters: name 00086 Returns: returns filename found (should be freeed) or NULL 00087 ******************************************************************************/ 00088 extern char * lcmaps_findfile( 00089 char * name 00090 ); /* End of filename functions */ 00092 00093 /****************************************************************************** 00094 Function: lcmaps_get_gidlist() 00095 00096 Description: 00097 Finds the list of gids for user in the group file (/etc/group) 00098 Returns a list of gid_t which should be freed by calling program. 00099 00100 Parameters: 00101 username: the name of the user 00102 ngroups: ptr to int which will be filled with the number of gids. 00103 group_list: ptr to an array of gid_t. 00104 00105 Returns: 00106 0 on success. 00107 -1 on realloc failure 00108 -2 on getgrent failure 00109 1 on failure 00110 ******************************************************************************/ 00111 extern int lcmaps_get_gidlist( 00112 const char * username, 00113 int * ngroups, 00114 gid_t ** group_list 00115 ); 00116 00117 #endif /* LCMAPS_UTILS_H */ 00118 00119 /****************************************************************************** 00120 CVS Information: 00121 $Source: /cvs/fabric_mgt/gridification/lcmaps/include/lcmaps_utils.h,v $ 00122 $Date: 2003/07/10 16:33:23 $ 00123 $Revision: 1.4 $ 00124 $Author: martijn $ 00125 ******************************************************************************/