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

lcas.c File Reference

LCAS - the local centre authorization service. More...

#include "lcas_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gssapi.h>
#include "lcas_types.h"
#include "_lcas_utils.h"
#include "_lcas_defines.h"
#include "_lcas_log.h"
#include "_lcas_db_read.h"

Go to the source code of this file.

Data Structures

struct  lcas_plugindl_s
 the plugin authorization module structure More...


Defines

#define NUL   '\0'
#define MAXAUTHMODS   3
#define MAXPROCS   3
#define FAILED_LCAS_USERALLOW   1
#define FAILED_LCAS_USERBAN   2
#define FAILED_LCAS_CLOCKCHECK   3
#define FAILED_LCAS_OTHER   4
#define FAILED_LCAS_PLUGIN   5

Typedefs

typedef int(* lcas_proc_t )()
 this type corresponds to the types of the plugin interface functions

typedef lcas_plugindl_s lcas_plugindl_t
 the type definition of the plugin authorization module structure


Enumerations

enum  lcas_proctype_e { INITPROC, AUTHPROC, TERMPROC }
 This enumeration type gives the different plugin symbol/function types. More...


Functions

lcas_plugindl_tPluginInit (lcas_db_entry_t *, lcas_plugindl_t **)
 Initialize the plugin.

lcas_proc_t get_procsymbol (void *, char *)
 get procedure symbol from dlopen-ed library

int print_lcas_plugin (int, lcas_plugindl_t *)
 print the lcas_plugindl_t structure

int parse_args_plugin (const char *, const char *, char **, int *)
 convert plugin argument string into xargc, xargv

int clean_plugin_list (lcas_plugindl_t **)
 clean (free) the list of plugins and call the plugin termination functions

int lcas_init_and_logfile (char *logfile, FILE *fp, unsigned short logtype)
 Initialize the LCAS module.

int lcas_init_and_log (FILE *fp, unsigned short logtype)
 Initialize the LCAS module.

int lcas_init (FILE *fp)
 Initialize the LCAS module.

int lcas_get_fabric_authorization (char *user_dn_tmp, gss_cred_id_t user_cred, lcas_request_t request)
 submit authorization request to the LCAS

int lcas_term ()
 Terminate the LCAS module.


Detailed Description

LCAS - the local centre authorization service.

Author:
Martijn Steenbakkers for the EU DataGrid.
The interface to the LCAS module is composed of:
  1. lcas_init(): To initialize the LCAS module
  2. lcas_get_fabric_authorization(): to place an authorization request
  3. lcas_term(): To cleanly terminate the module

Definition in file lcas.c.


Define Documentation

#define FAILED_LCAS_CLOCKCHECK   3
 

return value of LCAS because of failure of clockcheck module (obsolete)

Definition at line 102 of file lcas.c.

#define FAILED_LCAS_OTHER   4
 

return value of LCAS because of general failure

Definition at line 104 of file lcas.c.

Referenced by lcas_get_fabric_authorization().

#define FAILED_LCAS_PLUGIN   5
 

return value of LCAS because of failure of plugin authorization module

Definition at line 105 of file lcas.c.

Referenced by lcas_get_fabric_authorization().

#define FAILED_LCAS_USERALLOW   1
 

return value of LCAS because of failure of userallow module (obsolete)

Definition at line 98 of file lcas.c.

#define FAILED_LCAS_USERBAN   2
 

return value of LCAS because of failure of userban module (obsolete)

Definition at line 100 of file lcas.c.

#define MAXAUTHMODS   3
 

maximum number of standard authorization modules

Definition at line 92 of file lcas.c.

Referenced by lcas_init_and_logfile().

#define MAXPROCS   3
 

maximum number of interface symbols in authorization modules

Definition at line 93 of file lcas.c.

Referenced by PluginInit().

#define NUL   '\0'
 

NUL character

Definition at line 88 of file lcas.c.

Referenced by lcas_db_fill_entry(), lcas_db_parse_line(), lcas_db_parse_pair(), lcas_db_parse_string(), lcas_init_and_logfile(), and PluginInit().


Enumeration Type Documentation

enum lcas_proctype_e
 

This enumeration type gives the different plugin symbol/function types.

Enumeration values:
INITPROC  this value corresponds to the plugin initialization function
AUTHPROC  this value corresponds to the plugin authorization request function
TERMPROC  this value corresponds to the plugin termination function

Definition at line 126 of file lcas.c.


Function Documentation

int clean_plugin_list lcas_plugindl_t **  list  )  [static]
 

clean (free) the list of plugins and call the plugin termination functions

Parameters:
list 
list pointer to list of plugins which has to be freeed.
Return values:
0 succes.
1 failure.

Definition at line 868 of file lcas.c.

References lcas_plugindl_s::argc, lcas_plugindl_s::argv, lcas_plugindl_s::handle, lcas_log(), lcas_log_debug(), LCAS_MOD_SUCCESS, lcas_plugindl_t, lcas_plugindl_s::next, lcas_plugindl_s::pluginname, lcas_plugindl_s::procs, and TERMPROC.

Referenced by lcas_init_and_logfile().

lcas_proc_t get_procsymbol void *  handle,
char *  symname
[static]
 

get procedure symbol from dlopen-ed library

Parameters:
handle handle of dynamic library
symname name of procedure symbol
Returns:
handle to procedure symbol or NUll

Definition at line 828 of file lcas.c.

References lcas_log(), and lcas_proc_t.

Referenced by PluginInit().

int lcas_get_fabric_authorization char *  user_dn_tmp,
gss_cred_id_t  user_cred,
lcas_request_t  request
 

submit authorization request to the LCAS

This function calls the plugins for authorization. As a back-up for empty credentials the user DN may be specified as well. For this ALLOW_EMPTY_CREDENTIALS should be defined.

Parameters:
user_dn_tmp user DN
user_cred GSS/GSI user credential
request authorization request as RSL string
Return values:
0 initialization succeeded.
1 initialization failed.

Definition at line 971 of file lcas.c.

References AUTHPROC, FAILED_LCAS_OTHER, FAILED_LCAS_PLUGIN, lcas_fill_cred(), lcas_get_dn(), lcas_log(), lcas_log_debug(), lcas_log_time(), LCAS_MOD_SUCCESS, lcas_plugindl_t, lcas_release_cred(), lcas_request_t, lcas_plugindl_s::next, lcas_plugindl_s::pluginname, and lcas_plugindl_s::procs.

int lcas_init FILE *  fp  ) 
 

Initialize the LCAS module.

The function does the following:

  • initialize LCAS module.
  • setup logging, error handling (not yet).
  • read from LCAS database the plugins to be loaded.
  • initialize the plugins

Parameters:
fp file handle for logging (from gatekeeper)
Return values:
0 initialization succeeded.
1 initialization failed.

Definition at line 465 of file lcas.c.

References DO_SYSLOG, DO_USRLOG, and lcas_init_and_log().

int lcas_init_and_log FILE *  fp,
unsigned short  logtype
 

Initialize the LCAS module.

The function does the following:

  • select logging type
  • setup logging, error handling (not yet).
  • read from LCAS database the plugins to be loaded.
  • initialize the plugins

Parameters:
fp file handle for logging (from gatekeeper or other previously opened file handle). If the file handle is zero, assume that only syslogging is requested.
logtype type of logging (usrlog and/or syslog)
Return values:
0 initialization succeeded.
1 initialization failed.

Definition at line 443 of file lcas.c.

References lcas_init_and_logfile().

Referenced by lcas_init().

int lcas_init_and_logfile char *  logfile,
FILE *  fp,
unsigned short  logtype
 

Initialize the LCAS module.

The function does the following:

  • select logging type
  • setup logging by providing a file handle or file name, error handling (not yet).
  • read from LCAS database the plugins to be loaded.
  • initialize the plugins

Parameters:
logfile name of the logfile
fp file handle for logging (from gatekeeper or other previously opened file handle). If the file handle is zero, assume that only syslogging is requested.
logtype type of logging (usrlog and/or syslog)
Return values:
0 initialization succeeded.
1 initialization failed.

Definition at line 222 of file lcas.c.

References clean_plugin_list(), lcas_db_clean(), lcas_db_clean_list(), lcas_db_entry_t, lcas_db_fill_entry(), lcas_db_read(), LCAS_ETC_HOME, lcas_genfilename(), lcas_log(), lcas_log_debug(), lcas_log_open(), lcas_log_time(), LCAS_MAXARGSTRING, LCAS_MAXPATHLEN, lcas_plugindl_t, MAXAUTHMODS, lcas_plugindl_s::next, lcas_db_entry_s::next, NUL, lcas_db_entry_s::pluginargs, PluginInit(), lcas_plugindl_s::pluginname, lcas_db_entry_s::pluginname, and print_lcas_plugin().

Referenced by lcas_init_and_log().

int lcas_term  ) 
 

Terminate the LCAS module.

The function does the following:

  • terminate the LCAS module
  • terminate the plugins

Return values:
0 initialization succeeded.
1 initialization failed.

Definition at line 1106 of file lcas.c.

References lcas_plugindl_s::argc, lcas_plugindl_s::argv, lcas_log(), lcas_log_close(), lcas_log_debug(), lcas_log_time(), LCAS_MOD_SUCCESS, lcas_plugindl_t, lcas_plugindl_s::next, lcas_plugindl_s::pluginname, lcas_plugindl_s::procs, and TERMPROC.

int parse_args_plugin const char *  name,
const char *  argstring,
char **  xargv,
int *  xargc
[static]
 

convert plugin argument string into xargc, xargv

Parse the argument string of the plugin and create xargv and xargc

Parameters:
name name of the plugin (goes into xargv[0])
argstring string containing the arguments
xargv array of argument strings (has to be freed later)
xargc number of arguments
Return values:
0 succes.
1 failure.

Definition at line 767 of file lcas.c.

References lcas_log(), lcas_log_debug(), LCAS_MAXARGS, LCAS_MAXPATHLEN, and lcas_tokenize().

Referenced by PluginInit().

lcas_plugindl_t * PluginInit lcas_db_entry_t db_handle,
lcas_plugindl_t **  list
[static]
 

Initialize the plugin.

This function takes a plugin LCAS database entry and performs the following tasks:

  • Create entry in (plugin)list
  • Open the plugins and check the symbols plugin_init and confirm_authorization
  • run plugin_init

Parameters:
db_handle handle to LCAS db (containing pluginname and pluginargs)
list pointer to plugin structure list to which (plugin) module has to be added
Returns:
pointer to newly created plugin structure or NULL in case of failure

Definition at line 515 of file lcas.c.

References lcas_plugindl_s::argc, lcas_plugindl_s::argv, AUTHPROC, get_procsymbol(), lcas_plugindl_s::handle, INITPROC, lcas_db_entry_t, LCAS_ETC_HOME, lcas_findfile(), lcas_genfilename(), lcas_getfexist(), LCAS_LIB_HOME, lcas_log(), lcas_log_debug(), LCAS_MAXARGSTRING, LCAS_MAXPATHLEN, LCAS_MOD_HOME, LCAS_MOD_SUCCESS, lcas_plugindl_t, lcas_proc_t, MAXPROCS, lcas_plugindl_s::next, NUL, parse_args_plugin(), lcas_plugindl_s::pluginargs, lcas_db_entry_s::pluginargs, lcas_plugindl_s::pluginname, lcas_db_entry_s::pluginname, lcas_plugindl_s::procs, and TERMPROC.

Referenced by lcas_init_and_logfile().

int print_lcas_plugin int  debug_lvl,
lcas_plugindl_t plugin
[static]
 

print the lcas_plugindl_t structure

Parameters:
debug_lvl debugging level
plugin plugin structure
Return values:
0 succes.
1 failure.

Definition at line 931 of file lcas.c.

References lcas_plugindl_s::argc, lcas_plugindl_s::argv, AUTHPROC, lcas_plugindl_s::handle, INITPROC, lcas_log_debug(), lcas_plugindl_t, lcas_plugindl_s::next, lcas_plugindl_s::pluginargs, lcas_plugindl_s::pluginname, lcas_plugindl_s::procs, and TERMPROC.

Referenced by lcas_init_and_logfile().


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