Update to sblim-sfcb-1.4.5

This commit is contained in:
Vitezslav Crhonek 2013-09-05 13:16:33 +02:00
parent dabdd6746d
commit 2db677ed02
15 changed files with 65 additions and 773 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ sblim-sfcb-1.3.8.tar.bz2
/sblim-sfcb-1.3.14.tar.bz2
/sblim-sfcb-1.3.15.tar.bz2
/sblim-sfcb-1.3.16.tar.bz2
/sblim-sfcb-1.4.5.tar.bz2

View File

@ -1,12 +0,0 @@
diff -up sblim-sfcb-1.3.10/cmpimacs.h.orig sblim-sfcb-1.3.10/cmpimacs.h
--- sblim-sfcb-1.3.10/cmpimacs.h.orig 2010-12-06 14:24:21.599940670 +0100
+++ sblim-sfcb-1.3.10/cmpimacs.h 2010-12-06 14:32:05.792322703 +0100
@@ -1263,7 +1263,7 @@ inline static CMPICount CMGetArgCount (c
// CMPIString Macros
-# define CMGetCharPtr(s) ((char*)s->hdl)
+# define CMGetCharPtr(s) ((s) ? (char*)(s)->hdl : NULL)
# ifdef CMPI_INLINE
/** Get a pointer to a C char* representation of this String.

View File

@ -1,26 +0,0 @@
diff -up sblim-sfcb-1.3.14/cimXmlRequest.c.orig sblim-sfcb-1.3.14/cimXmlRequest.c
--- sblim-sfcb-1.3.14/cimXmlRequest.c.orig 2012-06-07 13:09:59.006978825 +0200
+++ sblim-sfcb-1.3.14/cimXmlRequest.c 2012-06-07 13:10:26.652133786 +0200
@@ -20,7 +20,8 @@
*
*/
-
+#include <sys/time.h>
+#include <sys/resource.h>
#include "cmpidt.h"
#include "cmpidtx.h"
diff -up sblim-sfcb-1.3.14/providerMgr.c.orig sblim-sfcb-1.3.14/providerMgr.c
--- sblim-sfcb-1.3.14/providerMgr.c.orig 2012-06-07 11:34:30.226930620 +0200
+++ sblim-sfcb-1.3.14/providerMgr.c 2012-06-07 13:03:34.140826089 +0200
@@ -24,6 +24,9 @@
#include <signal.h>
#include <time.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
#include "cmpidt.h"
#include "providerRegister.h"
#include "providerMgr.h"

View File

@ -1,7 +1,7 @@
diff -up sblim-sfcb-1.3.16/providerDrv.c.orig sblim-sfcb-1.3.16/providerDrv.c
--- sblim-sfcb-1.3.16/providerDrv.c.orig 2013-01-07 16:39:58.922924254 +0100
+++ sblim-sfcb-1.3.16/providerDrv.c 2013-01-07 16:40:12.121988127 +0100
@@ -3116,7 +3116,7 @@ void processProviderInvocationRequests(c
diff -up sblim-sfcb-1.4.5/providerDrv.c.orig sblim-sfcb-1.4.5/providerDrv.c
--- sblim-sfcb-1.4.5/providerDrv.c.orig 2013-09-04 12:59:22.140813239 +0200
+++ sblim-sfcb-1.4.5/providerDrv.c 2013-09-04 12:59:40.511870274 +0200
@@ -3585,7 +3585,7 @@ processProviderInvocationRequests(char *
rc = spRecvReq(&providerSockets.receive, &parms->requestor,
(void **) &parms->req, &rl, &mqg);
if (mqg.rdone) {

View File

@ -1,103 +0,0 @@
replaceClStringN() relocates items in ClStrBuf, using strlen() to get
lengths of the items. With embedded instances / objects, strlen() is not
useful at all, we must get length of the item using other means.
The patch is quite crude, there might be better way, how to get the lenghts
(e.g. by having ClStrBuf.lenPtr[], which would track lenght of each item).
Version 2: do not get lengths from fb->indexPtr, it is being modified,
use a copy of it instead.
diff -up sblim-sfcb-1.3.16/objectImpl.c.embedded-crash sblim-sfcb-1.3.16/objectImpl.c
--- sblim-sfcb-1.3.16/objectImpl.c.embedded-crash 2013-04-18 16:49:51.941521957 +0200
+++ sblim-sfcb-1.3.16/objectImpl.c 2013-04-18 16:39:30.000000000 +0200
@@ -449,6 +449,29 @@ static void replaceClString(ClObjectHdr
return replaceClStringN(hdr, id, str, 0);
}
+static int getBufIndexLen(int *indexPtr, int bUsed, int iUsed, int index)
+{
+ /*
+ * Find length of 'string' in fb at given index.
+ * We cannot use strlen, because some items are not strings but embedded
+ * instances.
+ * We cannot simply substract fb->indexPtr[index+1] - fb->indexPtr[index],
+ * because the entries are not consecutive! They are shuffled by
+ * replaceClStringN().
+ * Therefore the only way to find a length of our 'string' is to find
+ * string, which starts immediately after it. Let's call it 'nearest'
+ * string. */
+ int nearest_start = bUsed;
+ int our_start = indexPtr[index];
+ int i;
+ for (i = 0; i<iUsed; i++)
+ if (indexPtr[i] > our_start && indexPtr[i] < nearest_start) {
+ nearest_start = indexPtr[i];
+ }
+ int len = nearest_start - our_start;
+ return len;
+}
+
static void
replaceClStringN(ClObjectHdr * hdr, int id, const char *str, unsigned int length)
{
@@ -457,15 +480,20 @@ replaceClStringN(ClObjectHdr * hdr, int
char *ts, *fs;
long i, l, u;
ClStrBuf *fb;
+ int *oldIndexPtr;
fb = getStrBufPtr(hdr);
ts = (char *) malloc(fb->bUsed);
fs = &fb->buf[0];
+ /* Copy indexPtr from the buffer, so we can compute lengths of items in it.*/
+ oldIndexPtr = (int*) malloc(sizeof(int)*fb->iUsed);
+ memcpy(oldIndexPtr, fb->indexPtr, sizeof(int)*fb->iUsed);
+
for (u = i = 0; i < fb->iUsed; i++) {
if (i != id - 1) {
char *f = fs + fb->indexPtr[i];
- l = strlen(f) + 1;
+ l = getBufIndexLen(oldIndexPtr, fb->bUsed, fb->iUsed, i);
fb->indexPtr[i] = u;
memcpy(ts + u, f, l);
u += l;
@@ -474,6 +502,7 @@ replaceClStringN(ClObjectHdr * hdr, int
memcpy(fs, ts, u);
fb->bUsed = u;
free(ts);
+ free(oldIndexPtr);
i = addClStringN(hdr, str, length);
fb = getStrBufPtr(hdr);
@@ -498,16 +527,20 @@ removeClObject(ClObjectHdr * hdr, int id
// char *tmpstr = NULL;
long i, l, u;
ClStrBuf *fb;
+ int *oldIndexPtr;
fb = getStrBufPtr(hdr);
ts = (char *) malloc(fb->bUsed); /* tmp string buffer */
fs = &fb->buf[0];
+ /* Copy indexPtr from the buffer, so we can compute lengths of items in it.*/
+ oldIndexPtr = (int*) malloc(sizeof(int)*fb->iUsed);
+ memcpy(oldIndexPtr, fb->indexPtr, sizeof(int)*fb->iUsed);
for (u = i = 0; i < fb->iUsed; i++) {
if (i != id - 1) { /* loop through and copy over all _other_ properties */
// fprintf(stderr, "replace: keeping %ld\n", i);
char *f = fs + fb->indexPtr[i];
- l = fb->indexPtr[i+1] - fb->indexPtr[i];
+ l = getBufIndexLen(oldIndexPtr, fb->bUsed, fb->iUsed, i);
/* Bugzilla 74159 - Align the string buffer & null terminate */
/*if (l % sizeof(long) != 0) {
@@ -535,6 +568,7 @@ removeClObject(ClObjectHdr * hdr, int id
memcpy(fs, ts, u);
fb->bUsed = u;
free(ts);
+ free(oldIndexPtr);
fb->iUsed--; /* fixup the item count, since we have one fewer elements */

View File

@ -1,394 +0,0 @@
diff -up sblim-sfcb-1.3.16/cimXmlGen.c.orig sblim-sfcb-1.3.16/cimXmlGen.c
--- sblim-sfcb-1.3.16/cimXmlGen.c.orig 2013-06-13 16:13:19.001289413 +0200
+++ sblim-sfcb-1.3.16/cimXmlGen.c 2013-06-13 16:13:19.005289432 +0200
@@ -54,16 +54,24 @@ extern CMPIData opGetKeyCharsAt(CMPIObje
const char **name, CMPIStatus * rc);
extern CMPIData __ift_internal_getPropertyAt(const CMPIInstance * ci,
CMPICount i, char ** name,
- CMPIStatus * rc, int readonly);
+ CMPIStatus * rc, int readonly,
+ unsigned long* quals);
extern int invalid_uint(const char *v, const CMPIType type);
extern int getCustomHostname(char *httpHost, char **hn, unsigned int len);
const char *opGetClassNameChars(CMPIObjectPath * cop);
+/* We introduce additional parameter in data2xml, use this macro when you want
+ * pass it, use the original when you want data2xml behave as usual */
+#define EMBDATA2XML(data,obj,name,refname,btag,etag,sb,qsb,inst,param,embInst) \
+ data2xml((data),(obj),(name),(refname),(btag),sizeof(btag)-1,(etag), \
+ sizeof(etag)-1,(sb),(qsb),(inst),(param),(embInst))
+
+
#define DATA2XML(data,obj,name,refname,btag,etag,sb,qsb,inst,param) \
data2xml((data),(obj),(name),(refname),(btag),sizeof(btag)-1,(etag), \
- sizeof(etag)-1,(sb),(qsb),(inst),(param))
+ sizeof(etag)-1,(sb),(qsb),(inst),(param),0)
static int add_escaped_instance(UtilStringBuffer *sb, CMPIInstance *inst)
{
@@ -679,7 +687,7 @@ static void method2xml(CMPIType type, CM
void data2xml(CMPIData * data, void *obj, CMPIString * name, CMPIString * refName,
char *bTag, int bTagLen, char *eTag, int eTagLen,
- UtilStringBuffer * sb, UtilStringBuffer * qsb, int inst, int param)
+ UtilStringBuffer * sb, UtilStringBuffer * qsb, int inst, int param, int embInst)
{
_SFCB_ENTER(TRACE_CIMXMLPROC, "data2xml");
@@ -699,7 +707,11 @@ void data2xml(CMPIData * data, void *obj
}
else if(((data->type & ~CMPI_ARRAY) == CMPI_instance)
|| ((data->type & ~CMPI_ARRAY) == CMPI_class)) {
- SFCB_APPENDCHARS_BLOCK(sb, "string\" EmbeddedObject=\"object");
+ if (embInst == 1) {
+ SFCB_APPENDCHARS_BLOCK(sb, "\" EmbeddedObject=\"instance");
+ } else {
+ SFCB_APPENDCHARS_BLOCK(sb, "\" EmbeddedObject=\"object");
+ }
} else {
sb->ft->appendChars(sb, dataType(data->type));
}
@@ -751,7 +763,11 @@ void data2xml(CMPIData * data, void *obj
else if (*type == '%') {
sb->ft->appendBlock(sb, bTag, bTagLen);
sb->ft->appendChars(sb, (char *) name->hdl);
- SFCB_APPENDCHARS_BLOCK(sb, "\" EmbeddedObject=\"object");
+ if (embInst == 1) {
+ SFCB_APPENDCHARS_BLOCK(sb, "\" EmbeddedObject=\"instance");
+ } else {
+ SFCB_APPENDCHARS_BLOCK(sb, "\" EmbeddedObject=\"object");
+ }
if (param) SFCB_APPENDCHARS_BLOCK(sb, "\" PARAMTYPE=\"string\">\n");
else SFCB_APPENDCHARS_BLOCK(sb, "\" TYPE=\"string\">\n");
if(data->value.inst) {
@@ -791,10 +807,14 @@ static void quals2xml(unsigned long qual
if (quals & (ClProperty_Q_Key << 8))
SFCB_APPENDCHARS_BLOCK(sb, "<QUALIFIER NAME=\"Key\" TYPE=\"boolean\">\n"
"<VALUE>TRUE</VALUE>\n</QUALIFIER>\n");
- if (quals & (ClProperty_Q_EmbeddedObject << 8))
+ if ((quals & (ClProperty_Q_EmbeddedObject << 8)) && !(quals & (ClProperty_Q_EmbeddedInstance << 8)))
SFCB_APPENDCHARS_BLOCK(sb,
"<QUALIFIER NAME=\"EmbeddedObject\" TYPE=\"boolean\">\n"
"<VALUE>TRUE</VALUE>\n</QUALIFIER>\n");
+ if (quals & (ClProperty_Q_EmbeddedInstance << 8))
+ SFCB_APPENDCHARS_BLOCK(sb,
+ "<QUALIFIER NAME=\"EmbeddedInstance\" TYPE=\"boolean\">\n"
+ "<VALUE>TRUE</VALUE>\n</QUALIFIER>\n");
}
static void param2xml(CMPIParameter *pdata, CMPIConstClass * cls, ClParameter *parm, CMPIString *pname,
@@ -866,7 +886,7 @@ static void param2xml(CMPIParameter *pda
int cls2xml(CMPIConstClass * cls, UtilStringBuffer * sb, unsigned int flags)
{
ClClass *cl = (ClClass *) cls->hdl;
- int i, m, q, qm, p, pm;
+ int i, m, q, qm, p, pm, embInst = 0;
char *type, *superCls;
CMPIString *name, *qname, *refName;
CMPIData data, qdata;
@@ -903,18 +923,21 @@ int cls2xml(CMPIConstClass * cls, UtilSt
CMRelease(qname);
sfcb_native_release_CMPIValue(qdata.type,&qdata.value);
}
- if (data.type & CMPI_ARRAY) DATA2XML(&data,cls,name,NULL,"<PROPERTY.ARRAY NAME=\"",
- "</PROPERTY.ARRAY>\n", sb, qsb, 0,0);
+ if (quals & ClProperty_Q_EmbeddedInstance) embInst = 1;
+
+ if (data.type & CMPI_ARRAY) EMBDATA2XML(&data,cls,name,NULL,"<PROPERTY.ARRAY NAME=\"",
+ "</PROPERTY.ARRAY>\n", sb, qsb, 0,0, embInst);
else {
type = dataType(data.type);
if (*type == '*') {
- DATA2XML(&data,cls,name,refName,"<PROPERTY.REFERENCE NAME=\"",
- "</PROPERTY.REFERENCE>\n", sb, qsb, 0,0);
+ EMBDATA2XML(&data,cls,name,refName,"<PROPERTY.REFERENCE NAME=\"",
+ "</PROPERTY.REFERENCE>\n", sb, qsb, 0,0, embInst);
}
- else DATA2XML(&data,cls,name,NULL,"<PROPERTY NAME=\"", "</PROPERTY>\n",
- sb, qsb, 0,0);
+ else EMBDATA2XML(&data,cls,name,NULL,"<PROPERTY NAME=\"", "</PROPERTY>\n",
+ sb, qsb, 0,0, embInst);
}
CMRelease(name);
+ embInst = 0;
}
for (i = 0, m = ClClassGetMethodCount(cl); i < m; i++) {
@@ -957,9 +980,10 @@ int cls2xml(CMPIConstClass * cls, UtilSt
int instance2xml(CMPIInstance * ci, UtilStringBuffer * sb, unsigned int flags)
{
ClInstance *inst = (ClInstance *) ci->hdl;
- int i, m = ClInstanceGetPropertyCount(inst);
+ int i, m = ClInstanceGetPropertyCount(inst), embInst = 0;
char *type;
UtilStringBuffer *qsb = UtilFactory->newStrinBuffer(1024);
+ unsigned long quals;
_SFCB_ENTER(TRACE_CIMXMLPROC, "instance2xml");
@@ -976,23 +1000,28 @@ int instance2xml(CMPIInstance * ci, Util
if(ClInstanceIsPropertyAtFiltered(inst, i)) {
continue;
}
- data = __ift_internal_getPropertyAt(ci, i, (char**)&name.hdl, NULL, 1);
+ data = __ift_internal_getPropertyAt(ci, i, (char **) &name.hdl, NULL, 1, &quals);
+ if (quals & ClProperty_Q_EmbeddedInstance) {
+ embInst = 1;
+ }
+
if (data.type & CMPI_ARRAY) {
- DATA2XML(&data,ci,&name,NULL,"<PROPERTY.ARRAY NAME=\"", "</PROPERTY.ARRAY>\n",
- sb, qsb, 1,0);
+ EMBDATA2XML(&data,ci,&name,NULL,"<PROPERTY.ARRAY NAME=\"", "</PROPERTY.ARRAY>\n",
+ sb, qsb, 1,0, embInst);
}
else {
type = dataType(data.type);
- if (*type == '*') DATA2XML(&data,ci,&name,NULL,"<PROPERTY.REFERENCE NAME=\"",
- "</PROPERTY.REFERENCE>\n", sb, qsb, 1,0);
- else DATA2XML(&data,ci,&name,NULL,"<PROPERTY NAME=\"", "</PROPERTY>\n", sb, qsb, 1,0);
+ if (*type == '*') EMBDATA2XML(&data,ci,&name,NULL,"<PROPERTY.REFERENCE NAME=\"",
+ "</PROPERTY.REFERENCE>\n", sb, qsb, 1,0, embInst);
+ else EMBDATA2XML(&data,ci,&name,NULL,"<PROPERTY NAME=\"", "</PROPERTY>\n", sb, qsb, 1,0, embInst);
}
if (data.type & (CMPI_ENC|CMPI_ARRAY)) {// don't get confused using generic release
if ((data.state&~CMPI_keyValue)==0 && data.type != CMPI_instance)
data.value.inst->ft->release(data.value.inst);
}
+ embInst = 0;
}
SFCB_APPENDCHARS_BLOCK(sb, "</INSTANCE>\n");
diff -up sblim-sfcb-1.3.16/cimXmlGen.h.orig sblim-sfcb-1.3.16/cimXmlGen.h
--- sblim-sfcb-1.3.16/cimXmlGen.h.orig 2012-06-13 23:21:09.000000000 +0200
+++ sblim-sfcb-1.3.16/cimXmlGen.h 2013-06-13 16:13:19.006289437 +0200
@@ -52,7 +52,7 @@ extern int qualifierDeclaration2xml(CMPI
extern char *XMLEscape(char *in, int *outlen);
extern void data2xml(CMPIData * data, void *obj, CMPIString * name, CMPIString * refName,
char *bTag, int bTagLen, char *eTag, int eTagLen,
- UtilStringBuffer * sb, UtilStringBuffer * qsb, int inst, int param);
+ UtilStringBuffer * sb, UtilStringBuffer * qsb, int inst, int param, int embInst);
CMPIType guessType(char *val);
#endif
diff -up sblim-sfcb-1.3.16/constClass.c.orig sblim-sfcb-1.3.16/constClass.c
--- sblim-sfcb-1.3.16/constClass.c.orig 2010-10-14 21:42:06.000000000 +0200
+++ sblim-sfcb-1.3.16/constClass.c 2013-06-13 16:13:19.006289437 +0200
@@ -315,6 +315,24 @@ static CMPIData getPropQualifier(CMPICon
return rv_notFound;
}
}
+ if (strcasecmp(cpq, "embeddedinstance") == 0) {
+ unsigned long quals;
+ getPropertyQualsAt(cc,p-1,NULL,&quals,NULL,rc);
+ if (quals & ClProperty_Q_EmbeddedInstance) {
+ rv.type = CMPI_boolean;
+ rv.state = CMPI_goodValue;
+ rv.value.boolean = 1;
+ if (rc) {
+ CMSetStatus(rc, CMPI_RC_OK);
+ }
+ return rv;
+ } else {
+ if (rc) {
+ CMSetStatus(rc, CMPI_RC_ERR_NOT_FOUND);
+ }
+ return rv_notFound;
+ }
+ }
for (i=0; i<num;i++) {
diff -up sblim-sfcb-1.3.16/instance.c.orig sblim-sfcb-1.3.16/instance.c
--- sblim-sfcb-1.3.16/instance.c.orig 2012-10-31 02:40:09.000000000 +0100
+++ sblim-sfcb-1.3.16/instance.c 2013-06-13 16:13:19.007289442 +0200
@@ -205,11 +205,12 @@ static CMPIInstance *__ift_clone(const C
CMPIData __ift_internal_getPropertyAt(const CMPIInstance * ci, CMPICount i,
char ** name,
- CMPIStatus * rc, int readonly)
+ CMPIStatus * rc, int readonly,
+ unsigned long* quals)
{
ClInstance *inst = (ClInstance *) ci->hdl;
CMPIData rv = { 0, CMPI_notFound, {0} };
- if (ClInstanceGetPropertyAt(inst, i, &rv, name, NULL)) {
+ if (ClInstanceGetPropertyAt(inst, i, &rv, name, quals)) {
if (rc)
CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY);
return rv;
@@ -250,7 +251,7 @@ CMPIData __ift_getPropertyAt(const CMPII
return rv;
}
- rv = __ift_internal_getPropertyAt(ci, i, &sname, rc, 0);
+ rv = __ift_internal_getPropertyAt(ci, i, &sname, rc, 0, NULL);
if (name) {
*name = sfcb_native_new_CMPIString(sname, NULL, 0);
}
@@ -301,6 +302,22 @@ static CMPICount __ift_getPropertyCount(
return (CMPICount) ClInstanceGetPropertyCount(inst);
}
+static CMPIStatus __ift_addPropertyQualifier(const CMPIInstance * instance,
+ const char *name,
+ const char *qualifier )
+{
+ ClInstance *inst;
+ int rc;
+
+ if (!instance->hdl) {
+ CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
+ }
+
+ inst = (ClInstance *) instance->hdl;
+ rc = ClInstanceAddPropertyQualifierSpecial(inst, name, qualifier);
+ CMReturn(rc);
+}
+
static CMPIStatus __ift_setProperty(const CMPIInstance * instance,
const char *name,
@@ -465,7 +482,7 @@ static CMPIObjectPath *__ift_getObjectPa
while (j--) {
char *keyName;
- CMPIData d = __ift_internal_getPropertyAt(instance, j, &keyName, &tmp, 1);
+ CMPIData d = __ift_internal_getPropertyAt(instance, j, &keyName, &tmp, 1, NULL);
if (d.state & CMPI_keyValue) {
CMAddKey(cop, keyName, &d.value, d.type);
f++;
@@ -547,7 +564,7 @@ static CMPIStatus __ift_internal_setProp
iNew->property_list = __duplicate_list(propertyList);
iNew->key_list = __duplicate_list(keys);
for (j = 0, m = __ift_getPropertyCount(instance, &st); j < m; j++) {
- data = __ift_internal_getPropertyAt(instance, j, &name, &st, 1);
+ data = __ift_internal_getPropertyAt(instance, j, &name, &st, 1, NULL);
if(__contained_list((char**)propertyList, name) || __contained_list((char**)keys, name)) {
if ( (data.state & ~CMPI_keyValue) != 0) {
newInstance->ft->setProperty(
@@ -702,7 +719,7 @@ CMPIString *instance2String(CMPIInstance
add(&buf, &bp, &bm, "\n");
for (i = 0, m = __ift_getPropertyCount(inst, rc); i < m; i++) {
- data = __ift_internal_getPropertyAt(inst, i, &pname, rc, 1);
+ data = __ift_internal_getPropertyAt(inst, i, &pname, rc, 1, NULL);
add(&buf, &bp, &bm, " ");
add(&buf, &bp, &bm, pname);
add(&buf, &bp, &bm, " = ");
@@ -1064,6 +1081,7 @@ static int instFillDefaultProperties(str
pd = cc->ft->getPropertyAt(cc,pc,&pn,&ps);
/* if this prop is an EmbeddedObject, force type to CMPI_instance to allow CMSetProperty with a CMPI_Instance */
+ /* (also works for EmbeddedInstance, since the EmbeddedObject qual will also be set in that case */
CMPIData pqd = cc->ft->getPropQualifier(cc, CMGetCharsPtr(pn, NULL), "EmbeddedObject", NULL);
if ((pqd.state == CMPI_goodValue) && (pqd.value.boolean == 1)) {
pd.type = CMPI_instance;
@@ -1082,6 +1100,14 @@ static int instFillDefaultProperties(str
}
__ift_setProperty(&inst->instance,CMGetCharsPtr(pn,NULL),
vp,pd.type);
+
+ /* Copy EmbeddedInstance qualifier from the class to the instance,
+ so we know, what to put into CIM-XML */
+ CMPIData pqd = cc->ft->getPropQualifier(cc, CMGetCharsPtr(pn, NULL), "EmbeddedInstance", NULL);
+ if ((pqd.state == CMPI_goodValue) && (pqd.value.string != NULL)) {
+ __ift_addPropertyQualifier(&inst->instance, CMGetCharsPtr(pn,NULL), "EmbeddedInstance");
+ }
+
}
}
}
diff -up sblim-sfcb-1.3.16/objectImpl.c.orig sblim-sfcb-1.3.16/objectImpl.c
--- sblim-sfcb-1.3.16/objectImpl.c.orig 2013-06-13 16:13:18.997289393 +0200
+++ sblim-sfcb-1.3.16/objectImpl.c 2013-06-13 16:13:19.008289447 +0200
@@ -930,7 +930,11 @@ int ClClassAddPropertyQualifierSpecial(C
p->quals |= ClProperty_Q_Key;
else if (strcasecmp(id, "embeddedobject") == 0)
p->quals |= ClProperty_Q_EmbeddedObject;
- else
+ /* Make EmbeddedInstance bahave as EmbeddedObject, but be able to distinguish between them */
+ else if (strcasecmp(id, "embeddedinstance") == 0) {
+ p->quals |= ClProperty_Q_EmbeddedObject;
+ p->quals |= ClProperty_Q_EmbeddedInstance;
+ } else
return ClClassAddQualifierSpecial(hdr, &p->qualifiers, id, d, arrHdr);
return 0;
}
@@ -2145,6 +2149,31 @@ int ClInstanceGetPropertyAt(ClInstance *
_SFCB_RETURN(0);
}
+int ClInstanceAddPropertyQualifierSpecial(ClInstance *inst, const char *id,
+ const char *qualifier)
+{
+ int i;
+ ClProperty *p;
+
+ _SFCB_ENTER(TRACE_OBJECTIMPL, "ClInstanceAddPropertyQualifierSpecial");
+
+ i = ClObjectLocateProperty(&inst->hdr, &inst->properties, id);
+ if (i == 0)
+ /* cannot find the property */
+ _SFCB_RETURN(CMPI_RC_ERR_NO_SUCH_PROPERTY)
+
+ p = (ClProperty*) getSectionPtr(&inst->hdr, &inst->properties);
+ p = p + i - 1;
+
+ if (strcasecmp(qualifier, "embeddedinstance") == 0) {
+ p->quals |= ClProperty_Q_EmbeddedObject;
+ p->quals |= ClProperty_Q_EmbeddedInstance;
+ } else if (strcasecmp(qualifier, "embeddedobject") == 0)
+ p->quals |= ClProperty_Q_EmbeddedObject;
+
+ _SFCB_RETURN(0)
+}
+
int ClInstanceAddProperty(ClInstance * inst, const char *id, CMPIData d)
{
ClSection *prps = &inst->properties;
diff -up sblim-sfcb-1.3.16/objectImpl.h.orig sblim-sfcb-1.3.16/objectImpl.h
--- sblim-sfcb-1.3.16/objectImpl.h.orig 2009-12-22 01:18:29.000000000 +0100
+++ sblim-sfcb-1.3.16/objectImpl.h 2013-06-13 16:13:19.008289447 +0200
@@ -274,6 +274,7 @@ typedef struct {
#ifndef SETCLPFX
#define ClProperty_Q_Key 1
#define ClProperty_Q_EmbeddedObject 8
+ #define ClProperty_Q_EmbeddedInstance 16
#endif
unsigned char originId;
PFX(CLPFX,ClSection) qualifiers;
@@ -469,6 +470,7 @@ extern void ClInstanceFree(ClInstance *i
extern char *ClInstanceToString(ClInstance *inst);
extern int ClInstanceGetPropertyCount(ClInstance *inst);
extern int ClInstanceGetPropertyAt(ClInstance *inst, int id, CMPIData *data, char **name, unsigned long *quals);
+extern int ClInstanceAddPropertyQualifierSpecial(ClInstance *inst, const char *id, const char *qualifier);
extern int ClInstanceAddProperty(ClInstance *inst, const char *id, CMPIData d);
extern void ClInstanceFilterFlagProperty(ClInstance * inst, int id);
extern int ClInstanceIsPropertyAtFiltered(ClInstance * inst, int id);
diff -up sblim-sfcb-1.3.16/objectImplSwapI32toP32.c.orig sblim-sfcb-1.3.16/objectImplSwapI32toP32.c
--- sblim-sfcb-1.3.16/objectImplSwapI32toP32.c.orig 2008-11-07 18:00:44.000000000 +0100
+++ sblim-sfcb-1.3.16/objectImplSwapI32toP32.c 2013-06-13 16:13:19.009289452 +0200
@@ -81,6 +81,7 @@ typedef struct {
#define ClProperty_Q_Key 1
#define ClProperty_Q_Propagated 2
#define ClProperty_Q_EmbeddedObject 8
+ #define ClProperty_Q_EmbeddedInstance 16
#endif
unsigned char originId;
CLP32_ClSection qualifiers;
diff -up sblim-sfcb-1.3.16/sfcbdumpP32onI32.c.orig sblim-sfcb-1.3.16/sfcbdumpP32onI32.c
--- sblim-sfcb-1.3.16/sfcbdumpP32onI32.c.orig 2008-12-18 22:34:33.000000000 +0100
+++ sblim-sfcb-1.3.16/sfcbdumpP32onI32.c 2013-06-13 16:13:19.009289452 +0200
@@ -72,6 +72,7 @@ typedef struct {
#define ClProperty_Q_Key 1
#define ClProperty_Q_Propagated 2
#define ClProperty_Q_EmbeddedObject 8
+ #define ClProperty_Q_EmbeddedInstance 16
#endif
unsigned char originId;
CLP32_ClSection qualifiers;

View File

@ -1,49 +0,0 @@
diff -up sblim-sfcb-1.3.16/cimXmlGen.c.escape sblim-sfcb-1.3.16/cimXmlGen.c
--- sblim-sfcb-1.3.16/cimXmlGen.c.escape 2013-04-29 14:29:14.084335007 +0200
+++ sblim-sfcb-1.3.16/cimXmlGen.c 2013-04-29 14:28:44.000000000 +0200
@@ -70,6 +70,23 @@ const char *opGetClassNameChars(CMPIObje
data2xml((data),(obj),(name),(refname),(btag),sizeof(btag)-1,(etag), \
sizeof(etag)-1,(sb),(qsb),(inst),(param))
+static int add_escaped_instance(UtilStringBuffer *sb, CMPIInstance *inst)
+{
+ UtilStringBuffer *instance;
+
+ _SFCB_ENTER(TRACE_CIMXMLPROC, "add_escaped_instance");
+
+ instance = UtilFactory->newStrinBuffer(1024);
+ if (!instance)
+ _SFCB_RETURN(1);
+
+ instance2xml(inst, instance, 0);
+ char *escaped = XMLEscape((char *) instance->ft->getCharPtr(instance), NULL);
+ sb->ft->appendChars(sb, escaped);
+ free(escaped);
+ instance->ft->release(instance);
+ _SFCB_RETURN(0);
+}
char *XMLEscape(char *in, int *outlen)
{
@@ -542,9 +559,7 @@ int value2xml(CMPIData d, UtilStringBuff
}
}
else if(d.type == CMPI_instance) {
- SFCB_APPENDCHARS_BLOCK(sb, "<![CDATA[");
- instance2xml(d.value.inst, sb, 0);
- SFCB_APPENDCHARS_BLOCK(sb, "]]>");
+ add_escaped_instance(sb, d.value.inst);
splen = 0;
}
else {
@@ -754,9 +769,7 @@ void data2xml(CMPIData * data, void *obj
else SFCB_APPENDCHARS_BLOCK(sb, "\" TYPE=\"string\">\n");
if(data->value.inst) {
SFCB_APPENDCHARS_BLOCK(sb, "<VALUE>");
- SFCB_APPENDCHARS_BLOCK(sb, "<![CDATA[");
- instance2xml(data->value.inst, sb, 0);
- SFCB_APPENDCHARS_BLOCK(sb, "]]>");
+ add_escaped_instance(sb, data->value.inst);
SFCB_APPENDCHARS_BLOCK(sb, "</VALUE>\n");
}
}

View File

@ -1,14 +0,0 @@
diff -up sblim-sfcb-1.3.16/httpAdapter.c.bak sblim-sfcb-1.3.16/httpAdapter.c
--- sblim-sfcb-1.3.16/httpAdapter.c.bak 2012-10-06 03:19:15.000000000 +0200
+++ sblim-sfcb-1.3.16/httpAdapter.c 2013-05-29 19:57:16.906813502 +0200
@@ -728,8 +728,8 @@ static int getHdrs(CommHndl conn_fd, Buf
total+=r;
/* on first run through, ensure that this is a POST req. */
- if (r && first) {
- if (strncasecmp(buf,cmd,strlen(cmd)) != 0) {
+ if (first && total >= strlen(cmd)) {
+ if (strncasecmp(b->data,cmd,strlen(cmd)) != 0) {
/* not what we expected - still continue to read to
not confuse the client */
state = 1;

View File

@ -1,76 +0,0 @@
Function copyStringBuf() uses sizeof(*fb->indexPtr) as size of elements
in fb->indexPtr, while addClStringN() usess 'sizeof(long)' for the same
elements. Both functions copy indexPtr, but each with different size.
Therefore, if addClStringN() is called after copyStringBuf(), it may copy more
bytes than copyStringBuf() created -> SIGSEGV (or 'Invalid read of size XYZ'
in Valgrind logs).
'sizeof(*buf->indexPtr)' should be consistently used in ClStrBuf.indexPtr
and ClArrayBuf.indexPtr.
diff -up sblim-sfcb-1.3.16/objectImpl.c.invalid-read sblim-sfcb-1.3.16/objectImpl.c
--- sblim-sfcb-1.3.16/objectImpl.c.invalid-read 2013-04-19 14:03:04.920602183 +0200
+++ sblim-sfcb-1.3.16/objectImpl.c 2013-04-19 14:04:10.229391267 +0200
@@ -208,7 +208,7 @@ addClStringN(ClObjectHdr * hdr, const ch
buf->bMax = nmax;
buf->bUsed = buf->iUsed = 0;
buf->iMax = 16;
- setStrIndexPtr(buf, malloc(sizeof(long) * 16));
+ setStrIndexPtr(buf, malloc(sizeof(*buf->indexPtr) * 16));
hdr->flags |= HDR_Rebuild;
}
@@ -222,17 +222,17 @@ addClStringN(ClObjectHdr * hdr, const ch
if (!isMallocedStrIndex(buf)) {
void *idx = buf->indexPtr;
buf->iMax = nmax * 2;
- setStrIndexPtr(buf, malloc(buf->iMax * sizeof(long)));
- memcpy(buf->indexPtr, idx, nmax * sizeof(long));
+ setStrIndexPtr(buf, malloc(buf->iMax * sizeof(*buf->indexPtr)));
+ memcpy(buf->indexPtr, idx, nmax * sizeof(*buf->indexPtr));
}
else {
buf->iMax = nmax * 2;
- setStrIndexPtr(buf, realloc(buf->indexPtr, buf->iMax * sizeof(long)));
+ setStrIndexPtr(buf, realloc(buf->indexPtr, buf->iMax * sizeof(*buf->indexPtr)));
}
}
else {
buf->iMax = 16;
- setStrIndexPtr(buf, malloc(buf->iMax * sizeof(long)));
+ setStrIndexPtr(buf, malloc(buf->iMax * sizeof(*buf->indexPtr)));
}
hdr->flags |= HDR_Rebuild;
}
@@ -289,7 +289,7 @@ static long addClArray(ClObjectHdr * hdr
buf->bMax = nmax;
buf->bUsed = buf->iUsed = 0;
buf->iMax = 16;
- setArrayIndexPtr(buf, malloc(sizeof(long) * 16));
+ setArrayIndexPtr(buf, malloc(sizeof(*buf->indexPtr) * 16));
hdr->flags |= HDR_Rebuild;
}
@@ -303,17 +303,17 @@ static long addClArray(ClObjectHdr * hdr
if (!isMallocedArrayIndex(buf)) {
void *idx = buf->indexPtr;
buf->iMax = nmax * 2;
- setArrayIndexPtr(buf, malloc(buf->iMax * sizeof(long)));
- memcpy(buf->indexPtr, idx, nmax * sizeof(long));
+ setArrayIndexPtr(buf, malloc(buf->iMax * sizeof(*buf->indexPtr)));
+ memcpy(buf->indexPtr, idx, nmax * sizeof(*buf->indexPtr));
}
else {
buf->iMax = nmax * 2;
- setArrayIndexPtr(buf, realloc(buf->indexPtr, buf->iMax * sizeof(long)));
+ setArrayIndexPtr(buf, realloc(buf->indexPtr, buf->iMax * sizeof(*buf->indexPtr)));
}
}
else {
buf->iMax = 16;
- setArrayIndexPtr(buf, malloc(buf->iMax * sizeof(long)));
+ setArrayIndexPtr(buf, malloc(buf->iMax * sizeof(*buf->indexPtr)));
}
hdr->flags |= HDR_Rebuild;
}

View File

@ -1,26 +0,0 @@
The memcpy below tried to copy too much data (it's capacity of the section * 2,
max is doubled few lines above). Let's copy only the used data.
Unrelated observation:
I wonder what ensureClSpace() function does at all. How can this check
be ever true:
else if (sct->used >= max) {
'max' is basically sct->max, does that mean the sct->used contains already new
size of the section?
diff -up sblim-sfcb-1.3.16/objectImpl.c.invalid-read2 sblim-sfcb-1.3.16/objectImpl.c
--- sblim-sfcb-1.3.16/objectImpl.c.invalid-read2 2013-04-19 14:42:52.000000000 +0200
+++ sblim-sfcb-1.3.16/objectImpl.c 2013-04-19 14:43:23.039536156 +0200
@@ -168,7 +168,7 @@ static void *ensureClSpace(ClObjectHdr *
void *f,*t;
f=((char*)hdr)+sct->sectionOffset;
t=malloc(max*size);
- memcpy(t,f,max*size);
+ memcpy(t,f,sct->used*size);
sct->max=max;
setSectionPtr(sct, t);
}

View File

@ -1,19 +0,0 @@
diff -up sblim-sfcb-1.3.7/cimcClientSfcbLocal.c.orig sblim-sfcb-1.3.7/cimcClientSfcbLocal.c
--- sblim-sfcb-1.3.7/cimcClientSfcbLocal.c.orig 2010-05-11 09:08:17.709465965 +0200
+++ sblim-sfcb-1.3.7/cimcClientSfcbLocal.c 2010-05-11 09:11:10.133456342 +0200
@@ -209,7 +209,6 @@ static CMPIStatus releaseClient(Client *
if (cl->connection) CMRelease(cl->connection);
free(cl);
- closeLogging();
return rc;
}
@@ -1618,6 +1617,7 @@ int localConnect(ClientEnv* ce, CMPIStat
static void* release(ClientEnv* ce)
{
void *lib=ce->hdl;
+ closeLogging();
CONNECT_LOCK();
if (localConnectCount > 0) localConnectCount -= 1;
if (localConnectCount == 0) {

Binary file not shown.

View File

@ -0,0 +1,27 @@
diff -up sblim-sfcb-1.4.5/Makefile.in.orig sblim-sfcb-1.4.5/Makefile.in
--- sblim-sfcb-1.4.5/Makefile.in.orig 2013-09-03 17:00:52.835375562 +0200
+++ sblim-sfcb-1.4.5/Makefile.in 2013-09-03 17:13:40.127512520 +0200
@@ -626,7 +626,6 @@ initdir = $(sysconfdir)/init.d
pamdir = $(sysconfdir)/pam.d
sfcblibdir = $(libdir)/sfcb
cmpilibdir = $(libdir)/cmpi
-systemddir = $(prefix)/share/systemd
MANFILES = man/genSslCert.1 man/getSchema.1 man/sfcbd.1 man/sfcbmof.1 \
man/sfcbrepos.1 man/sfcbstage.1 man/sfcbunstage.1 man/sfcbuuid.1 \
man/wbemcat.1 man/xmltest.1
@@ -2365,7 +2364,6 @@ unittest:
cd test && sh check_all.sh
install-data-local:
- if test -d $(systemddir); then cp $(srcdir)/sblim-sfcb.service $(systemddir); fi;
test -d $(DESTDIR)$(sfcbstatedir)/registration/repository || $(mkdir_p) $(DESTDIR)$(sfcbstatedir)/registration/repository
test -d $(DESTDIR)$(sfcbstatedir)/stage/mofs/root/interop || $(mkdir_p) $(DESTDIR)$(sfcbstatedir)/stage/mofs/root/interop
test -d $(DESTDIR)$(sfcbstatedir)/stage/regs || $(mkdir_p) $(DESTDIR)$(sfcbstatedir)/stage/regs
@@ -2383,7 +2381,6 @@ install-data-local:
uninstall-local:
rm -f $(DESTDIR)$(sfcbstatedir)/stage/default.reg
rm -f $(DESTDIR)$(sfcbstatedir)/stage/mofs/root/interop/10_interop.mof
- rm -f $(systemddir)/sblim-sfcb.service
@INDICATIONS_TRUE@ rm -f $(DESTDIR)$(sfcbstatedir)/stage/mofs/root/interop/20_indication.mof
@INDICATIONS_TRUE@ rm -f $(DESTDIR)$(sfcbstatedir)/stage/mofs/indication.mof
@DOCS_TRUE@ rm -rf $(DESTDIR)$(sfcbdocdir)/html

View File

@ -7,8 +7,8 @@
Name: sblim-sfcb
Summary: Small Footprint CIM Broker
URL: http://sblim.wiki.sourceforge.net/
Version: 1.3.16
Release: 9%{?dist}
Version: 1.4.5
Release: 1%{?dist}
Group: Applications/System
License: EPL
Source0: http://downloads.sourceforge.net/sblim/%{name}-%{version}.tar.bz2
@ -17,31 +17,18 @@ Source1: sfcb.service
Source2: sfcbdump.1.gz
Source3: sfcbinst2mof.1.gz
Source4: sfcbtrace.1.gz
# Patch0: moves log close to correct place
Patch0: sblim-sfcb-1.3.7-close_logging.patch
# Patch1: changes schema location to the path we use
Patch1: sblim-sfcb-1.3.9-sfcbrepos-schema-location.patch
# Patch2: fixes CMGetCharPtr macro
Patch2: sblim-sfcb-1.3.10-CMGetCharPtr.patch
# Patch3: adds missing includes
Patch3: sblim-sfcb-1.3.14-missing-includes.patch
# Patch4: Fix provider debugging - variable for stopping wait-for-debugger
# Patch0: changes schema location to the path we use
Patch0: sblim-sfcb-1.3.9-sfcbrepos-schema-location.patch
# Patch1: Fix provider debugging - variable for stopping wait-for-debugger
# loop must be volatile
Patch4: sblim-sfcb-1.3.15-fix-provider-debugging.patch
# Patch5-7: already upstream, http://sourceforge.net/p/sblim/sfcb-tix/37/
Patch5: sblim-sfcb-1.3.16-invalid-read.patch
Patch6: sblim-sfcb-1.3.16-invalid-read2.patch
Patch7: sblim-sfcb-1.3.16-embedded-crash.patch
# Patch8: already upstream, http://sourceforge.net/p/sblim/sfcb-tix/44/
Patch8: sblim-sfcb-1.3.16-escape.patch
# Patch9: already upstream, http://sourceforge.net/p/sblim/sfcb-tix/49/
Patch9: sblim-sfcb-1.3.16-embedded-instance.patch
# Patch10: increase default value of maxMsgLen in sfcb.cfg
Patch10: sblim-sfcb-1.3.16-maxMsgLen.patch
# Patch11: fix CIM clients are sometimes getting HTTP/1.1 501 Not Implemented
Patch11: sblim-sfcb-1.3.16-http-header-cmd-check.patch
Patch1: sblim-sfcb-1.3.15-fix-provider-debugging.patch
# Patch2: increase default value of maxMsgLen in sfcb.cfg
Patch2: sblim-sfcb-1.3.16-maxMsgLen.patch
# Patch3: we'll install own service file
Patch3: sblim-sfcb-1.4.5-service.patch
Provides: cim-server
Requires: cim-schema
Requires: sblim-sfcCommon
BuildRequires: libcurl-devel
BuildRequires: zlib-devel
BuildRequires: openssl-devel
@ -50,6 +37,7 @@ BuildRequires: cim-schema
BuildRequires: bison flex
BuildRequires: sblim-cmpi-devel
BuildRequires: systemd
BuildRequires: sblim-sfcCommon-devel
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
@ -64,18 +52,10 @@ Programming Interface (CMPI).
%prep
%setup -q -T -b 0 -n %{name}-%{version}
%patch0 -p1 -b .close_logging
%patch1 -p1 -b .sfcbrepos-schema-location
%patch2 -p1 -b .CMGetCharPtr
%patch3 -p1 -b .missing-includes
%patch4 -p1 -b .fix-provider-debugging
%patch5 -p1 -b .invalid-read
%patch6 -p1 -b .invalid-read2
%patch7 -p1 -b .embedded-crash
%patch8 -p1 -b .escape
%patch9 -p1 -b .embedded-instance
%patch10 -p1 -b .maxMsgLen
%patch11 -p1 -b .http-header-cmd-check
%patch0 -p1 -b .sfcbrepos-schema-location
%patch1 -p1 -b .fix-provider-debugging
%patch2 -p1 -b .maxMsgLen
%patch3 -p1 -b .service
%build
%configure --enable-debug --enable-uds --enable-ssl --enable-pam --enable-ipv6 CFLAGS="$CFLAGS -D_GNU_SOURCE -fPIE -DPIE" LDFLAGS="$LDFLAGS -Wl,-z,now -pie"
@ -88,8 +68,8 @@ rm $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/sfcb
mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
install -p -m644 %{SOURCE1} $RPM_BUILD_ROOT/%{_unitdir}/sblim-sfcb.service
# install man pages
mkdir -p %{buildroot}/%{_mandir}/man1/
cp %{SOURCE2} %{SOURCE3} %{SOURCE4} %{buildroot}/%{_mandir}/man1/
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/
cp %{SOURCE2} %{SOURCE3} %{SOURCE4} $RPM_BUILD_ROOT/%{_mandir}/man1/
# remove unused static libraries and so files
rm -f $RPM_BUILD_ROOT/%{_libdir}/sfcb/*.la
@ -118,14 +98,14 @@ cat _pkg_list
%{_datadir}/sfcb/genSslCert.sh %{_sysconfdir}/sfcb &>/dev/null || :
/sbin/ldconfig
%{_bindir}/sfcbrepos -f
%systemd_post sfcb.service
%systemd_post sblim-sfcb.service
%preun
%systemd_preun sfcb.service
%systemd_preun sblim-sfcb.service
%postun
/sbin/ldconfig
%systemd_postun_with_restart sfcb.service
%systemd_postun_with_restart sblim-sfcb.service
if [ $1 -eq 0 ]; then
/usr/sbin/groupdel sfcb > /dev/null 2>&1 || :;
fi;
@ -133,6 +113,9 @@ fi;
%files -f _pkg_list
%changelog
* Thu Sep 05 2013 Vitezslav Crhonek <vcrhonek@redhat.com> - 1.4.5-1
- Update to sblim-sfcb-1.4.5
* Tue Aug 13 2013 Vitezslav Crhonek <vcrhonek@redhat.com> - 1.3.16-9
- Build require systemd for unitdir macro
Resolves: #988777

View File

@ -1,2 +1,2 @@
494b9bdd96c1d8d90dafc26cd5534082 sfcb.service
af2475276af9090f25ef61b01791a1a9 sblim-sfcb-1.3.16.tar.bz2
64bf48b51f5bbf220b65a88a02fdc02b sblim-sfcb-1.4.5.tar.bz2