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 00031 #ifndef LCMAPS_UTILS_H 00032 #define LCMAPS_UTILS_H 00033 00034 /****************************************************************************** 00035 Include header files 00036 ******************************************************************************/ 00037 #include <grp.h> 00038 00039 /****************************************************************************** 00040 * Module definition 00041 *****************************************************************************/ 00042 00044 /* Beginning of filename functions */ 00045 /****************************************************************************** 00046 Function: lcmaps_genfilename() (copied from GLOBUS gatekeeper.c) 00047 Description: generate an absolute file name given a starting prefix, 00048 a relative or absolute path, and a suffix 00049 Only use prefix if path is relative. 00050 Parameters: 00051 Returns: a pointer to a string which could be freeded. 00052 ******************************************************************************/ 00053 extern char * lcmaps_genfilename( 00054 char * prefix, 00055 char * path, 00056 char * suffix 00057 ); 00058 00059 /****************************************************************************** 00060 Function: lcmaps_getfexist() 00061 Description: picks the first existing file in argument list 00062 Parameters: n : number of paths, 00063 ... : list of paths 00064 Returns: returns filename found or NULL 00065 ******************************************************************************/ 00066 extern char * lcmaps_getfexist( 00067 int n, 00068 ... 00069 ); 00070 00071 /****************************************************************************** 00072 Function: lcmaps_findfile() 00073 Description: Checks for file in standard directories 00074 Parameters: name 00075 Returns: returns filename found (should be freeed) or NULL 00076 ******************************************************************************/ 00077 extern char * lcmaps_findfile( 00078 char * name 00079 ); /* End of filename functions */ 00081 00082 /****************************************************************************** 00083 Function: lcmaps_get_gidlist() 00084 00085 Description: 00086 Finds the list of gids for user in the group file (/etc/group) 00087 Returns a list of gid_t which should be freed by calling program. 00088 00089 Parameters: 00090 username: the name of the user 00091 ngroups: ptr to int which will be filled with the number of gids. 00092 group_list: ptr to an array of gid_t. 00093 00094 Returns: 00095 0 on success. 00096 -1 on realloc failure 00097 -2 on getgrent failure 00098 1 on failure 00099 ******************************************************************************/ 00100 extern int lcmaps_get_gidlist( 00101 const char * username, 00102 int * ngroups, 00103 gid_t ** group_list 00104 ); 00105 00106 #endif /* LCMAPS_UTILS_H */ 00107 00108 /****************************************************************************** 00109 CVS Information: 00110 $Source: /cvs/jra1mw/org.glite.security.lcmaps/interface/lcmaps_utils.h,v $ 00111 $Date: 2004/12/02 17:32:05 $ 00112 $Revision: 1.3 $ 00113 $Author: msteenba $ 00114 ******************************************************************************/