merge from RC31 branch (compiles and seems working)
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 29 Mar 2007 13:01:59 +0000 (13:01 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 29 Mar 2007 13:01:59 +0000 (13:01 +0000)
org.glite.jp.primary/Makefile
org.glite.jp.primary/build.xml
org.glite.jp.primary/examples/dag-deps.c
org.glite.jp.primary/examples/jpps-test.c
org.glite.jp.primary/project/version.properties
org.glite.jp.primary/src/attrs.c
org.glite.jp.primary/src/is_client.c
org.glite.jp.primary/src/soap_ops.c
org.glite.jp.primary/src/soap_util.c

index 44cd51a..a96c95d 100644 (file)
@@ -49,6 +49,10 @@ SOLINK:=libtool --mode=link ${CC} -module ${LDFLAGS} -rpath ${stagedir}/lib
 LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} 
 INSTALL:=libtool --mode=install install
 
+ifneq (${classads_prefix},/usr)
+       classadslib := -L${classads_prefix}/lib -lclassad
+endif
+
 daemon:=glite-jp-primarystoraged
 example:=jpps-test dag-deps
 ps_prefix:=jpps_
index 439631b..ac87fa5 100755 (executable)
 
        Revision history:
        $Log$
+       Revision 1.4.6.1  2007/03/12 15:46:04  akrenek
+       fetch gsoap
+
+       Revision 1.4  2005/05/26 15:13:31  zurek
+       inserted module.build.file
+       
        Revision 1.3  2004/11/22 14:00:19  dimeglio
        Updated to use standard files
        Fixed names (was using common instead of real module name)
        <target name="localinit"
                description="Module specific initialization tasks">
 
+               <antcall target="gsoap" inheritAll="false">
+                       <param name="ext.gsoap.version" value="2.7.0f"/>
+                       <param name="ext.gsoap.rep.file" value="gSOAP-2.7.0f.tar.gz"/>
+               </antcall>
+
                <antcall target="lbmakefiles" />
        </target>
                
index c68c13b..2796df3 100644 (file)
@@ -9,15 +9,15 @@
 
 #include <cclassad.h>
 
-#include "glite/security/glite_gsplugin.h"
 #include "glite/jp/known_attr.h"
 
 #include "jpps_H.h"
 #include "jpps_.nsmap"
 
 #include "jptype_map.h"
+#include "glite/security/glite_gsplugin.h"
+#include "glite/security/glite_gscompat.h"
 
-#include "soap_version.h"
 #if GSOAP_VERSION <= 20602
 #define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob
 #define soap_call___jpsrv__StartUpload soap_call___ns1__StartUpload
 #define soap_call___jpsrv__GetJob soap_call___ns1__GetJob
 #endif
 
+#define dprintf(FMT, ARGS...) fprintf(stderr, (FMT), ##ARGS)
+#include "glite/jp/ws_fault.c"
+#define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0)
+
 
 static void usage(const char *me)
 {
@@ -35,48 +39,6 @@ static void usage(const char *me)
 
        exit (EX_USAGE);
 }
-       
-static int check_fault(struct soap *soap,int err) {
-       struct SOAP_ENV__Detail *detail;
-       struct jptype__genericFault     *f;
-       char    *reason,indent[200] = "  ";
-
-       switch(err) {
-               case SOAP_OK: puts("OK");
-                             break;
-               case SOAP_FAULT:
-               case SOAP_SVR_FAULT:
-                       if (soap->version == 2) {
-                               detail = soap->fault->SOAP_ENV__Detail;
-                               reason = soap->fault->SOAP_ENV__Reason;
-                       }
-                       else {
-                               detail = soap->fault->detail;
-                               reason = soap->fault->faultstring;
-                       }
-                       fputs(reason,stderr);
-                       putc('\n',stderr);
-                       assert(detail->__type == SOAP_TYPE__genericFault);
-#if GSOAP_VERSION >=20700
-                       f = ((struct _genericFault *) detail->fault)
-#else
-                       f = ((struct _genericFault *) detail->value)
-#endif
-                               -> jpelem__genericFault;
-
-                       while (f) {
-                               fprintf(stderr,"%s%s: %s (%s)\n",indent,
-                                               f->source,f->text,f->description);
-                               f = f->reason;
-                               strcat(indent,"  ");
-                       }
-                       return -1;
-
-               default: soap_print_fault(soap,stderr);
-                        return -1;
-       }
-       return 0;
-}
 
 static const char *orig2str(enum jptype__attrOrig orig)
 {
@@ -131,7 +93,7 @@ int main(int argc,char *argv[])
        if ((ret = check_fault(soap,soap_call___jpsrv__GetJobAttributes(soap,server,"",&in,&out))))
                return 1;
 
-               ad = cclassad_create(out.attrValues[0]->value->string);
+               ad = cclassad_create(GSOAP_STRING(GLITE_SECURITY_GSOAP_LIST_GET(out.attrValues, 0)->value));
        if (!ad) {
                fputs("Can't parse JDL\n",stderr);
                return 1;
@@ -196,14 +158,14 @@ int main(int argc,char *argv[])
                        in.tag = &tagval;
                        tagval.name = GLITE_JP_ATTR_WF_SUCCESSOR;
                        tagval.value = &val;
-                       val.string = js;
-                       val.blob = NULL;
+                       memset(&val, 0, sizeof(val));
+                       GSOAP_SETSTRING(&val, js);
 
                        printf("Register successor ...\n");
                        ret = check_fault(soap,soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty));
                        in.jobid = js;
                        tagval.name = GLITE_JP_ATTR_WF_ANCESTOR;
-                       val.string = ja;
+                       GSOAP_SETSTRING(&val, ja);
 
                        printf("Register ancestor ...\n");
                        ret = check_fault(soap,soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty));
index 6add9c4..c03df55 100644 (file)
@@ -3,14 +3,13 @@
 #include <string.h>
 #include <assert.h>
 
-#include "glite/security/glite_gsplugin.h"
-
 #include "jpps_H.h"
 #include "jpps_.nsmap"
 
 #include "jptype_map.h"
+#include "glite/security/glite_gsplugin.h"
+#include "glite/security/glite_gscompat.h"
 
-#include "soap_version.h"
 #if GSOAP_VERSION <= 20602
 #define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob
 #define soap_call___jpsrv__StartUpload soap_call___ns1__StartUpload
@@ -21,6 +20,9 @@
 #define soap_call___jpsrv__GetJob soap_call___ns1__GetJob
 #endif
 
+#define dprintf(FMT, ARGS...) printf(FMT, ##ARGS)
+#include "glite/jp/ws_fault.c"
+#define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0)
 
 static void usage(const char *me)
 {
@@ -39,48 +41,6 @@ static void usage(const char *me)
        exit (EX_USAGE);
 }
        
-static int check_fault(struct soap *soap,int err) {
-       struct SOAP_ENV__Detail *detail;
-       struct jptype__genericFault     *f;
-       char    *reason,indent[200] = "  ";
-
-       switch(err) {
-               case SOAP_OK: puts("OK");
-                             break;
-               case SOAP_FAULT:
-               case SOAP_SVR_FAULT:
-                       if (soap->version == 2) {
-                               detail = soap->fault->SOAP_ENV__Detail;
-                               reason = soap->fault->SOAP_ENV__Reason;
-                       }
-                       else {
-                               detail = soap->fault->detail;
-                               reason = soap->fault->faultstring;
-                       }
-                       fputs(reason,stderr);
-                       putc('\n',stderr);
-                       assert(detail->__type == SOAP_TYPE__genericFault);
-#if GSOAP_VERSION >=20700
-                       f = ((struct _genericFault *) detail->fault)
-#else
-                       f = ((struct _genericFault *) detail->value)
-#endif
-                               -> jpelem__genericFault;
-
-                       while (f) {
-                               fprintf(stderr,"%s%s: %s (%s)\n",indent,
-                                               f->source,f->text,f->description);
-                               f = f->reason;
-                               strcat(indent,"  ");
-                       }
-                       return -1;
-
-               default: soap_print_fault(soap,stderr);
-                        return -1;
-       }
-       return 0;
-}
-
 /* FIXME: new wsdl */
 #if 0
 static struct jptype__Attribute sample_attr[] = {
@@ -187,8 +147,8 @@ int main(int argc,char *argv[])
                in.tag = &tagval;
                tagval.name = argv[3];
                tagval.value = &val;
-               val.string = argv[4];
-               val.blob = NULL;
+               memset(&val, 0, sizeof(val));
+               GSOAP_SETSTRING(&val, argv[4]);
                
                if (!(ret = check_fault(soap,
                                soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty)))) {
@@ -200,11 +160,12 @@ int main(int argc,char *argv[])
                        "http://egee.cesnet.cz/en/Schema/LB/Attributes:RB",
                        "http://egee.cesnet.cz/en/Schema/JP/System:owner"
                };
+               int sizepq;
 
-               struct jptype__stringOrBlob vals[] = {
-                       { "/O=CESNET/O=Masaryk University/CN=Ales Krenek", NULL },
-                       { "Done", NULL }
-               };
+               struct jptype__stringOrBlob vals[2];
+               memset(vals, 0, sizeof vals);
+               GSOAP_SETSTRING(vals, "/O=CESNET/O=Masaryk University/CN=Ales Krenek");
+               GSOAP_SETSTRING(vals + 1, "Done");
 
                struct jptype__primaryQuery     q[] = {
                        { 
@@ -217,11 +178,16 @@ int main(int argc,char *argv[])
                                jptype__queryOp__UNEQUAL,
                                NULL, vals+1, NULL
                        }
-               }, *qp[] = { q, q+1 };
+               };
+               GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, primaryQuery) pq;
+
+               GLITE_SECURITY_GSOAP_LIST_CREATE0(soap, pq, sizepq, struct jptype__primaryQuery, 2);
+               memcpy(GLITE_SECURITY_GSOAP_LIST_GET(pq, 0), &q[0], sizeof(q[0]));
+               memcpy(GLITE_SECURITY_GSOAP_LIST_GET(pq, 1), &q[1], sizeof(q[1]));
                struct _jpelem__FeedIndex       in = {
                        "http://some.index//",
                        2,ap,
-                       2,qp,
+                       sizepq,pq,
                        0,
                        1
                };
@@ -233,6 +199,7 @@ int main(int argc,char *argv[])
                {
                        printf("FeedId: %s\nExpires: %s\n",out.feedId,ctime(&out.feedExpires));
                }
+               GLITE_SECURITY_GSOAP_LIST_DESTROY(soap, &in, conditions);
         }
 /* FIXME: new wsdl  */
 #if 0
@@ -250,6 +217,7 @@ int main(int argc,char *argv[])
        else if (!strcasecmp(argv[1],"GetJobFiles")) {
                struct _jpelem__GetJobFiles     in;
                struct _jpelem__GetJobFilesResponse     out;
+               struct jptype__jppsFile *outf;
 
                if (argc != 3) usage(argv[0]);
                in.jobid = argv[2];
@@ -262,10 +230,11 @@ int main(int argc,char *argv[])
                        printf("JobFiles:\n");
 
                        for (i=0; i<out.__sizefiles;i++) {
+                               outf = GLITE_SECURITY_GSOAP_LIST_GET(out.files, i);
                                printf("\tclass = %s, name = %s, url = %s\n",
-                                               out.files[i]->class_,
-                                               out.files[i]->name,
-                                               out.files[i]->url);
+                                               outf->class_,
+                                               outf->name,
+                                               outf->url);
                        }
                }
 
@@ -273,6 +242,7 @@ int main(int argc,char *argv[])
        else if (!strcasecmp(argv[1],"GetJobAttr")) {
                struct _jpelem__GetJobAttributes        in;
                struct _jpelem__GetJobAttributesResponse        out;
+               struct jptype__attrValue        *outav;
                
                if (argc != 4) usage(argv[0]);
                in.jobid = argv[2];
@@ -284,14 +254,16 @@ int main(int argc,char *argv[])
                        int     i;
 
                        puts("Attribute values:");
-                       for (i=0; i<out.__sizeattrValues; i++)
+                       for (i=0; i<out.__sizeattrValues; i++) {
+                               outav = GLITE_SECURITY_GSOAP_LIST_GET(out.attrValues, i);
                                printf("\t%s\t%s\t%s\t%s",
-                                       out.attrValues[i]->value->string ?
-                                               out.attrValues[i]->value->string :
+                                       GSOAP_ISSTRING(outav->value) ?
+                                               GSOAP_STRING(outav->value) :
                                                "binary",
-                                       orig2str(out.attrValues[i]->origin),
-                                       out.attrValues[i]->originDetail,
-                                       ctime(&out.attrValues[i]->timestamp));
+                                       orig2str(outav->origin),
+                                       outav->originDetail,
+                                       ctime(&outav->timestamp));
+                       }
 
                }
                
index a25eada..69d6345 100644 (file)
@@ -104,7 +104,7 @@ void process_files(glite_jp_context_t ctx, const char *job, glite_jp_attrval_t**
                }
 }
 
-glite_jpps_get_attrs(glite_jp_context_t ctx,const char *job,char **attr,int nattr,glite_jp_attrval_t **attrs_out)
+int glite_jpps_get_attrs(glite_jp_context_t ctx,const char *job,char **attr,int nattr,glite_jp_attrval_t **attrs_out)
 {
        glite_jp_attrval_t      *meta = NULL,*out = NULL,*tag_out = NULL;
         char const     **other = NULL;
@@ -136,15 +136,14 @@ glite_jpps_get_attrs(glite_jp_context_t ctx,const char *job,char **attr,int natt
        if (!known_namespaces) scan_namespaces(ctx);
 
 /* loop over the attributes */
-       int k, l, m;
-       void* beh;
+       int k, l;
        for (i = 0; i < nother; i++){
                if (! glite_jppsbe_read_tag(ctx, job, other[i], &tag_out)) {
                        nout = merge_attrvals(&out, nout, tag_out);
                        free(tag_out); tag_out = NULL;
                }
+#ifndef BRANCH_RC31_3
                for (j = 0; known_namespaces[j].namespace; j++) {
-                       void* ph;
                        char* attr_namespace = glite_jpps_get_namespace(other[i]);
                        if (strcmp(attr_namespace, known_namespaces[j].namespace) == 0){
                                for (k = 0; known_namespaces[j].plugins[k]; k++)
@@ -153,6 +152,53 @@ glite_jpps_get_attrs(glite_jp_context_t ctx,const char *job,char **attr,int natt
                                                        , known_namespaces[j].plugins[k]->classes[l]
                                                        , known_namespaces[j].plugins[k]->uris[l]);
                                break;
+#else
+               free(names);
+       }
+
+/* loop over the files */
+       for (i=0; i<nfiles; i++) {
+               void    *beh;
+               int     ci;
+
+               /* XXX: ignore error */
+               if (!glite_jppsbe_open_file(ctx,job,
+                       known_classes[ci = files[i].class_idx].class,
+                       files[i].name,O_RDONLY,&beh))
+               {
+                       for (j=0; j<known_classes[ci].nplugins; j++) {
+                               void    *ph;
+
+                               glite_jpps_fplug_data_t *p = 
+                                       known_classes[ci].plugins[j];
+                               /* XXX: ignore error */
+                               if (!p->ops.open(p->fpctx,beh,known_classes[ci].uri,&ph)) {
+
+                                       for (j=0; j<nother; j++) {
+                                               glite_jp_attrval_t      *myattr;
+                                               /* XXX: ignore errors */
+                                               if (!p->ops.attr(p->fpctx,ph,other[j],&myattr) && myattr) {
+                                                       int     k;
+                                                       for (k=0; myattr[k].name; k++) {
+                                                               myattr[k].origin = GLITE_JP_ATTR_ORIG_FILE;
+                                                               trio_asprintf(&myattr[k].origin_detail,"%s %s",
+                                                                               known_classes[ci].uri,
+                                                                               files[i].name ? files[i].name : "");
+                                                       }
+                                                       nout = merge_attrvals(&out,nout,myattr);
+                                                       free(myattr);
+                                               }
+
+                                       }
+                                       p->ops.close(p->fpctx,ph);
+                               }
+                               else {
+                                       char    *e;
+                                       fprintf(stderr,"[%d] %s: %s\n",getpid(),known_classes[ci].class,
+                                                       e = glite_jp_error_chain(ctx));
+                                       free(e);
+                               }
+#endif
                        }
                        free(attr_namespace);
                }
index ff77ca4..c4ad7c7 100644 (file)
@@ -4,11 +4,15 @@
 #include <string.h>
 #include <errno.h>
 #include <assert.h>
+#include <stdsoap2.h>
 
+#undef SOAP_FMAC1
 #define SOAP_FMAC1 static
 
 #include "glite/jp/types.h"
+#include "soap_version.h"
 #include "glite/security/glite_gsplugin.h"
+#include "glite/security/glite_gscompat.h"
 
 #include "feed.h"
 #include "is_client.h"
 
 #include "jpis_.nsmap"
 
-#include "soap_util.c"
-
 #include "soap_env_ctx.h"
 #include "soap_env_ctx.c"
 
+#include "glite/jp/ws_fault.c"
+#include "soap_util.c"
+
 extern char *server_key, *server_cert; /* XXX */
 
 static int check_other_soap(glite_jp_context_t ctx)
@@ -94,7 +99,7 @@ int glite_jpps_single_feed(
        struct _jpelem__UpdateJobsResponse      out;
        struct jptype__jobRecord        jr, *jrp = &jr;
        int     i;
-       enum xsd__boolean       false = false_;
+       enum xsd__boolean       false = GLITE_SECURITY_GSOAP_FALSE;
        glite_jp_error_t        err;
 
        glite_jp_clear_error(ctx);
@@ -112,8 +117,8 @@ int glite_jpps_single_feed(
        in.jobAttributes = &jrp;
 
        for (i=0; attrs[i].name; i++);
-       jr.jobid = (char *) job; /* XXX: const */
-       jr.owner = owner;
+       jr.jobid = soap_strdup(ctx->other_soap, job);
+       jr.owner = soap_strdup(ctx->other_soap, owner);
 
        jr.__sizeattributes = jp2s_attrValues(ctx->other_soap,
                        (glite_jp_attrval_t *) attrs, /* XXX: const */
@@ -146,6 +151,8 @@ int glite_jpps_single_feed(
        }
        RESTORE_SOAP_CTX
 
+       soap_dealloc(ctx->other_soap, jr.jobid);
+       soap_dealloc(ctx->other_soap, jr.owner);
        attrValues_free(ctx->other_soap,jr.attributes,jr.__sizeattributes);
 
        return err.code;
@@ -166,7 +173,7 @@ int glite_jpps_multi_feed(
        struct _jpelem__UpdateJobs      in;
        struct _jpelem__UpdateJobsResponse      out;
        struct jptype__jobRecord        *jr;
-       enum xsd__boolean       false = false_;
+       enum xsd__boolean       false = GLITE_SECURITY_GSOAP_FALSE;
        glite_jp_error_t        err;
 
        printf("multi_feed: %s\n",destination);
@@ -178,8 +185,7 @@ int glite_jpps_multi_feed(
 
        in.feedId = (char *) feed; /* XXX: const */
        in.feedDone = done;
-       in.__sizejobAttributes = njobs;
-       in.jobAttributes = malloc(njobs * sizeof *in.jobAttributes);
+       GLITE_SECURITY_GSOAP_LIST_CREATE(ctx->other_soap, &in, jobAttributes, struct jptype__jobRecord, njobs);
 
        for (i=0; i<njobs; i++) {
                puts(jobs[i]);
@@ -187,7 +193,7 @@ int glite_jpps_multi_feed(
                        printf("%s = %s\n",attrs[i][j].name,attrs[i][j].value);
                putchar(10);
 
-               in.jobAttributes[i] = jr = malloc(sizeof *jr);
+               jr = GLITE_SECURITY_GSOAP_LIST_GET(in.jobAttributes, i);
                jr->jobid = jobs[i];
                jr->owner = owners[i];
 
@@ -205,11 +211,10 @@ int glite_jpps_multi_feed(
                soap_call___jpsrv__UpdateJobs(ctx->other_soap,destination,"", &in,&out));
        RESTORE_SOAP_CTX
        for (i=0; i<njobs; i++) {
-               jr = in.jobAttributes[i];
+               jr = GLITE_SECURITY_GSOAP_LIST_GET(in.jobAttributes, i);
                attrValues_free(ctx->other_soap,jr->attributes,jr->__sizeattributes);
-               free(jr);
        }
-       free(in.jobAttributes);
+       GLITE_SECURITY_GSOAP_LIST_DESTROY(ctx->other_soap, &in, jobAttributes);
 
        return err.code;
 }
index ea1970b..e4dd2c2 100644 (file)
@@ -1,7 +1,9 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <assert.h>
+#include <stdsoap2.h>
 
+#undef SOAP_FMAC1
 #define SOAP_FMAC1     static
 
 #include "glite/jp/types.h"
@@ -13,6 +15,7 @@
 #include "attrs.h"
 
 #include "jptype_map.h"
+#include "glite/security/glite_gscompat.h"
 
 #include "file_plugin.h"
 #include "builtin_plugins.h"
 
 #include "jpps_.nsmap"
 
-#include "soap_util.c"
-
 #include "soap_env_ctx.h"
 #include "soap_env_ctx.c"
 
-static struct jptype__genericFault *jp2s_error(struct soap *soap,
-               const glite_jp_error_t *err)
-{
-       struct jptype__genericFault *ret = NULL;
-       if (err) {
-               ret = soap_malloc(soap,sizeof *ret);
-               memset(ret,0,sizeof *ret);
-               ret->code = err->code;
-               ret->source = soap_strdup(soap,err->source);
-               ret->text = soap_strdup(soap,strerror(err->code));
-               ret->description = soap_strdup(soap,err->desc);
-               ret->reason = jp2s_error(soap,err->reason);
-       }
-       return ret;
-}
-
-static void err2fault(const glite_jp_context_t ctx,struct soap *soap)
-{
-       char    *et;
-       struct SOAP_ENV__Detail *detail = soap_malloc(soap,sizeof *detail);
-       struct _genericFault *f = soap_malloc(soap,sizeof *f);
-
-
-       f->jpelem__genericFault = jp2s_error(soap,ctx->error);
-
-       detail->__type = SOAP_TYPE__genericFault;
-#if GSOAP_VERSION >= 20700
-       detail->fault = f;
-#else
-       detail->value = f;
-#endif
-       detail->__any = NULL;
+#include "glite/jp/ws_fault.c"
+#include "soap_util.c"
 
-       soap_receiver_fault(soap,"Oh, shit!",NULL);
-       if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail;
-       else soap->fault->detail = detail;
-}
+#define err2fault(CTX, SOAP) glite_jp_server_err2fault((CTX), (SOAP));
 
 #define CONTEXT_FROM_SOAP(soap,ctx) glite_jp_context_t ctx = (glite_jp_context_t) ((soap)->user)
 
@@ -217,7 +185,6 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RecordTag(
        void    *file_be,*file_p;
        glite_jp_attrval_t      attr[2], meta[2];
 
-
        file_be = file_p = NULL;
 
        memset(attr, 0, 2 * sizeof(glite_jp_attrval_t));
@@ -233,13 +200,13 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RecordTag(
        }
 
        attr[0].name = in->tag->name;
-       if (in->tag->value->string) {
-               attr[0].value = in->tag->value->string;
+       if (GSOAP_ISSTRING(in->tag->value)) {
+               attr[0].value = GSOAP_STRING(in->tag->value);
                attr[0].binary = 0;
        }
        else {
-               attr[0].value = in->tag->value->blob->__ptr;
-               attr[0].size = in->tag->value->blob->__size;
+               attr[0].value = GSOAP_BLOB(in->tag->value)->__ptr;
+               attr[0].size = GSOAP_BLOB(in->tag->value)->__size;
                attr[0].binary = 1;
        }
        attr[0].origin = GLITE_JP_ATTR_ORIG_USER;
@@ -280,16 +247,16 @@ err:
 
 static void s2jp_qval(const struct jptype__stringOrBlob *in, char **value, int *binary, size_t *size)
 {
-       if (in->string) {
-               *value = in->string;
+       if (GSOAP_ISSTRING(in)) {
+               *value = GSOAP_STRING(in);
                *binary = 0;
                *size = 0;
        }
        else {
-               assert(in->blob);       /* XXX: should report error instead */
-               *value = in->blob->__ptr;
+               assert(GSOAP_BLOB(in)); /* XXX: should report error instead */
+               *value = GSOAP_BLOB(in)->__ptr;
                *binary = 1;
-               *size = in->blob->__size;
+               *size = GSOAP_BLOB(in)->__size;
        }
 }
 
@@ -369,7 +336,7 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndex(
        }
 
        memcpy(attrs,in->attributes,sizeof *attrs * in->__sizeattributes);
-       for (i = 0; i<in->__sizeconditions; i++) s2jp_query(in->conditions[i],qry+i);
+       for (i = 0; i<in->__sizeconditions; i++) s2jp_query(GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i),qry+i);
 
        if (in->history) {
                if (glite_jpps_run_feed(ctx,in->destination,attrs,qry,in->continuous,&feed_id)) {
@@ -430,11 +397,22 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles(
        int     i,n;
        glite_jp_error_t        err;
        void    **pd;
-       struct jptype__jppsFile         **f = NULL;
+       struct jptype__jppsFile         *f = NULL;
        glite_jp_attrval_t      meta[2];
 
        memset(&err,0,sizeof err);
-       out->__sizefiles = 0;
+       n = 0;
+
+       memset(meta,0,sizeof meta);
+        meta[0].name = strdup(GLITE_JP_ATTR_OWNER);
+
+       if (glite_jppsbe_get_job_metadata(ctx,in->jobid,meta)) {
+               goto err;
+       }
+       
+       if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__GetJobFiles,in->jobid,meta[0].value)) {
+               goto err;
+       }
 
        memset(meta,0,sizeof meta);
         meta[0].name = strdup(GLITE_JP_ATTR_OWNER);
@@ -453,12 +431,13 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles(
                for (i=0; plugin->uris[i]; i++) {
                        glite_jp_clear_error(ctx);
                        switch (glite_jppsbe_get_job_url(ctx,in->jobid,plugin->classes[i],NULL,&url)) {
-                               case 0: n = out->__sizefiles++;
-                                       f = realloc(f,out->__sizefiles * sizeof *f);
-                                       f[n] = soap_malloc(soap, sizeof **f);
-                                       f[n]->class_ = soap_strdup(soap,plugin->uris[i]);
-                                       f[n]->name = NULL;
-                                       f[n]->url = soap_strdup(soap,url);
+                               case 0:
+                                       f = realloc(f,(n + 1) * sizeof *f);
+                                       f[n].class_ = soap_strdup(soap,plugin->uris[i]);
+#warning FIXME: file name required in WSDL
+                                       f[n].name = NULL;
+                                       f[n].url = soap_strdup(soap,url);
+                                       n++;
                                        free(url);
                                        break;
                                case ENOENT:
@@ -475,7 +454,7 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles(
                }
        }
 
-       if (!out->__sizefiles) {
+       if (!n) {
                glite_jp_clear_error(ctx);
                err.code = ENOENT;
                err.source = __FUNCTION__;
@@ -486,8 +465,8 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles(
                return SOAP_FAULT;
        }
 
-       out->files = soap_malloc(soap,out->__sizefiles * sizeof *f);
-       memcpy(out->files,f,out->__sizefiles * sizeof *f);
+       GLITE_SECURITY_GSOAP_LIST_CREATE(soap, out, files, struct jptype__jppsFile, n);
+       for (i = 0; i < n; i++) memcpy(GLITE_SECURITY_GSOAP_LIST_GET(out->files, i), &f[i], sizeof(f[i]));
 
        return SOAP_OK;
 err:
index eebbd1a..5d6898d 100644 (file)
@@ -11,40 +11,40 @@ static enum jptype__attrOrig jp2s_origin(glite_jp_attr_orig_t o)
 static int jp2s_attrValues(
        struct soap *soap,
        glite_jp_attrval_t *in,
-       struct jptype__attrValue ***outp,
+       GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, attrValue) *outp,
        int freeit)
 {
-       struct jptype__attrValue **out;
+       GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, attrValue)       out;
+       struct jptype__attrValue        a;
        int     i,cnt;
 
        for (cnt=0; in[cnt].name; cnt++);
               
-       out = soap_malloc(soap,cnt * sizeof *out);
+       GLITE_SECURITY_GSOAP_LIST_CREATE0(soap, out, cnt, struct jptype__attrValue, cnt);
        for (i=0; in[i].name; i++) {
-               struct jptype__attrValue        *a = soap_malloc(soap,sizeof *a);
-               out[i] = a;
-
-               a->name = soap_strdup(soap,in[i].name); 
+               memset(&a, 0, sizeof a);
+               a.name = soap_strdup(soap,in[i].name); 
                if (freeit) free(in[i].name);
-               a->value = soap_malloc(soap,sizeof *a->value);
+               a.value = soap_malloc(soap,sizeof *a.value);
+               memset(a.value, 0, sizeof *a.value);
                if (in[i].binary) {
-                       a->value->blob = soap_malloc(soap,sizeof *a->value->blob);
-                       memset(a->value->blob,0,sizeof *a->value->blob);
-                       a->value->blob->__ptr = soap_malloc(soap,in[i].size);
-                       a->value->blob->__size = in[i].size;
-                       memcpy(a->value->blob->__ptr,in[i].value,in[i].size);
-
-                       a->value->string = NULL;
+                       GSOAP_SETBLOB(a.value, soap_malloc(soap,sizeof *GSOAP_BLOB(a.value)));
+                       memset(GSOAP_BLOB(a.value),0,sizeof *GSOAP_BLOB(a.value));
+                       GSOAP_BLOB(a.value)->__ptr = soap_malloc(soap,in[i].size);
+                       GSOAP_BLOB(a.value)->__size = in[i].size;
+                       memcpy(GSOAP_BLOB(a.value)->__ptr,in[i].value,in[i].size);
                }
                else {
-                       a->value->string = soap_strdup(soap,in[i].value);
-                       a->value->blob = NULL;
+                       GSOAP_SETSTRING(a.value, soap_strdup(soap,in[i].value));
                }
+
                if (freeit) free(in[i].value);
-               a->origin = jp2s_origin(in[i].origin);
-               a->originDetail = in[i].origin_detail ? soap_strdup(soap,in[i].origin_detail) : NULL;
+               a.origin = jp2s_origin(in[i].origin);
+               a.originDetail = in[i].origin_detail ? soap_strdup(soap,in[i].origin_detail) : NULL;
                if (freeit) free(in[i].origin_detail);
-               a->timestamp = in[i].timestamp;
+               a.timestamp = in[i].timestamp;
+
+               memcpy(GLITE_SECURITY_GSOAP_LIST_GET(out, i), &a, sizeof a);
        }
        if (freeit) free(in);
 
@@ -54,21 +54,21 @@ static int jp2s_attrValues(
 
 static void attrValues_free(
        struct soap *soap,
-       struct jptype__attrValue **a,
+       GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, attrValue) a,
        int     na)
 {
        int     i;
+       struct jptype__attrValue *ai;
 
        for (i=0; i<na; i++) {
-               soap_dealloc(soap,a[i]->name);
-               if (a[i]->value->string) soap_dealloc(soap,a[i]->value->string);
-               if (a[i]->value->blob) {
-                       soap_dealloc(soap,a[i]->value->blob->__ptr);
-                       soap_dealloc(soap,a[i]->value->blob);
+               ai = GLITE_SECURITY_GSOAP_LIST_GET(a, i);
+               if (GSOAP_ISSTRING(ai->value) && GSOAP_STRING(ai->value)) soap_dealloc(soap,GSOAP_STRING(ai->value));
+               if (GSOAP_ISBLOB(ai->value) && GSOAP_BLOB(ai->value)) {
+                       soap_dealloc(soap,GSOAP_BLOB(ai->value)->__ptr);
+                       soap_dealloc(soap,GSOAP_BLOB(ai->value));
                }
-               soap_dealloc(soap,a[i]->value);
-               if (a[i]->originDetail) soap_dealloc(soap,a[i]->originDetail);
-               soap_dealloc(soap,a[i]);
+               soap_dealloc(soap,ai->value);
+               if (ai->originDetail) soap_dealloc(soap,ai->originDetail);
        }
-       soap_dealloc(soap,a);
+       GLITE_SECURITY_GSOAP_LIST_DESTROY0(soap, a, na);
 }