File 20000-2993137-bnc645804-CMSetProperty-fails-for-CMPIInstance-for-EmbeddedObject.patch of Package sblim-sfcb-sle11-sp1
From 20e1217917b8c9b80957ba148671be1868010cb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Wed, 13 Oct 2010 12:53:31 +0200
Subject: [PATCH] [PATCH] [ 2993137 ] CMSetProperty fails for CMPIInstance for EmbeddedObject
---
constClass.c | 12 ++++++++++++
instance.c | 7 +++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/constClass.c b/constClass.c
index effcb07..7c3d6f3 100644
--- a/constClass.c
+++ b/constClass.c
@@ -291,6 +291,18 @@ static CMPIData getPropQualifier(CMPIConstClass * cc, const char* cp, const char
return rv_notFound;
}
}
+ if (strcasecmp(cpq, "embeddedobject") == 0) {
+ unsigned long quals;
+ getPropertyQualsAt(cc,p-1,NULL,&quals,NULL,rc);
+ if (quals & ClProperty_Q_EmbeddedObject) {
+ rv.type = CMPI_boolean;
+ rv.state = CMPI_goodValue;
+ rv.value.boolean = 1;
+ return rv;
+ } else {
+ return rv_notFound;
+ }
+ }
for (i=0; i<num;i++) {
if (ClClassGetPropQualifierAt(cls, p-1, i, &rv, &n) == 0 && strcasecmp(cpq,n) == 0) {
diff --git a/instance.c b/instance.c
index 8179831..751f9e2 100644
--- a/instance.c
+++ b/instance.c
@@ -912,6 +912,13 @@ static void instFillDefaultProperties(struct native_instance *inst,
while (pc > 0) {
pc -= 1;
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 */
+ CMPIData pqd = cc->ft->getPropQualifier(cc, CMGetCharsPtr(pn, NULL), "EmbeddedObject", NULL);
+ if ((pqd.state == CMPI_goodValue) && (pqd.value.boolean = 1)) {
+ pd.type = CMPI_instance;
+ }
+
if (ps.rc == CMPI_RC_OK && pn ) {
vp = &pd.value;
if (pd.state & CMPI_nullValue) {
--
1.7.1