00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00041
00042
00043
00044
00045 #include "lcmaps_config.h"
00046 #include <stdio.h>
00047 #include <stdlib.h>
00048 #include <string.h>
00049 #ifdef LCMAPS_GSI_MODE
00050 # include <gssapi.h>
00051 #endif
00052
00053 #include "lcmaps_modules.h"
00054 #include "lcmaps_arguments.h"
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00090 int plugin_introspect(
00091 int * argc,
00092 lcmaps_argument_t ** argv
00093 )
00094 {
00095 static lcmaps_argument_t argList[] = {
00096 { "job_request" , "lcmaps_request_t" , 1, NULL},
00097 #ifdef LCMAPS_GSI_MODE
00098 { "user_cred" , "gss_cred_id_t" , 0, NULL},
00099 #endif
00100 { "user_dn" , "char *" , 0, NULL},
00101 { "job_request" , "char *" , 0, NULL},
00102 { NULL , NULL , -1, NULL}
00103 };
00104
00105 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_introspect(): introspecting\n");
00106
00107 *argv = argList;
00108 *argc = lcmaps_cntArgs(argList);
00109 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_introspect(): address first argument: 0x%x\n",argList);
00110
00111 return LCMAPS_MOD_SUCCESS;
00112 }
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00144 int plugin_initialize(
00145 int argc,
00146 char ** argv
00147 )
00148 {
00149 int i;
00150
00151 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_initialize(): passed arguments:\n");
00152 for (i=0; i < argc; i++)
00153 {
00154 lcmaps_log_debug(2,"\tlcmaps_plugin_example-plugin_initialize(): arg %d is %s\n",
00155 i,argv[i]);
00156 }
00157
00158 return LCMAPS_MOD_SUCCESS;
00159 }
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00187 int plugin_run(
00188 int argc,
00189 lcmaps_argument_t * argv
00190 )
00191 {
00192 lcmaps_request_t * prequest=NULL;
00193 #ifdef LCMAPS_GSI_MODE
00194 gss_cred_id_t * pcred;
00195 gss_cred_id_t cred;
00196 #endif
00197
00198 char ** pstring;
00199
00200 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run():\n");
00201
00202
00203
00204
00205 if ( ( pstring = (char **) lcmaps_getArgValue("job_request", "char *", argc, argv) ) )
00206 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): job_request: %s\n",*pstring);
00207 else
00208 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): could not get value of job_request !\n");
00209
00210 if ( ( pstring = (char **) lcmaps_getArgValue("user_dn", "char *", argc, argv) ) )
00211 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): user_dn: %s\n",*pstring);
00212 else
00213 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): could not get value of user_dn !\n");
00214
00215 if ( ( prequest = (lcmaps_request_t *) lcmaps_getArgValue("job_request", "lcmaps_request_t", argc, argv) ) )
00216 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): job_request: %s\n",*prequest);
00217 else
00218 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): could not get value of job_request !\n");
00219
00220 #ifdef LCMAPS_GSI_MODE
00221 if ( ( pcred = (gss_cred_id_t *) lcmaps_getArgValue("user_cred", "gss_cred_id_t", argc, argv) ) )
00222 {
00223 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): address user_cred: %p\n",pcred);
00224 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): value user_cred: %p\n",*pcred);
00225 cred=*pcred;
00226 if (cred) {
00227 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): inside value user_cred: %p\n",*(int *)(cred));
00228 }
00229 }
00230 else
00231 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): could not get address of user_cred !\n");
00232 #endif
00233
00234 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_run(): address first argument: 0x%x\n",argv);
00235
00236
00237 return LCMAPS_MOD_SUCCESS;
00238
00239 fail_example:
00240 return LCMAPS_MOD_FAIL;
00241 }
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00259 int plugin_terminate()
00260 {
00261 lcmaps_log_debug(1,"\tlcmaps_plugin_example-plugin_terminate(): terminating\n");
00262
00263 return LCMAPS_MOD_SUCCESS;
00264 }
00267
00268
00269
00270
00271
00272
00273