Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

lcas_utils.c File Reference

the utilities for the LCAS More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <stdarg.h>
#include <gssapi.h>
#include "lcas_defines.h"
#include "lcas_types.h"

Go to the source code of this file.

Functions

char * cred_to_dn (gss_cred_id_t)
 Get the globus DN from GLOBUS credential (gssapi).

int fexist (char *)
 check the existence of file corresponding to <path>

int lcas_fill_cred (char *dn, gss_cred_id_t cred, lcas_cred_id_t *plcas_cred)
 Fill cedential from distinghuished name and globus credential.

int lcas_release_cred (lcas_cred_id_t *plcas_cred)
 Release the LCAS credential.

char * lcas_get_dn (lcas_cred_id_t lcas_credential)
 Retrieve user DN from (LCAS) credential.

gss_cred_id_t lcas_get_gss_cred (lcas_cred_id_t lcas_credential)
 Retrieve globus gss credential from (LCAS) credential.

char * lcas_genfilename (char *prefixp, char *pathp, char *suffixp)
 Generate an absolute file name.

char * lcas_getfexist (int n,...)
 Picks the first existing file in argument list.

char * lcas_findfile (char *name)
 Checks for file in standard directories.

int lcas_tokenize (const char *command, char **args, int *n, char *sep)
 Break the argument string up into tokens.


Detailed Description

the utilities for the LCAS

Author:
Martijn Steenbakkers for the EU DataGrid.

Definition in file lcas_utils.c.


Function Documentation

char * cred_to_dn gss_cred_id_t  globus_cred  )  [static]
 

Get the globus DN from GLOBUS credential (gssapi).

(copied and modified from GLOBUS gatekeeper.c)

Parameters:
globus_cred GLOBUS credential
Returns:
globus DN string (which may be freed)

Definition at line 150 of file lcas_utils.c.

Referenced by lcas_fill_cred().

int fexist char *  path  )  [static]
 

check the existence of file corresponding to <path>

Parameters:
path absolute filename to be checked.
Return values:
1 file exists.
0 failure.

Definition at line 259 of file lcas_utils.c.

Referenced by lcas_getfexist().

int lcas_fill_cred char *  dn,
gss_cred_id_t  cred,
lcas_cred_id_t plcas_cred
 

Fill cedential from distinghuished name and globus credential.

The LCAS credential only differs from the GLOBUS credential by the extra entry for the dn. This allows (temporarily) the passed delegated GLOBUS credential to be empty.

Parameters:
dn distinguished name
cred GLOBUS credential
plcas_cred pointer to LCAS credential to be filled.
Return values:
0 succes.
1 failure.

Definition at line 60 of file lcas_utils.c.

References lcas_cred_id_s::cred, cred_to_dn(), lcas_cred_id_s::dn, and lcas_cred_id_t.

Referenced by lcas_get_fabric_authorization().

char* lcas_findfile char *  name  ) 
 

Checks for file in standard directories.

The directories that are checked are:

  • current directory
  • "modules"
  • LCAS_ETC_HOME
  • LCAS_MOD_HOME
  • LCAS_LIB_HOME

Parameters:
name string containing the file name
Returns:
pointer to a string containing the absolute path to the file, which has to be freed or NULL.

Definition at line 315 of file lcas_utils.c.

References LCAS_ETC_HOME, lcas_genfilename(), lcas_getfexist(), LCAS_LIB_HOME, and LCAS_MOD_HOME.

Referenced by plugin_initialize(), and PluginInit().

char* lcas_genfilename char *  prefixp,
char *  pathp,
char *  suffixp
 

Generate an absolute file name.

Given a starting prefix, a relative or absolute path, and a suffix an absolute file name is generated. Uses the prefix only if the path is relative. (Copied (and modified) from GLOBUS gatekeeper.c)

Parameters:
prefixp string containing the prefix to be prepended.
pathp relative/absolute path to file name.
suffixp string containing the suffix to be appended.
Returns:
pointer to a string containing the absolute path to the file, which has to be freed.

Definition at line 202 of file lcas_utils.c.

Referenced by lcas_findfile(), lcas_init_and_logfile(), lcas_setup(), and PluginInit().

char* lcas_get_dn lcas_cred_id_t  lcas_credential  ) 
 

Retrieve user DN from (LCAS) credential.

This function takes an LCAS credential as input and returns the corresponding user distinguished name (DN).

(Internal:) If the GLOBUS credential part of the LCAS credential is empty the user DN is already included in the LCAS credential.

Parameters:
lcas_credential the LCAS credential
Returns:
a string containing the user DN

Definition at line 111 of file lcas_utils.c.

References lcas_cred_id_s::dn, and lcas_cred_id_t.

Referenced by lcas_get_fabric_authorization(), and plugin_confirm_authorization().

gss_cred_id_t lcas_get_gss_cred lcas_cred_id_t  lcas_credential  ) 
 

Retrieve globus gss credential from (LCAS) credential.

This function takes an LCAS credential as input and returns the corresponding globus gss credential.

Parameters:
lcas_credential the LCAS credential
Returns:
globus gss credential

Definition at line 125 of file lcas_utils.c.

References lcas_cred_id_s::cred, and lcas_cred_id_t.

char* lcas_getfexist int  n,
... 
 

Picks the first existing file in argument list.

Parameters:
n the number of paths presented in the following argument list.
... variable argument list of paths.
Returns:
filename found or NULL

Definition at line 290 of file lcas_utils.c.

References fexist().

Referenced by lcas_findfile(), plugin_initialize(), and PluginInit().

int lcas_release_cred lcas_cred_id_t plcas_cred  ) 
 

Release the LCAS credential.

Parameters:
plcas_cred pointer to LCAS credential to be released
Return values:
0 succes.
1 failure.

Definition at line 90 of file lcas_utils.c.

References lcas_cred_id_s::dn, and lcas_cred_id_t.

Referenced by lcas_get_fabric_authorization().

int lcas_tokenize const char *  command,
char **  args,
int *  n,
char *  sep
 

Break the argument string up into tokens.

Breakup the command in to arguments, pointing the args array at the tokens. Replace white space at the end of each token with a null. A token maybe in quotes. (Copied (and modified) from GLOBUS gatekeeper.c)

Parameters:
command the command line to be parsed
args pointer to an array of pointers to be filled
n size of the array, on input, and set to size used on output
sep string of separating characters
Return values:
0 succes
-1 malloc error
-2 too many args
-3 quote not matched

Definition at line 366 of file lcas_utils.c.

Referenced by lcas_setup(), and parse_args_plugin().


Generated on Fri May 27 18:10:49 2005 for lcas by doxygen 1.3.5