From e0dda9b9fcca419dc28319b0ec2e33b4bae313b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Wed, 28 Mar 2007 16:46:49 +0000 Subject: [PATCH] Bugfixes and updating tests. --- org.glite.jp.index/Makefile | 7 +- org.glite.jp.index/examples/jpis-client.c | 24 +++-- org.glite.jp.index/examples/query-tests/authz.out | 2 +- .../examples/query-tests/complex_query.out | 2 +- .../examples/query-tests/jobid_query.out | 2 +- .../examples/query-tests/origin_query.out | 2 +- .../examples/query-tests/run-test.sh | 38 ++++++-- .../examples/query-tests/simple_query.out | 2 +- org.glite.jp.index/src/conf.c | 53 +++++----- org.glite.jp.index/src/soap_ops.c | 108 ++++++++++----------- org.glite.jp.index/src/ws_is_typeref.c | 6 +- org.glite.jp.index/src/ws_is_typeref.h | 2 +- org.glite.jp.index/src/ws_ps_typeref.c | 11 +-- 13 files changed, 146 insertions(+), 113 deletions(-) diff --git a/org.glite.jp.index/Makefile b/org.glite.jp.index/Makefile index 00ed923..dda38cb 100644 --- a/org.glite.jp.index/Makefile +++ b/org.glite.jp.index/Makefile @@ -141,7 +141,7 @@ check: doc: ${MANS} ${HTMLS} -stage: compile +stage: compile doc ${MAKE} PREFIX=${stagedir} DOSTAGE=yes install dist: distsrc distbin @@ -195,10 +195,11 @@ db_ops.o: db_ops.c conf.h context.h db_ops.h context.o: context.c conf.h context.h soap_ps_calls.o: soap_ps_calls.c jpps_H.h jpps_.nsmap soap_version.h conf.h db_ops.h ws_ps_typeref.h context.h soap_ops.o: soap_ops.c jpis_H.h jpis_.nsmap soap_version.h db_ops.h ws_ps_typeref.h ws_is_typeref.h context.h -ws_ps_typeref.o: ws_ps_typeref.c jpis_H.h ws_typemap.h ws_ps_typeref.h -ws_is_typeref.o: ws_is_typeref.c jpis_H.h ws_typemap.h ws_is_typeref.h +ws_ps_typeref.o: ws_ps_typeref.c ${ps_prefix}H.h ws_typemap.h ws_ps_typeref.h soap_version.h +ws_is_typeref.o: ws_is_typeref.c ${is_prefix}H.h ws_typemap.h ws_is_typeref.h soap_version.h comon_server.o: common_server.c common_server.h jpis-client.o: jpis-client.c ${is_client_prefix}H.h soap_version.h +jpis-test.o: jpis-client.c ${is_client_prefix}H.h soap_version.h conf.o: conf.c ${is_prefix}H.h soap_version.h %.1: %.sgml diff --git a/org.glite.jp.index/examples/jpis-client.c b/org.glite.jp.index/examples/jpis-client.c index e285006..50c7875 100644 --- a/org.glite.jp.index/examples/jpis-client.c +++ b/org.glite.jp.index/examples/jpis-client.c @@ -71,7 +71,7 @@ struct { {0, "unknown"} }; -typedef enum {FORMAT_XML, FORMAT_HR} format_t; +typedef enum {FORMAT_XML, FORMAT_STRIPPEDXML, FORMAT_HR} format_t; /* @@ -186,7 +186,6 @@ static int query_recv(struct soap *soap, int fd, struct _jpisclient__QueryJobs * return EINVAL; } soap_end_recv(soap); - soap_free(soap); /* don't destroy the data we want */ /* strip white-space characters from attributes */ for (i = 0; i < qj->__sizeattributes; i++) @@ -251,6 +250,7 @@ static int query_dump(struct soap *soap, int fd, struct _jpisclient__QueryJobs * soap_serialize__jpisclient__QueryJobs(soap, qj); retval = soap_put__jpisclient__QueryJobs(soap, qj, "jpisclient:QueryJobs", NULL); soap_end_send(soap); + write(fd, "\n", strlen("\n")); return retval; } @@ -258,7 +258,9 @@ static int query_dump(struct soap *soap, int fd, struct _jpisclient__QueryJobs * static int query_format(struct soap *soap, format_t format, FILE *f, struct _jpisclient__QueryJobs *qj) { switch (format) { - case FORMAT_XML: return query_dump(soap, fileno(f), qj); + case FORMAT_XML: + case FORMAT_STRIPPEDXML: + return query_dump(soap, fileno(f), qj); case FORMAT_HR: query_print(f, qj); return 0; default: return EINVAL; } @@ -294,6 +296,7 @@ static int queryresult_dump(struct soap *soap, int fd, const struct _jpisclient_ soap_serialize__jpisclient__QueryJobsResponse(soap, qjr); retval = soap_put__jpisclient__QueryJobsResponse(soap, qjr, "jpisclient:QueryJobsResponse", NULL); soap_end_send(soap); + write(fd, "\n", strlen("\n")); return retval; } @@ -335,7 +338,9 @@ static void queryresult_print(FILE *out, const struct _jpelem__QueryJobsRespons static int queryresult_format(struct soap *soap, format_t format, FILE *f, const struct _jpelem__QueryJobsResponse *qj) { switch (format) { - case FORMAT_XML: return queryresult_dump(soap, fileno(f), qj); + case FORMAT_XML: + case FORMAT_STRIPPEDXML: + return queryresult_dump(soap, fileno(f), qj); case FORMAT_HR: queryresult_print(f, qj); return 0; default: return EINVAL; } @@ -353,7 +358,7 @@ static void usage(const char *prog_name) { fprintf(stderr, " -q|--query-file IN_FILE.XML\n"); fprintf(stderr, " -t|--test-file IN_FILE.XML\n"); fprintf(stderr, " -e|--example-file OUT_FILE.XML\n"); - fprintf(stderr, " -f|--format xml | human\n"); + fprintf(stderr, " -f|--format xml | strippedxml | human\n"); } @@ -380,10 +385,6 @@ int main(int argc, char * const argv[]) { soap_init(&soap); -#ifdef SOAP_XML_INDENT - soap_omode(&soap, SOAP_XML_INDENT); -#endif - /* * Following code is needed, when we can't combine more XSD/WSDL files * for using both as client. We direct use structures only from @@ -447,6 +448,7 @@ int main(int argc, char * const argv[]) { break; case 'f': if (strcasecmp(optarg, "xml") == 0) format = FORMAT_XML; + else if (strcasecmp(optarg, "strippedxml") == 0) format = FORMAT_STRIPPEDXML; else format = FORMAT_HR; break; default: @@ -458,6 +460,10 @@ int main(int argc, char * const argv[]) { goto cleanup; } if (!server) server = strdup(DEFAULT_JPIS); +#ifdef SOAP_XML_INDENT + if (format != FORMAT_STRIPPEDXML) soap_omode(&soap, SOAP_XML_INDENT); +#endif + /* prepare steps according to the arguments */ if (query_file) { diff --git a/org.glite.jp.index/examples/query-tests/authz.out b/org.glite.jp.index/examples/query-tests/authz.out index a3d8c20..4d93551 100644 --- a/org.glite.jp.index/examples/query-tests/authz.out +++ b/org.glite.jp.index/examples/query-tests/authz.out @@ -11,4 +11,4 @@ Attributes: http://egee.cesnet.cz/en/Schema/LB/Attributes:user OK - + diff --git a/org.glite.jp.index/examples/query-tests/complex_query.out b/org.glite.jp.index/examples/query-tests/complex_query.out index a16cd61..98775c5 100644 --- a/org.glite.jp.index/examples/query-tests/complex_query.out +++ b/org.glite.jp.index/examples/query-tests/complex_query.out @@ -15,4 +15,4 @@ Attributes: http://egee.cesnet.cz/en/Schema/LB/Attributes:user OK -https://localhost:7846/pokus1/O=CESNET/O=Masaryk University/CN=Milos Mulachttp://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusDone1970-01-01T02:00:01ZFILEhttp://egee.cesnet.cz/en/Schema/LB/Attributes:userCertSubj1970-01-01T02:00:01ZFILEhttp://localhost:8901https://localhost:7846/pokus2OwnerNamehttp://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusReady1970-01-01T02:00:01ZSYSTEMhttp://egee.cesnet.cz/en/Schema/LB/Attributes:userCertSubj1970-01-01T02:00:01ZSYSTEMhttp://localhost:8901 +https://localhost:7846/pokus1/O=CESNET/O=Masaryk University/CN=Milos Mulachttp://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusDone1970-01-01T02:00:01ZFILEhttp://egee.cesnet.cz/en/Schema/LB/Attributes:userCertSubj1970-01-01T02:00:01ZFILEhttp://localhost:8901https://localhost:7846/pokus2OwnerNamehttp://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusReady1970-01-01T02:00:01ZSYSTEMhttp://egee.cesnet.cz/en/Schema/LB/Attributes:userCertSubj1970-01-01T02:00:01ZSYSTEMhttp://localhost:8901 diff --git a/org.glite.jp.index/examples/query-tests/jobid_query.out b/org.glite.jp.index/examples/query-tests/jobid_query.out index 2450fbe..dc31dd9 100644 --- a/org.glite.jp.index/examples/query-tests/jobid_query.out +++ b/org.glite.jp.index/examples/query-tests/jobid_query.out @@ -11,4 +11,4 @@ Attributes: http://egee.cesnet.cz/en/Schema/LB/Attributes:user OK -https://localhost:7846/pokus1/O=CESNET/O=Masaryk University/CN=Milos Mulachttp://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusDone1970-01-01T02:00:01ZFILEhttp://egee.cesnet.cz/en/Schema/LB/Attributes:userCertSubj1970-01-01T02:00:01ZFILEhttp://localhost:8901 +https://localhost:7846/pokus1/O=CESNET/O=Masaryk University/CN=Milos Mulachttp://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusDone1970-01-01T02:00:01ZFILEhttp://egee.cesnet.cz/en/Schema/LB/Attributes:userCertSubj1970-01-01T02:00:01ZFILEhttp://localhost:8901 diff --git a/org.glite.jp.index/examples/query-tests/origin_query.out b/org.glite.jp.index/examples/query-tests/origin_query.out index bd8e3a7..a88401a 100644 --- a/org.glite.jp.index/examples/query-tests/origin_query.out +++ b/org.glite.jp.index/examples/query-tests/origin_query.out @@ -11,4 +11,4 @@ Attributes: http://egee.cesnet.cz/en/Schema/LB/Attributes:user OK -https://localhost:7846/pokus1/O=CESNET/O=Masaryk University/CN=Milos Mulachttp://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusDone1970-01-01T02:00:01ZFILEhttp://egee.cesnet.cz/en/Schema/LB/Attributes:userCertSubj1970-01-01T02:00:01ZFILEhttp://localhost:8901 \ No newline at end of file +https://localhost:7846/pokus1/O=CESNET/O=Masaryk University/CN=Milos Mulachttp://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusDone1970-01-01T02:00:01ZFILEhttp://egee.cesnet.cz/en/Schema/LB/Attributes:userCertSubj1970-01-01T02:00:01ZFILEhttp://localhost:8901 diff --git a/org.glite.jp.index/examples/query-tests/run-test.sh b/org.glite.jp.index/examples/query-tests/run-test.sh index e386211..89f99d0 100755 --- a/org.glite.jp.index/examples/query-tests/run-test.sh +++ b/org.glite.jp.index/examples/query-tests/run-test.sh @@ -105,13 +105,20 @@ drop_db() { } run_is() { + # check + if [ -f "${GLITE_JPIS_TEST_PIDFILE}" ]; then + echo "Index server already running!" + echo " pid $(cat ${GLITE_JPIS_TEST_PIDFILE})" + echo " pidfile ${GLITE_JPIS_TEST_PIDFILE}" + exit 1 + fi + # run index server X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT} \ $GLITE_LOCATION/bin/glite-jp-indexd -m $GLITE_JPIS_TEST_DB -p $GLITE_JPIS_TEST_PORT \ -i ${GLITE_JPIS_TEST_PIDFILE} -o ${GLITE_JPIS_TEST_LOGFILE} \ -x ${GLITE_JPIS_TEST_CONFIG} $1\ - 2>/dev/null - + 2>/tmp/result if [ x"$?" != x"0" ]; then echo FAILED @@ -119,6 +126,9 @@ run_is() { exit 1 fi if [ ! -s "${GLITE_JPIS_TEST_PIDFILE}" ]; then + sleep 1 + fi + if [ ! -s "${GLITE_JPIS_TEST_PIDFILE}" ]; then echo "Can't startup index server." drop_db; exit 1 @@ -140,13 +150,14 @@ kill_is() { kill `cat ${GLITE_JPIS_TEST_PIDFILE}`; sleep 1; kill -9 `cat ${GLITE_JPIS_TEST_PIDFILE}` 2>/dev/null + rm -f ${GLITE_JPIS_TEST_PIDFILE} } run_test_query() { X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT} \ - $GLITE_LOCATION/examples/glite-jpis-client -f xml -q $1 \ - -i http://localhost:$GLITE_JPIS_TEST_PORT &>/tmp/result - DIFF=`diff -b --ignore-matching-lines="query: using JPIS" $2 /tmp/result` + $GLITE_LOCATION/examples/glite-jpis-client -f strippedxml -q $1 \ + -i http://localhost:$GLITE_JPIS_TEST_PORT 2>&1 | sed -e 's,,,' -e 's, SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/",,' > /tmp/result + DIFF=`diff -b -B --ignore-matching-lines="query: using JPIS" $2 /tmp/result` if [ -z "$DIFF" -a "$?" -eq "0" ] ; then echo "OK." rm /tmp/result @@ -172,13 +183,24 @@ run_test_query() { run_test_feed() { # run the example - numok=`X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT}\ - $GLITE_LOCATION/examples/glite-jpis-test -p $GLITE_JPIS_TEST_PORT \ - -m $GLITE_JPIS_TEST_DB -x $GLITE_JPIS_TEST_CONFIG 2>&1 | grep -c OK` + X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT}\ + $GLITE_LOCATION/examples/glite-jpis-test -p $GLITE_JPIS_TEST_PORT \ + -m $GLITE_JPIS_TEST_DB -x $GLITE_JPIS_TEST_CONFIG &>/tmp/result + numok="$(cat /tmp/result | grep -c OK)" if [ "$numok" -eq "2" ]; then echo OK. else echo FAILED! + echo --------------------------------------------------------------------------------------------------- + echo + echo "Obtained result (in /tmp/result):" + echo --------------------------------- + cat /tmp/result + echo + echo --------------------------------------------------------------------------------------------------- + drop_db; + kill_is; + exit 1 fi } diff --git a/org.glite.jp.index/examples/query-tests/simple_query.out b/org.glite.jp.index/examples/query-tests/simple_query.out index 7cd54fb..06c027b 100644 --- a/org.glite.jp.index/examples/query-tests/simple_query.out +++ b/org.glite.jp.index/examples/query-tests/simple_query.out @@ -11,4 +11,4 @@ Attributes: http://egee.cesnet.cz/en/Schema/LB/Attributes:user OK -https://localhost:7846/pokus2OwnerNamehttp://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusReady1970-01-01T02:00:01ZSYSTEMhttp://egee.cesnet.cz/en/Schema/LB/Attributes:userCertSubj1970-01-01T02:00:01ZSYSTEMhttp://localhost:8901 +https://localhost:7846/pokus2OwnerNamehttp://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusReady1970-01-01T02:00:01ZSYSTEMhttp://egee.cesnet.cz/en/Schema/LB/Attributes:userCertSubj1970-01-01T02:00:01ZSYSTEMhttp://localhost:8901 diff --git a/org.glite.jp.index/src/conf.c b/org.glite.jp.index/src/conf.c index 0617a79..52b44c5 100644 --- a/org.glite.jp.index/src/conf.c +++ b/org.glite.jp.index/src/conf.c @@ -11,10 +11,14 @@ #include #include +#include "soap_version.h" +#include + #include "conf.h" #include "db_ops.h" #include "ws_is_typeref.h" +#include #define SOAP_FMAC3 static #define WITH_NOGLOBAL @@ -65,7 +69,7 @@ static void usage(char *me) int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf **configuration) { - char *ps = NULL, *qt = NULL, *conf_file = NULL; + char *qt = NULL, *conf_file = NULL; int opt; glite_jp_is_conf *conf; @@ -199,19 +203,21 @@ static int read_conf(glite_jp_is_conf *conf, char *conf_file) } } if (out.__sizefeeds) { -#warning FIXME: list conf->feeds = calloc(out.__sizefeeds + 1, sizeof(*conf->feeds)); for (i=0; i < out.__sizefeeds; i++) { + struct jptype__feedSession *feed; + + feed = GLITE_SECURITY_GSOAP_LIST_GET(out.feeds, i); conf->feeds[i] = calloc(1, sizeof(*conf->feeds[i])); - conf->feeds[i]->PS_URL=strdup(out.feeds[i]->primaryServer); + conf->feeds[i]->PS_URL=strdup(feed->primaryServer); - if (out.feeds[i]->__sizecondition) { - glite_jpis_SoapToPrimaryQueryConds(&soap, out.feeds[i]->__sizecondition, - out.feeds[i]->condition, &conf->feeds[i]->query); + if (feed->__sizecondition) { + glite_jpis_SoapToPrimaryQueryConds(&soap, feed->__sizecondition, + feed->condition, &conf->feeds[i]->query); } - conf->feeds[i]->history = out.feeds[0]->history; - conf->feeds[i]->continuous = out.feeds[0]->continuous; + conf->feeds[i]->history = feed->history; + conf->feeds[i]->continuous = feed->continuous; } } @@ -230,7 +236,8 @@ static int dump_conf(void) { int retval; struct _jpelem__ServerConfigurationResponse out; struct soap soap; - + struct jptype__feedSession *feed; + struct jptype__primaryQuery *cond; soap_init(&soap); soap_set_namespaces(&soap, jpis__namespaces); @@ -254,21 +261,19 @@ static int dump_conf(void) { out.plugins[0] = strdup("plugin1"); out.plugins[1] = strdup("plugin2"); -#warning: FIXME: lists - out.__sizefeeds = 1; - out.feeds = calloc(1, sizeof(*out.feeds)); - out.feeds[0] = calloc(1, sizeof(*out.feeds[0])); - out.feeds[0]->primaryServer = strdup("PrimaryServer"); - out.feeds[0]->__sizecondition = 1; - out.feeds[0]->condition = calloc(1, sizeof(*(out.feeds[0]->condition)) ); - out.feeds[0]->condition[0] = calloc(1, sizeof(*(out.feeds[0]->condition[0])) ); - out.feeds[0]->condition[0]->attr = strdup("queryAttr"); - out.feeds[0]->condition[0]->op = jptype__queryOp__EQUAL; - out.feeds[0]->condition[0]->origin = jptype__attrOrig__SYSTEM; - out.feeds[0]->condition[0]->value = calloc(1, sizeof(*(out.feeds[0]->condition[0]->value)) ); - out.feeds[0]->condition[0]->value->string = strdup("attrValue"); - out.feeds[0]->history = 1; - out.feeds[0]->continuous = 0; + GLITE_SECURITY_GSOAP_LIST_CREATE(&soap, &out, feeds, struct jptype__feedSession, 1); + feed = GLITE_SECURITY_GSOAP_LIST_GET(out.feeds, 0); + feed->primaryServer = strdup("PrimaryServer"); + feed->__sizecondition = 1; + GLITE_SECURITY_GSOAP_LIST_CREATE(&soap, feed, condition, struct jptype__primaryQuery, 1); + cond = GLITE_SECURITY_GSOAP_LIST_GET(feed->condition, 0); + cond->attr = strdup("queryAttr"); + cond->op = jptype__queryOp__EQUAL; + cond->origin = jptype__attrOrig__SYSTEM; + cond->value = calloc(1, sizeof(*(cond->value))); + GSOAP_SETSTRING(cond->value, soap_strdup(&soap, "attrValue")); + feed->history = 1; + feed->continuous = 0; soap_serialize__jpelem__ServerConfigurationResponse(&soap, &out); retval = soap_put__jpelem__ServerConfigurationResponse(&soap, &out, "jpelem:ServerConfiguration", NULL); diff --git a/org.glite.jp.index/src/soap_ops.c b/org.glite.jp.index/src/soap_ops.c index 9b4772b..834c035 100644 --- a/org.glite.jp.index/src/soap_ops.c +++ b/org.glite.jp.index/src/soap_ops.c @@ -213,67 +213,65 @@ static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpele qwhere = strdup(""); for (i=0; i < in->__sizeconditions; i++) { - { - struct jptype__indexQuery *condition; - - condition = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i); - - /* attr name */ - if (strcmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) { - /* no subset from attr_ table, used jobs table instead */ - attr_md5 = NULL; - qa = strdup("("); - } else { - attr_md5 = str2md5(condition->attr); + struct jptype__indexQuery *condition; + + condition = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i); + + /* attr name */ + if (strcmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) { + /* no subset from attr_ table, used jobs table instead */ + attr_md5 = NULL; + qa = strdup("("); + } else { + attr_md5 = str2md5(condition->attr); + + /* origin */ + if (condition->origin) { + glite_jpis_SoapToAttrOrig(soap, condition->origin, &orig); + trio_asprintf(&qb, "attr_%|Ss.origin = %d AND ", attr_md5, orig); + } else + trio_asprintf(&qb, ""); + + /* select given records in attr_ table */ + trio_asprintf(&qa,"%s%s jobs.jobid = attr_%|Ss.jobid AND (", + (i ? "AND" : ""), qb, attr_md5); + + free(qb); + } - /* origin */ - if (condition->origin) { - glite_jpis_SoapToAttrOrig(soap, condition->origin, &orig); - trio_asprintf(&qb, "attr_%|Ss.origin = %d AND ", attr_md5, orig); - } else - trio_asprintf(&qb, ""); + /* inside part of the condition: record list (ORs) */ + for (j=0; j < condition->__sizerecord; j++) { + struct jptype__indexQueryRecord *record; - /* select given records in attr_ table */ - trio_asprintf(&qa,"%s%s jobs.jobid = attr_%|Ss.jobid AND (", - (i ? "AND" : ""), qb, attr_md5); + record = GLITE_SECURITY_GSOAP_LIST_GET(condition->record, j); + if (get_op(record->op, &qop)) goto err; + if (attr_md5) add_attr_table(attr_md5, &attr_tables); - free(qb); + attr.name = condition->attr; + if (GSOAP_ISSTRING(record->value)) { + attr.value = GSOAP_STRING(record->value); + attr.binary = 0; + } else { + attr.value = GSOAP_BLOB(record->value)->__ptr; + attr.size = GSOAP_BLOB(record->value)->__size; + attr.binary = 1; } - - /* inside part of the condition: record list (ORs) */ - for (j=0; j < condition->__sizerecord; j++) { - struct jptype__indexQueryRecord *record; - - record = GLITE_SECURITY_GSOAP_LIST_GET(condition->record, j); - if (get_op(record->op, &qop)) goto err; - if (attr_md5) add_attr_table(attr_md5, &attr_tables); - - attr.name = condition->attr; - if (GSOAP_ISSTRING(record->value)) { - attr.value = GSOAP_STRING(record->value); - attr.binary = 0; - } else { - attr.value = GSOAP_BLOB(record->value)->__ptr; - attr.size = GSOAP_BLOB(record->value)->__size; - attr.binary = 1; - } - glite_jpis_SoapToAttrOrig(soap, - condition->origin, &(attr.origin)); - if (strcmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) { - trio_asprintf(&qb,"%s%sjobs.dg_jobid %s \"%|Ss\"", - qa, (j ? " OR " : ""), qop, attr.value); - } else { - trio_asprintf(&qb,"%s%sattr_%|Ss.value %s \"%|Ss\"", - qa, (j ? " OR " : ""), attr_md5, qop, - glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255)); - } - free(qop); - free(qa); qa = qb; qb = NULL; + glite_jpis_SoapToAttrOrig(soap, + condition->origin, &(attr.origin)); + if (strcmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) { + trio_asprintf(&qb,"%s%sjobs.dg_jobid %s \"%|Ss\"", + qa, (j ? " OR " : ""), qop, attr.value); + } else { + trio_asprintf(&qb,"%s%sattr_%|Ss.value %s \"%|Ss\"", + qa, (j ? " OR " : ""), attr_md5, qop, + glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255)); } - trio_asprintf(&qb,"%s %s)", qwhere, qa); - free(qa); qwhere = qb; qb = NULL; qa = NULL; - free(attr_md5); + free(qop); + free(qa); qa = qb; qb = NULL; } + trio_asprintf(&qb,"%s %s)", qwhere, qa); + free(qa); qwhere = qb; qb = NULL; qa = NULL; + free(attr_md5); } qa = strdup(""); diff --git a/org.glite.jp.index/src/ws_is_typeref.c b/org.glite.jp.index/src/ws_is_typeref.c index 414b033..a888351 100644 --- a/org.glite.jp.index/src/ws_is_typeref.c +++ b/org.glite.jp.index/src/ws_is_typeref.c @@ -4,9 +4,11 @@ #include #include +#include "soap_version.h" #include "jpis_H.h" #include "ws_typemap.h" +#include #include "ws_is_typeref.h" #include "glite/jp/ws_fault.c" @@ -198,7 +200,7 @@ static int SoapToPrimaryQueryCond( int glite_jpis_SoapToPrimaryQueryConds( struct soap *soap, int size, - struct jptype__primaryQuery **in, + GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, primaryQuery) in, glite_jp_query_rec_t ***out) { glite_jp_query_rec_t **qr; @@ -208,7 +210,7 @@ int glite_jpis_SoapToPrimaryQueryConds( qr = calloc(size+1, sizeof(*qr)); for (i=0; i__size = size; if ( !(GSOAP_BLOB(val)->__ptr = soap_malloc(soap, GSOAP_BLOB(val)->__size)) ) return SOAP_FAULT; memcpy(GSOAP_BLOB(val)->__ptr, in, GSOAP_BLOB(val)->__size); // XXX how to handle id, type, option? } else { - GSOAP_BLOB(val) = NULL; - if ( !(GSOAP_STRING(val) = soap_strdup(soap, in)) ) return SOAP_FAULT; + GSOAP_SETSTRING(val, soap_strdup(soap, in)); + if ( !(GSOAP_STRING(val) ) ) return SOAP_FAULT; } *out = val; @@ -123,8 +123,7 @@ static void SoapToAttrOrig(glite_jp_attr_orig_t *out, const enum jptype__attrOri void glite_jpis_SoapToAttrVal(glite_jp_attrval_t *av, const struct jptype__attrValue *attr) { memset(av, 0, sizeof(*av)); av->name = attr->name; - av->binary = GSOAP_BLOB(attr->value) ? 1 : 0; - assert(av->binary || GSOAP_STRING(attr->value)); + av->binary = GSOAP_ISBLOB(attr->value); if (av->binary) { av->value = GSOAP_BLOB(attr->value)->__ptr; av->size = GSOAP_BLOB(attr->value)->__size ; -- 1.8.2.3