[Libvirt-cim] [PATCH 2 of 2] SD: does not check client given object path

Heidi Eckhart heidieck at linux.vnet.ibm.com
Tue Feb 5 11:38:13 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1202215071 -3600
# Node ID 360734df2cd2eabbc2a2a9095a95d022f6c4130f
# Parent  9163192a3407b4b0f02ab15d291830f52b5261fa
SD: does not check client given object path

wbemrin -arc CIM_SystemDevice 'http://localhost/root/virt:KVM_ComputerSystem.CreationClassName="KVM_ComputerSystem",Name="wrong"'
returns nothing instead of NOT_FOUND.

The object path for devices is also not checked.

Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r 9163192a3407 -r 360734df2cd2 src/Virt_SystemDevice.c
--- a/src/Virt_SystemDevice.c	Tue Feb 05 13:33:41 2008 +0100
+++ b/src/Virt_SystemDevice.c	Tue Feb 05 13:37:51 2008 +0100
@@ -134,10 +134,15 @@ static CMPIStatus sys_to_dev(const CMPIO
 {
         const char *host = NULL;
         CMPIStatus s = {CMPI_RC_OK, NULL};
+        CMPIInstance *inst = NULL;
         int ret;
 
         if (!match_hypervisor_prefix(ref, info))
                 return s;
+
+        s = get_domain(_BROKER, ref, &inst);
+        if (s.rc != CMPI_RC_OK)
+                goto out;
 
         if (cu_get_str_path(ref, "Name", &host) != CMPI_RC_OK) {
                 cu_statusf(_BROKER, &s,
@@ -171,10 +176,15 @@ static CMPIStatus dev_to_sys(const CMPIO
         char *host = NULL;
         char *dev = NULL;
         CMPIInstance *sys;
+        CMPIInstance *inst = NULL;
         CMPIStatus s = {CMPI_RC_OK, NULL};
 
         if (!match_hypervisor_prefix(ref, info))
                 return s;
+
+        s = get_device(_BROKER, ref, &inst);
+        if (s.rc != CMPI_RC_OK)
+                goto out;
 
         if (cu_get_str_path(ref, "DeviceID", &devid) != CMPI_RC_OK) {
                 cu_statusf(_BROKER, &s,




More information about the Libvirt-cim mailing list