|
From: Chris B. <buc...@us...> - 2012-05-14 16:45:48
|
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 ee5dac7462c8b026e62f197ddcb53a89b8177ced (commit)
via 45f17b53fa1e744d699c904ace650c092d273af4 (commit)
via 29fc7c5a0999194cc3fe9e5785e3ea48a12a0673 (commit)
from e4d06da1801b9ae1cc51277510fc3c4c3944d42d (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 ee5dac7462c8b026e62f197ddcb53a89b8177ced
Author: buccella <buc...@li...>
Date: Mon May 14 12:46:14 2012 -0400
[ 3525651 ] CMSetPropertyFilter not CMPI 2.0 compliant
commit 45f17b53fa1e744d699c904ace650c092d273af4
Author: buccella <buc...@li...>
Date: Mon May 14 12:20:32 2012 -0400
Missing changes from 3367363 in GetInstance
commit 29fc7c5a0999194cc3fe9e5785e3ea48a12a0673
Author: buccella <buc...@li...>
Date: Fri May 11 17:12:12 2012 -0400
fixed trace line
-----------------------------------------------------------------------
Summary of changes:
diff --git a/ChangeLog b/ChangeLog
index 921b1ca..410a2e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-14 Chris Buccella <buc...@li...>
+
+ * indCIMXMLHandler.c, instance.c, internalProvider.c, queryOperation.h,
+ queryStatement.c, result.c,
+ test/xmltest/InstanceTest25GetWithPropertyFilter.*:
+ [ 3525651 ] CMSetPropertyFilter not CMPI 2.0 compliant
+ (based on patch by Tyrel Datwyler)
+
2012-04-19 Michael Chase-Salerno <br...@li...>
* control.c, indCIMXMLHandler.c, interopServerProvider.c,
diff --git a/NEWS b/NEWS
index 1cd82fb..ef43ca7 100644
--- a/NEWS
+++ b/NEWS
@@ -100,7 +100,7 @@ Bugs Fixed:
- 3514627 unsupported sfcb.cfg param - use exit call
- 3516184 commClose close socket when file hndl is null
- 3517573 Problem with SequenceContext migration
-
+- 3525651 CMSetPropertyFilter not CMPI 2.0 compliant
Changes in 1.3.14
=================
diff --git a/cimXmlOps.y b/cimXmlOps.y
index 2903c31..5cf8e6c 100644
--- a/cimXmlOps.y
+++ b/cimXmlOps.y
@@ -361,7 +361,7 @@ buildGetInstanceRequest(void *parm)
sreqSize += req->properties * sizeof(MsgSegment);
sreq = calloc(1, sreqSize);
sreq->hdr.operation = OPS_GetInstance;
- sreq->hdr.count = req->properties + 2;
+ sreq->hdr.count = req->properties + GI_REQ_REG_SEGMENTS;
path =
TrackedCMPIObjectPath(req->op.nameSpace.data, req->op.className.data,
@@ -378,9 +378,11 @@ buildGetInstanceRequest(void *parm)
}
sreq->objectPath = setObjectPathMsgSegment(path);
sreq->principal = setCharsMsgSegment(hdr->principal);
+ sreq->userRole = setCharsMsgSegment(hdr->role);
sreq->hdr.sessionId = hdr->sessionId;
for (i = 0; i < req->properties; i++) {
+ fprintf(stderr, "setting filter prop %d to %s\n", i, req->propertyList.values[i].value);
sreq->properties[i] =
setCharsMsgSegment(req->propertyList.values[i].value);
}
diff --git a/indCIMXMLHandler.c b/indCIMXMLHandler.c
index 1db59da..e9de848 100644
--- a/indCIMXMLHandler.c
+++ b/indCIMXMLHandler.c
@@ -168,22 +168,6 @@ IndCIMXMLHandlerEnumInstanceNames(CMPIInstanceMI * mi,
_SFCB_RETURN(st);
}
-const char **
-getKeyList(const CMPIObjectPath * cop)
-{
- CMPIString *s;
- const char **list;
- int i = cop->ft->getKeyCount(cop, NULL);
- list = malloc((i + 1) * sizeof(char *));
- list[i] = NULL;
- while (i) {
- i--;
- cop->ft->getKeyAt(cop, i, &s, NULL);
- list[i] = s->ft->getCharPtr(s, NULL);
- }
- return list;
-}
-
void
filterInternalProps(CMPIInstance* ci)
{
@@ -308,7 +292,6 @@ IndCIMXMLHandlerGetInstance(CMPIInstanceMI * mi,
{
CMPIStatus st;
CMPIInstance* ci;
- const char** keyList;
_SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerGetInstance");
ci = internalProviderGetInstance(cop, &st);
@@ -318,11 +301,7 @@ IndCIMXMLHandlerGetInstance(CMPIInstanceMI * mi,
filterInternalProps(ci);
}
if (properties) {
- keyList = getKeyList(ci->ft->getObjectPath(ci, NULL));
- ci->ft->setPropertyFilter(ci, properties, keyList);
- if (keyList) {
- free(keyList);
- }
+ ci->ft->setPropertyFilter(ci, properties, NULL);
}
CMReturnInstance(rslt, ci);
}
diff --git a/instance.c b/instance.c
index a7a7748..059d98c 100644
--- a/instance.c
+++ b/instance.c
@@ -80,6 +80,10 @@ static void instFillDefaultProperties(struct native_instance *inst,
const char *ns, const char *cn);
#endif
+static CMPIStatus __ift_internal_setPropertyFilter(CMPIInstance * instance,
+ const char **propertyList,
+ const char **keys);
+
/****************************************************************************/
static void
@@ -112,6 +116,28 @@ __duplicate_list(const char **list)
return result;
}
+static char **__make_key_list(const CMPIObjectPath * cop)
+{
+ char **keys = NULL;
+ int i, j;
+
+ if (cop) {
+ j = CMGetKeyCount(cop, NULL);
+
+ if (j) {
+ /* allocate extra element since list needs to be NULL terminated */
+ keys = calloc(j + 1, sizeof(char *));
+ for (i = 0; i < j; i++) {
+ CMPIString *keyName;
+ CMGetKeyAt(cop, i , &keyName, NULL);
+ keys[i] = strdup(CMGetCharsPtr(keyName, NULL));
+ }
+ }
+ }
+
+ return keys;
+}
+
void
memLinkInstance(CMPIInstance *ci)
{
@@ -329,6 +355,14 @@ __ift_setObjectPath(CMPIInstance *inst, const CMPIObjectPath * cop)
int j;
CMPIStatus rc = { CMPI_RC_OK, NULL };
+ /* in the case the instance is filtered need to reset the filter with new key list */
+ if (((struct native_instance *)inst)->filtered) {
+ char **props = ((struct native_instance *)inst)->property_list;
+ char **keys = __make_key_list(cop);
+ __ift_internal_setPropertyFilter(inst, (const char **)props, (const char **)keys);
+ __release_list(keys);
+ }
+
/*
* get information out of objectpath
*/
@@ -462,8 +496,8 @@ __ift_getObjectPath(const CMPIInstance *instance, CMPIStatus *rc)
}
static CMPIStatus
-__ift_setPropertyFilter(CMPIInstance *instance,
- const char **propertyList, const char **keys)
+__ift_internal_setPropertyFilter(CMPIInstance *instance,
+ const char **propertyList, const char **keys)
{
int j,
m;
@@ -476,13 +510,6 @@ __ift_setPropertyFilter(CMPIInstance *instance,
struct native_instance *iNew,
iTemp;
- if (propertyList == NULL) {
- /*
- * NULL property list, no need to set filter
- */
- CMReturn(CMPI_RC_OK);
- }
-
cop =
TrackedCMPIObjectPath(instGetNameSpace(instance),
instGetClassName(instance), NULL);
@@ -529,6 +556,35 @@ __ift_setPropertyFilter(CMPIInstance *instance,
CMReturn(CMPI_RC_OK);
}
+static CMPIStatus __ift_setPropertyFilter(CMPIInstance * instance,
+ const char **propertyList,
+ const char **keys)
+{
+ CMPIStatus rc = { CMPI_RC_OK, NULL};
+ CMPIObjectPath *cop = NULL;
+ char **ikeys = NULL;
+
+ if (propertyList == NULL) {
+ /* NULL property list, no need to set filter */
+ CMReturn(CMPI_RC_OK);
+ }
+ if (instance == NULL) {
+ rc.rc = CMPI_RC_ERR_INVALID_HANDLE;
+ }
+ else {
+ /* CMPI 2.0 dictates that keyList is to be ignored by MB, and remains for Binary compat.
+ Build keyList from instance objectpath to be passed to internal filter implementation */
+ cop = CMGetObjectPath(instance, NULL);
+ ikeys = __make_key_list(cop);
+
+ rc = __ift_internal_setPropertyFilter(instance, propertyList, (const char **)ikeys);
+
+ __release_list(ikeys);
+ }
+
+ return rc;
+}
+
static CMPIData
__ift_getQualifier(CMPIInstance *inst, const char *name, CMPIStatus *rc)
{
diff --git a/internalProvider.c b/internalProvider.c
index a51a9e3..c330ceb 100644
--- a/internalProvider.c
+++ b/internalProvider.c
@@ -104,22 +104,6 @@ ipGetNext(BlobIndex * bi, int *len, char **keyb, size_t * keybl)
return instifyBlob(blob);
}
-const char **
-getKeyList(const CMPIObjectPath * cop)
-{
- CMPIString *s;
- const char **list;
- int i = cop->ft->getKeyCount(cop, NULL);
- list = malloc((i + 1) * sizeof(char *));
- list[i] = NULL;
- while (i) {
- i--;
- cop->ft->getKeyAt(cop, i, &s, NULL);
- list[i] = s->ft->getCharPtr(s, NULL);
- }
- return list;
-}
-
static char **nsTab = NULL;
static int nsTabLen = 0;
@@ -284,7 +268,6 @@ enumInstances(CMPIInstanceMI * mi,
CMPIObjectPath *op;
CMPIArray *ar;
CMPIData rv;
- const char **keyList;
_SFCB_ENTER(TRACE_INTERNALPROVIDER, "enumInstances");
_SFCB_TRACE(1, ("--- %s %s", nss, cns));
@@ -312,11 +295,7 @@ enumInstances(CMPIInstanceMI * mi,
for (ci = ipGetFirst(bi, &len, NULL, 0); ci;
ci = ipGetNext(bi, &len, NULL, 0)) {
if (properties) {
- keyList = getKeyList(ci->ft->getObjectPath(ci, NULL));
- ci->ft->setPropertyFilter(ci, properties, keyList);
- if (keyList) {
- free(keyList);
- }
+ ci->ft->setPropertyFilter(ci, properties, NULL);
}
_SFCB_TRACE(1, ("--- returning instance %p", ci));
retFnc(rslt, ci);
@@ -420,17 +399,12 @@ InternalProviderGetInstance(CMPIInstanceMI * mi,
{
CMPIStatus st = { CMPI_RC_OK, NULL };
CMPIInstance *ci;
- const char **keyList;
_SFCB_ENTER(TRACE_INTERNALPROVIDER, "InternalProviderGetInstance");
ci = internalProviderGetInstance(cop, &st);
if (st.rc == CMPI_RC_OK && properties) {
- keyList = getKeyList(ci->ft->getObjectPath(ci, NULL));
- ci->ft->setPropertyFilter(ci, properties, keyList);
- if (keyList) {
- free(keyList);
- }
+ ci->ft->setPropertyFilter(ci, properties, NULL);
}
if (st.rc == CMPI_RC_OK) {
@@ -520,7 +494,6 @@ InternalProviderModifyInstance(CMPIInstanceMI * mi,
const char *nss = ns->ft->getCharPtr(ns, NULL);
const char *cns = cn->ft->getCharPtr(cn, NULL);
const char *bnss = repositoryNs(nss);
- const char **keyList;
_SFCB_ENTER(TRACE_INTERNALPROVIDER, "InternalProviderSetInstance");
@@ -536,11 +509,7 @@ InternalProviderModifyInstance(CMPIInstanceMI * mi,
}
if (properties) {
- keyList = getKeyList(ci->ft->getObjectPath(ci, NULL));
- ci->ft->setPropertyFilter((CMPIInstance *) ci, properties, keyList);
- if (keyList) {
- free(keyList);
- }
+ ci->ft->setPropertyFilter((CMPIInstance *) ci, properties, NULL);
}
len = getInstanceSerializedSize(ci);
diff --git a/providerMgr.c b/providerMgr.c
index 6af92a7..4db8f91 100644
--- a/providerMgr.c
+++ b/providerMgr.c
@@ -1151,7 +1151,7 @@ getProviderContext(BinRequestContext * ctx)
ComSockets sockets;
OperationHdr *ohdr = ctx->oHdr;
- _SFCB_ENTER(TRACE_PROVIDERMGR, "internalGetProviderContext");
+ _SFCB_ENTER(TRACE_PROVIDERMGR, "getProviderContext");
l = sizeof(*ohdr) + ohdr->nameSpace.length + ohdr->className.length;
buf = (char *) malloc(l + 8);
diff --git a/queryOperation.h b/queryOperation.h
index 2c2b3f8..6e0b4e4 100644
--- a/queryOperation.h
+++ b/queryOperation.h
@@ -234,7 +234,7 @@ struct qlPropertySource {
struct qlStatementFt {
void (*release) (QLStatement *);
CMPIInstance *(*cloneAndFilter) (QLStatement *, CMPIInstance *,
- CMPIObjectPath *, char **);
+ CMPIObjectPath *);
void (*setAllProperties) (QLStatement *, int allProperties);
void (*appendSelectPropertyName) (QLStatement *, char *name);
void (*addFromClass) (QLStatement *, char *cn, char *ca);
diff --git a/queryStatement.c b/queryStatement.c
index 91aaf07..b11840f 100644
--- a/queryStatement.c
+++ b/queryStatement.c
@@ -186,14 +186,12 @@ qsRelease(QLStatement * st)
}
static CMPIInstance *
-qsCloneAndFilter(QLStatement * st, CMPIInstance *ci, CMPIObjectPath * cop,
- char **kNames)
+qsCloneAndFilter(QLStatement * st, CMPIInstance *ci, CMPIObjectPath * cop)
{
CMPIInstance *nic = CMNewInstance(Broker, cop, NULL);
CMPICount i,
c = CMGetPropertyCount(ci, NULL);
- CMSetPropertyFilter(nic, (const char **) st->spNames,
- (const char **) kNames);
+ CMSetPropertyFilter(nic, (const char **) st->spNames, NULL);
for (i = 0; i < c; i++) {
CMPIString *name;
CMPIData d = CMGetPropertyAt(ci, i, &name, NULL);
diff --git a/result.c b/result.c
index 3a5edd3..025db97 100644
--- a/result.c
+++ b/result.c
@@ -303,7 +303,7 @@ __rft_returnInstance(const CMPIResult *result,
if (r->qs->allProps == 0) {
instance =
r->qs->ft->cloneAndFilter(r->qs, (CMPIInstance *) instance,
- CMGetObjectPath(instance,NULL), r->qs->keys);
+ CMGetObjectPath(instance,NULL));
releaseInstance = 1;
}
} else
@@ -312,7 +312,7 @@ __rft_returnInstance(const CMPIResult *result,
if (r->qs->allProps == 0) {
instance =
r->qs->ft->cloneAndFilter(r->qs, (CMPIInstance *) instance,
- CMGetObjectPath(instance,NULL), r->qs->keys);
+ CMGetObjectPath(instance,NULL));
releaseInstance = 1;
}
}
diff --git a/test/cimrstest/Interim_gi_TestPerson.lines b/test/xmltest/InstanceTest25GetWithPropertyFilter.lines
similarity index 60%
copy from test/cimrstest/Interim_gi_TestPerson.lines
copy to test/xmltest/InstanceTest25GetWithPropertyFilter.lines
index 0f40d14..b4ea1fd 100644
--- a/test/cimrstest/Interim_gi_TestPerson.lines
+++ b/test/xmltest/InstanceTest25GetWithPropertyFilter.lines
@@ -1,5 +1,5 @@
-<IRETURNVALUE>
<INSTANCE CLASSNAME="TEST_Person">
<PROPERTY NAME="name" TYPE="string">
-<VALUE>Mike</VALUE>
-Mike
+<VALUE>Michael</VALUE>
+</PROPERTY>
+</INSTANCE>
diff --git a/test/xmltest/InstanceTest25GetWithPropertyFilter.xml b/test/xmltest/InstanceTest25GetWithPropertyFilter.xml
new file mode 100644
index 0000000..2d6e265
--- /dev/null
+++ b/test/xmltest/InstanceTest25GetWithPropertyFilter.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<CIM CIMVERSION="2.0" DTDVERSION="2.0">
+<MESSAGE ID="4711" PROTOCOLVERSION="1.0"><SIMPLEREQ><IMETHODCALL NAME="GetInstance"><LOCALNAMESPACEPATH><NAMESPACE NAME="root"></NAMESPACE><NAMESPACE NAME="cimv2"></NAMESPACE></LOCALNAMESPACEPATH>
+<IPARAMVALUE NAME="LocalOnly"><VALUE>FALSE</VALUE></IPARAMVALUE>
+<IPARAMVALUE NAME="IncludeQualifiers"><VALUE>FALSE</VALUE></IPARAMVALUE>
+<IPARAMVALUE NAME="IncludeClassOrigin"><VALUE>TRUE</VALUE></IPARAMVALUE>
+<IPARAMVALUE NAME="PropertyList"><VALUE.ARRAY><VALUE>name</VALUE></VALUE.ARRAY></IPARAMVALUE>
+<IPARAMVALUE NAME="InstanceName"><INSTANCENAME CLASSNAME="Test_person"><KEYBINDING NAME="name"><KEYVALUE VALUETYPE="string">Michael</KEYVALUE></KEYBINDING></INSTANCENAME></IPARAMVALUE>
+</IMETHODCALL></SIMPLEREQ>
+</MESSAGE></CIM>
hooks/post-receive
--
SFCB - Small Footprint CIM Broker
|