|
From: Chris B. <buc...@us...> - 2012-12-13 22:54:38
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SFCB - Small Footprint CIM Broker".
The branch, master has been updated
via c86319ff22f83476bd8805f0d50ed26ac698e5b8 (commit)
from e6db110f58fb78ce557efbcec3ae03b61b89977c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c86319ff22f83476bd8805f0d50ed26ac698e5b8
Author: buccella <buc...@li...>
Date: Thu Dec 13 17:54:35 2012 -0500
[ 3582039 ] SFCB should reject empty <VALUE> in most instances
-----------------------------------------------------------------------
Summary of changes:
diff --git a/NEWS b/NEWS
index 327866c..9c7cb56 100644
--- a/NEWS
+++ b/NEWS
@@ -134,6 +134,7 @@ Bugs fixed:
- 3452703 Default http uid used causes unexpected behavior
- 3381209 Memory leak inside getClass() used by invokeMethod()
- 3593006 trace shared mem leak
+- 3582039 SFCB should reject empty <VALUE> in most instances
Changes in 1.3.15
=================
diff --git a/cimRequest.c b/cimRequest.c
index df5bf9c..6ff6fcc 100644
--- a/cimRequest.c
+++ b/cimRequest.c
@@ -1848,14 +1848,11 @@ handleCimRequest(CimRequestContext * ctx, int flags, char * more)
#endif
if (hdr.rc) {
if (hdr.methodCall) {
- rs = methodErrResponse(&hdr, getErrSegment(CMPI_RC_ERR_FAILED,
- "invalid methodcall payload"));
+ rs = methodErrResponse(&hdr, getErrSegment(hdr.rc, hdr.errMsg));
} else {
if(!hdr.errMsg) hdr.errMsg = strdup("invalid imethodcall payload");
rs = iMethodErrResponse(&hdr, getErrSegment(hdr.rc,
hdr.errMsg));
-// rs = iMethodErrResponse(&hdr, getErrSegment(CMPI_RC_ERR_FAILED,
-// "invalid imethodcall XML"));
}
}
#ifdef ALLOW_UPDATE_EXPIRED_PW
diff --git a/cimXmlGen.c b/cimXmlGen.c
index 95ebed7..d44e889 100644
--- a/cimXmlGen.c
+++ b/cimXmlGen.c
@@ -359,6 +359,12 @@ str2CMPIValue(CMPIType type, XtokValue val, XtokValueReference * ref,
type = guessType(val.value);
}
+ /* empty VALUE for numerics is invalid XML (DSP201) */
+ if ((val.isEmpty) && (type & CMPI_UINT) && !(type & CMPI_ARRAY)) {
+ status->rc = CMPI_RC_ERR_INVALID_PARAMETER;
+ return (CMPIValue)CMPI_null;
+ }
+
if (type & CMPI_ARRAY) {
/*
* array type received -- needs special handling
@@ -387,7 +393,11 @@ str2CMPIValue(CMPIType type, XtokValue val, XtokValueReference * ref,
value.array = TrackedCMPIArray(max, t, NULL);
if (value.array != NULL) {
for (i = 0; i < max; i++) {
- v = str2CMPIValue(t, arr->values[i], refarr->values + i, ns, &rc);
+ v = str2CMPIValue(t, arr->values[i], refarr->values+i,ns, &rc);
+ if (rc.rc) {
+ status->rc = rc.rc;
+ return (CMPIValue)CMPI_null;
+ }
CMSetArrayElementAt(value.array, i, &v, t);
}
return value;
diff --git a/cimXmlOps.y b/cimXmlOps.y
index 511a597..1851492 100644
--- a/cimXmlOps.y
+++ b/cimXmlOps.y
@@ -1427,10 +1427,15 @@ buildInvokeMethodRequest(void *parm)
}
if (p->value.value) {
- CMPIValue val = str2CMPIValue(p->type, p->value, &p->valueRef,
- req->op.nameSpace.data, &st);
+ CMPIValue val = str2CMPIValue(p->type, p->value, &p->valueRef, req->op.nameSpace.data, &st);
+ if (st.rc) {
+ hdr->rc = st.rc;
+ hdr->errMsg = NULL;
+ return;
+ }
CMAddArg(in, p->name, &val, p->type);
}
+
}
sreq->in = setArgsMsgSegment(in);
diff --git a/cimXmlParser.c b/cimXmlParser.c
index 5ca7eec..92cd6a0 100644
--- a/cimXmlParser.c
+++ b/cimXmlParser.c
@@ -973,6 +973,7 @@ procValue(YYSTYPE * lvalp, ParserControl * parm)
if (attrsOk(parm->xmb, elm, attr, "VALUE", ZTOK_VALUE)) {
v = getContent(parm->xmb); /* v is a pointer to where the
* content starts */
+ lvalp->xtokValue.isEmpty = (v != NULL && strlen(v) > 0) ? 0 : 1;
lvalp->xtokValue.value = v;
return XTOK_VALUE;
}
@@ -1048,6 +1049,7 @@ procValueNamedInstance(YYSTYPE * lvalp, ParserControl * parm)
if (attrsOk(parm->xmb, elm, attr, "VALUE.NAMEDINSTANCE",
ZTOK_VALUENAMEDINSTANCE)) {
lvalp->xtokValue.value = getContent(parm->xmb);
+ lvalp->xtokValue.isEmpty = 0;
return XTOK_VALUENAMEDINSTANCE;
}
}
@@ -1064,6 +1066,7 @@ procInstancePath(YYSTYPE * lvalp, ParserControl * parm)
if (tagEquals(parm->xmb, "INSTANCEPATH")) {
if (attrsOk(parm->xmb, elm, attr, "INSTANCEPATH", ZTOK_INSTANCEPATH)) {
lvalp->xtokValue.value = getContent(parm->xmb);
+ lvalp->xtokValue.isEmpty = 0;
return XTOK_INSTANCEPATH;
}
}
@@ -1080,6 +1083,7 @@ procNameSpacePath(YYSTYPE * lvalp, ParserControl * parm)
if (tagEquals(parm->xmb, "NAMESPACEPATH")) {
if (attrsOk(parm->xmb, elm, attr, "NAMESPACEPATH", ZTOK_NAMESPACEPATH)) {
lvalp->xtokValue.value = getContent(parm->xmb);
+ lvalp->xtokValue.isEmpty = 0;
return XTOK_NAMESPACEPATH;
}
}
@@ -1097,6 +1101,7 @@ procValueReference(YYSTYPE * lvalp, ParserControl * parm)
if (attrsOk(parm->xmb, elm, attr, "VALUE.REFERENCE",
ZTOK_VALUEREFERENCE)) {
lvalp->xtokValue.value = getContent(parm->xmb);
+ lvalp->xtokValue.isEmpty = 0;
return XTOK_VALUEREFERENCE;
}
}
diff --git a/cimXmlParser.h b/cimXmlParser.h
index 148878e..7c752f2 100644
--- a/cimXmlParser.h
+++ b/cimXmlParser.h
@@ -99,6 +99,7 @@ typedef struct xtokValue {
struct xtokClass *class;
};
TypeValue type;
+ char isEmpty;
} XtokValue;
typedef struct xtokValueArray {
hooks/post-receive
--
SFCB - Small Footprint CIM Broker
|