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 00032 /*\@{*/ 00033 00034 /***************************************************************************** 00035 Include header files 00036 ******************************************************************************/ 00037 #include "lcas_config.h" 00038 #include <stdio.h> 00039 #include <stdlib.h> 00040 #include <string.h> 00041 #include "lcas_modules.h" 00042 00043 /****************************************************************************** 00044 Definitions 00045 ******************************************************************************/ 00046 00047 /****************************************************************************** 00048 Module specific prototypes 00049 ******************************************************************************/ 00050 00051 /****************************************************************************** 00052 Define module specific variables 00053 ******************************************************************************/ 00054 00055 /****************************************************************************** 00056 Function: plugin_initialize 00057 Description: 00058 Initialize plugin 00059 Parameters: 00060 argc, argv 00061 argv[0]: the name of the plugin 00062 Returns: 00063 LCAS_MOD_SUCCESS : succes 00064 LCAS_MOD_FAIL : failure 00065 LCAS_MOD_NOFILE : db file not found (will halt LCAS initialization) 00066 ******************************************************************************/ 00084 int plugin_initialize( 00085 int argc, 00086 char ** argv 00087 ) 00088 { 00089 int i; 00090 00091 lcas_log_debug(1,"lcas_plugin_example-plugin_initialize(): passed arguments:\n"); 00092 for (i=0; i < argc; i++) 00093 { 00094 lcas_log_debug(2,"lcas_plugin_example-plugin_initialize(): arg %d is %s\n", 00095 i,argv[i]); 00096 } 00097 00098 return LCAS_MOD_SUCCESS; 00099 } 00100 00101 /****************************************************************************** 00102 Function: plugin_confirm_authorization 00103 Description: 00104 Ask for authorization by passing RSL(JDL) and user credential 00105 Parameters: 00106 request: RSL request 00107 lcas_cred: user credential 00108 Returns: 00109 LCAS_MOD_SUCCESS: authorization succeeded 00110 LCAS_MOD_FAIL : authorization failed 00111 LCAS_MOD_NOFILE : db file not found (LCAS will deny authorization) 00112 ******************************************************************************/ 00132 int plugin_confirm_authorization( 00133 lcas_request_t request, 00134 lcas_cred_id_t lcas_cred 00135 ) 00136 { 00137 char * username = NULL; 00138 00139 lcas_log_debug(1,"\tlcas_plugin_example-plugin_confirm_authorization():\n"); 00140 00141 /* 00142 * check credential and get the globus name 00143 */ 00144 if ( (username = lcas_get_dn(lcas_cred)) == NULL) 00145 { 00146 lcas_log(0, "lcas.mod-lcas_get_fabric_authorization() error: user DN empty\n"); 00147 goto fail_example; 00148 } 00149 00150 if (username != NULL) 00151 { 00152 lcas_log_debug(0, 00153 "\tlcas_plugin_example-plugin_confirm_authorization(): OK, what the heck, I'll authorize Mr/Mrs %s\n", 00154 username); 00155 } 00156 else 00157 { 00158 lcas_log_debug(0, 00159 "\tlcas_plugin_example-plugin_confirm_authorization(): Authorization failure: invalid username (%s)\n",username); 00160 goto fail_example; 00161 } 00162 00163 /* succes */ 00164 return LCAS_MOD_SUCCESS; 00165 00166 fail_example: 00167 return LCAS_MOD_FAIL; 00168 } 00169 00170 /****************************************************************************** 00171 Function: plugin_terminate 00172 Description: 00173 Terminate plugin 00174 Parameters: 00175 00176 Returns: 00177 LCAS_MOD_SUCCESS : succes 00178 LCAS_MOD_FAIL : failure 00179 ******************************************************************************/ 00186 int plugin_terminate() 00187 { 00188 lcas_log_debug(1,"lcas_plugin_example-plugin_terminate(): terminating\n"); 00189 00190 return LCAS_MOD_SUCCESS; 00191 } 00192 /*\@}*/ 00193 00194 /****************************************************************************** 00195 CVS Information: 00196 $Source: /cvs/fabric_mgt/gridification/lcas/modules/example/lcas_plugin_example.c,v $ 00197 $Date: 2003/08/08 16:25:00 $ 00198 $Revision: 1.1 $ 00199 $Author: martijn $ 00200 ******************************************************************************/