- use the Proxy call instead of the standart
authorJiří Škrábal <nykolas@ics.muni.cz>
Thu, 3 Mar 2005 11:57:52 +0000 (11:57 +0000)
committerJiří Škrábal <nykolas@ics.muni.cz>
Thu, 3 Mar 2005 11:57:52 +0000 (11:57 +0000)
org.glite.lb.client/examples/log_usertag_proxy.c

index 7891893..1a7a81e 100644 (file)
@@ -17,6 +17,7 @@ static struct option opts[] = {
        {"help",                0,      NULL,   'h'},
        {"sock",                1,      NULL,   's'},
        {"jobid",               1,      NULL,   'j'},
+       {"user",                1,      NULL,   'u'},
        {"seq",                 1,      NULL,   'c'},
        {"name",                1,      NULL,   'n'},
        {"value",               1,      NULL,   'v'}
@@ -28,6 +29,7 @@ static void usage(char *me)
                        "\t-h, --help      Shows this screen.\n"
                        "\t-s, --server    LB Proxy socket.\n"
                        "\t-j, --jobid     ID of requested job.\n"
+                       "\t-u, --user      User DN.\n"
                        "\t-c, --seq       Sequence code.\n"
                        "\t-n, --name      Name of the tag.\n"
                        "\t-v, --value     Value of the tag.\n"
@@ -39,16 +41,17 @@ int main(int argc, char *argv[])
 {
        edg_wll_Context         ctx;
        edg_wlc_JobId           jobid = NULL;
-       char                       *server, *code, *jobid_s, *name, *value;
+       char                       *server, *code, *jobid_s, *user, *name, *value;
        int                                     opt, err = 0;
 
 
        server = code = jobid_s = name = value = NULL;
-       while ( (opt = getopt_long(argc, argv, "hs:j:c:n:v:", opts, NULL)) != EOF)
+       while ( (opt = getopt_long(argc, argv, "hs:j:u:c:n:v:", opts, NULL)) != EOF)
                switch (opt) {
                case 'h': usage(name); return 0;
                case 's': server = strdup(optarg); break;
                case 'j': jobid_s = strdup(optarg); break;
+               case 'u': user = strdup(optarg); break;
                case 'c': code = strdup(optarg); break;
                case 'n': name = strdup(optarg); break;
                case 'v': value = strdup(optarg); break;
@@ -56,7 +59,6 @@ int main(int argc, char *argv[])
                }
 
        if ( !jobid_s ) { fprintf(stderr, "JobId not given\n"); return 1; }
-       if ( !code ) { fprintf(stderr, "Sequence code not given\n"); return 1; }
        if ( !server ) { fprintf(stderr, "LB proxy socket not given\n"); return 1; }
        if ( !name ) { fprintf(stderr, "Tag name not given\n"); return 1; }
        if ( !value ) { fprintf(stderr, "Tag value not given\n"); return 1; }
@@ -70,10 +72,24 @@ int main(int argc, char *argv[])
 
        edg_wll_InitContext(&ctx);
 
+       if ( !user ) {
+               /*
+               edg_wll_GssStatus       gss_stat;
+
+               if ( edg_wll_gss_acquire_cred_gsi(
+                               ctx->p_proxy_filename ? : ctx->p_cert_filename,
+                               ctx->p_proxy_filename ? : ctx->p_key_filename,
+                               NULL, &user_dn, &gss_stat) ) {
+                       fprintf(stderr, "failed to load GSI credentials\n");
+                       retrun 1;
+               }
+               */
+       }
+
        edg_wll_SetParam(ctx, EDG_WLL_PARAM_SOURCE, EDG_WLL_SOURCE_USER_INTERFACE);
        edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_STORE_SOCK, server);
 
-       if (edg_wll_SetLoggingJob(ctx, jobid, code, EDG_WLL_SEQ_NORMAL)) {
+       if (edg_wll_SetLoggingJobProxy(ctx, jobid, code, user, EDG_WLL_SEQ_NORMAL)) {
                char    *et,*ed;
                edg_wll_Error(ctx,&et,&ed);
                fprintf(stderr,"SetLoggingJob(%s,%s): %s (%s)\n",jobid_s,code,et,ed);