[Libvirt-cim] [PATCH] Make HostedResourcePool a little more discerning

Dan Smith danms at us.ibm.com
Thu Nov 8 18:04:52 UTC 2007


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1194548690 28800
# Node ID 4c736ba430524c00804b710b923ea0030808a893
# Parent  bd1b1067d106ecc1546c3b2436a43f59f8eaba15
Make HostedResourcePool a little more discerning
Use cu_compare_ref() to make sure the client specified the actual
HostSystem instance and not a random CIM_System

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r bd1b1067d106 -r 4c736ba43052 src/Virt_HostedResourcePool.c
--- a/src/Virt_HostedResourcePool.c	Thu Nov 08 10:43:48 2007 -0800
+++ b/src/Virt_HostedResourcePool.c	Thu Nov 08 11:04:50 2007 -0800
@@ -60,6 +60,21 @@ static CMPIStatus sys_to_pool(const CMPI
         CMPIStatus s;
         int i;
         virConnectPtr conn;
+        CMPIInstance *host;
+        const char *prop;
+
+        s = get_host_cs(_BROKER, ref, &host);
+        if (s.rc != CMPI_RC_OK)
+                return s;
+
+        prop = cu_compare_ref(ref, host);
+        if (prop != NULL) {
+                cu_statusf(_BROKER, &s,
+                           CMPI_RC_ERR_NOT_FOUND,
+                           "No such HostSystem instance (%s)",
+                           prop);
+                return s;
+        }
 
         conn = lv_connect(_BROKER, &s);
         if (conn == NULL)




More information about the Libvirt-cim mailing list