Update of /cvsroot/sblim/sfcb In directory vz-cvs-3.sog:/tmp/cvs-serv24421 Modified Files: instance.c indCIMXMLHandler.c queryStatement.c internalProvider.c queryOperation.h result.c ChangeLog NEWS Log Message: [ 3525651 ] CMSetPropertyFilter not CMPI 2.0 compliant Index: instance.c =================================================================== RCS file: /cvsroot/sblim/sfcb/instance.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- instance.c 23 Nov 2011 18:22:16 -0000 1.53 +++ instance.c 11 May 2012 20:05:11 -0000 1.54 @@ -77,6 +77,10 @@ const char * ns, const char * cn); #endif +static CMPIStatus __ift_internal_setPropertyFilter(CMPIInstance * instance, + const char **propertyList, + const char **keys); + /****************************************************************************/ static void __release_list(char **list) @@ -107,6 +111,29 @@ } +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) { struct native_instance *i = (struct native_instance *) ci; @@ -304,6 +331,14 @@ 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 */ if (cop) { j = CMGetKeyCount(cop, &tmp1); @@ -420,9 +455,9 @@ } -static CMPIStatus __ift_setPropertyFilter(CMPIInstance * instance, - const char **propertyList, - const char **keys) +static CMPIStatus __ift_internal_setPropertyFilter(CMPIInstance * instance, + const char **propertyList, + const char **keys) { int j,m; CMPIObjectPath * cop; @@ -433,11 +468,6 @@ struct native_instance *i = (struct native_instance *) 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); if(cop) { if(i->mem_state == MEM_RELEASED || i->mem_state > 0) { @@ -482,6 +512,36 @@ 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) { Index: ChangeLog =================================================================== RCS file: /cvsroot/sblim/sfcb/ChangeLog,v retrieving revision 1.763 retrieving revision 1.764 diff -u -d -r1.763 -r1.764 --- ChangeLog 19 Apr 2012 17:39:55 -0000 1.763 +++ ChangeLog 11 May 2012 20:05:11 -0000 1.764 @@ -1,3 +1,11 @@ +2012-05-11 Chris Buccella <buc...@li...> + + * instance.c, indCIMXMLHandler.c, internalProvider.c, + queryOperation.h, queryStatement.c, result.c, + test/xmltest/InstanceTest25GetWithPropertyFilter.xml: + [ 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, Index: queryStatement.c =================================================================== RCS file: /cvsroot/sblim/sfcb/queryStatement.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- queryStatement.c 14 Apr 2010 20:06:24 -0000 1.16 +++ queryStatement.c 11 May 2012 20:05:11 -0000 1.17 @@ -169,12 +169,11 @@ } } -static CMPIInstance* qsCloneAndFilter(QLStatement *st, CMPIInstance *ci, CMPIObjectPath *cop, - char **kNames) +static CMPIInstance* 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); Index: queryOperation.h =================================================================== RCS file: /cvsroot/sblim/sfcb/queryOperation.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- queryOperation.h 19 Mar 2009 23:31:49 -0000 1.11 +++ queryOperation.h 11 May 2012 20:05:11 -0000 1.12 @@ -219,7 +219,7 @@ struct qlStatementFt { void (*release)(QLStatement*); - CMPIInstance *(*cloneAndFilter)(QLStatement*,CMPIInstance*,CMPIObjectPath*,char**); + CMPIInstance *(*cloneAndFilter)(QLStatement*,CMPIInstance*,CMPIObjectPath*); void (*setAllProperties)(QLStatement*,int allProperties); void (*appendSelectPropertyName)(QLStatement*,char *name); void (*addFromClass)(QLStatement*,char *cn, char *ca); Index: indCIMXMLHandler.c =================================================================== RCS file: /cvsroot/sblim/sfcb/indCIMXMLHandler.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- indCIMXMLHandler.c 19 Apr 2012 17:39:55 -0000 1.49 +++ indCIMXMLHandler.c 11 May 2012 20:05:11 -0000 1.50 @@ -270,7 +270,6 @@ { CMPIStatus st; CMPIInstance* ci; - const char** keyList; _SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerGetInstance"); @@ -281,11 +280,7 @@ 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); } Index: internalProvider.c =================================================================== RCS file: /cvsroot/sblim/sfcb/internalProvider.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- internalProvider.c 14 May 2010 22:57:18 -0000 1.43 +++ internalProvider.c 11 May 2012 20:05:11 -0000 1.44 @@ -264,7 +264,6 @@ CMPIObjectPath *op; CMPIArray *ar; CMPIData rv; - const char **keyList; _SFCB_ENTER(TRACE_INTERNALPROVIDER, "enumInstances"); _SFCB_TRACE(1,("--- %s %s",nss,cns)); @@ -288,11 +287,7 @@ if ((bi=_getIndex(bnss,cns))!=NULL) { 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); @@ -382,17 +377,12 @@ { 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) { @@ -475,7 +465,6 @@ 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"); @@ -491,11 +480,7 @@ } 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); Index: result.c =================================================================== RCS file: /cvsroot/sblim/sfcb/result.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- result.c 23 Sep 2011 20:18:46 -0000 1.17 +++ result.c 11 May 2012 20:05:11 -0000 1.18 @@ -254,7 +254,7 @@ if (irc==1) { if (r->qs->allProps==0) { instance= - r->qs->ft->cloneAndFilter(r->qs,(CMPIInstance *)instance,CMGetObjectPath(instance, NULL),r->qs->keys); + r->qs->ft->cloneAndFilter(r->qs,(CMPIInstance *)instance,CMGetObjectPath(instance, NULL)); releaseInstance=1; } } @@ -262,7 +262,7 @@ } else { if (r->qs->allProps==0) { - instance=r->qs->ft->cloneAndFilter(r->qs,(CMPIInstance *)instance,CMGetObjectPath(instance,NULL), r->qs->keys); + instance=r->qs->ft->cloneAndFilter(r->qs,(CMPIInstance *)instance,CMGetObjectPath(instance,NULL)); releaseInstance=1; } } Index: NEWS =================================================================== RCS file: /cvsroot/sblim/sfcb/NEWS,v retrieving revision 1.684 retrieving revision 1.685 diff -u -d -r1.684 -r1.685 --- NEWS 19 Apr 2012 17:39:55 -0000 1.684 +++ NEWS 11 May 2012 20:05:11 -0000 1.685 @@ -14,6 +14,7 @@ - 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 ================= |