From: František Dvořák Date: Mon, 2 Apr 2007 17:27:08 +0000 (+0000) Subject: Fixed WITHIN test. X-Git-Tag: glite-jp_R_1_4_0_1~11 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=988a0847394ab6f4321ce39f09a2236c8f22f8da;p=jra1mw.git Fixed WITHIN test. Check for valid attributes to get better error msg. --- 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 9c0335a..32388a0 100755 --- a/org.glite.jp.index/examples/query-tests/run-test.sh +++ b/org.glite.jp.index/examples/query-tests/run-test.sh @@ -291,6 +291,6 @@ echo -n "WITHIN test.......... " create_db; run_is "-n"; import_db $GLITE_LOCATION/examples/query-tests/dump1.sql; -run_test_query $GLITE_LOCATION/examples/query-tests/within_query.in $GLITE_LOCATION/examples/query-tests/exists_query.out; +run_test_query $GLITE_LOCATION/examples/query-tests/within_query.in $GLITE_LOCATION/examples/query-tests/within_query.out; drop_db; kill_is; diff --git a/org.glite.jp.index/src/soap_ops.c b/org.glite.jp.index/src/soap_ops.c index 000082d..af6d24b 100644 --- a/org.glite.jp.index/src/soap_ops.c +++ b/org.glite.jp.index/src/soap_ops.c @@ -161,6 +161,21 @@ end: } +static int checkConditions(glite_jpis_context_t ctx, struct _jpelem__QueryJobs *in) { + int i, j; + char *attr; + + for (i = 0; i < in->__sizeconditions; i++) { + attr = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i)->attr; + if (!attr) return 1; + for (j = 0; ctx->conf->attrs[j] && strcasecmp(ctx->conf->attrs[j], attr) != 0; j++); + if (!ctx->conf->attrs[j]) return 1; + } + + return 0; +} + + /* adds attr table name to the list (null terminated) , iff unigue */ static void add_attr_table(char *new, char ***attr_tables) { @@ -586,12 +601,18 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__QueryJobs( puts(__FUNCTION__); memset(out, 0, sizeof(*out)); - /* test whether there is any indexed aatribudet in the condition */ + /* test whether there is any indexed attribudes in the condition */ if ( checkIndexedConditions(ctx, in) ) { fprintf(stderr, "No indexed attribute in query\n"); return SOAP_ERR; } + /* test whether there is known attribudes in the condition */ + if ( checkConditions(ctx, in) ) { + fprintf(stderr, "Unknown attribute in query\n"); + return SOAP_ERR; + } + /* get all jobids matching the conditions */ if ( get_jobids(soap, ctx, in, &jobids, &ps_list) ) { return SOAP_ERR;