input sanity check -- report error rather then coredumping
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 13 Oct 2005 12:56:30 +0000 (12:56 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 13 Oct 2005 12:56:30 +0000 (12:56 +0000)
org.glite.jp.primary/src/soap_ops.c

index fbdeef9..135b23c 100644 (file)
@@ -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<in->__sizeconditions; i++) s2jp_query(in->conditions[i],qry+i);