From: Aleš Křenek Date: Thu, 13 Oct 2005 12:56:30 +0000 (+0000) Subject: input sanity check -- report error rather then coredumping X-Git-Tag: glite-jp-client_R_1_0_0~71 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=e3212d839b8c75b745bff73794beb7cf07ecd597;p=jra1mw.git input sanity check -- report error rather then coredumping --- diff --git a/org.glite.jp.primary/src/soap_ops.c b/org.glite.jp.primary/src/soap_ops.c index fbdeef9..135b23c 100644 --- a/org.glite.jp.primary/src/soap_ops.c +++ b/org.glite.jp.primary/src/soap_ops.c @@ -280,6 +280,23 @@ static void s2jp_query(const struct jptype__primaryQuery *in, glite_jp_query_rec else out->origin = GLITE_JP_ATTR_ORIG_ANY; } + +static int check_sane_feed(glite_jp_context_t ctx,struct _jpelem__FeedIndex *in) +{ + glite_jp_error_t err; + memset(&err,0,sizeof err); + err.source = __FUNCTION__; + err.code = EINVAL; + + if (!in->destination) { + err.desc = "destination required"; + return glite_jp_stack_error(ctx,&err); + } + + return 0; +} + + SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndex( struct soap *soap, struct _jpelem__FeedIndex *in, @@ -304,6 +321,12 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndex( glite_jp_clear_error(ctx); + if (check_sane_feed(ctx,in)) { + err2fault(ctx,soap); + ret = SOAP_FAULT; + goto cleanup; + } + memcpy(attrs,in->attributes,sizeof *attrs * in->__sizeattributes); for (i = 0; i__sizeconditions; i++) s2jp_query(in->conditions[i],qry+i);