[Libvirt-cim] [PATCH] .#2 HRP accepts invalid references

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Jan 2 17:18:31 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1199294302 28800
# Node ID b58d2ec7a275dce6fab21e1ae7f414b6159ce141
# Parent  3ea63b2076c1d02b7c3c48910809b9fb11ee290f
.#2 HRP accepts invalid references.

Updates: Fixed errors in commit message.  Previous message didn't make any sense.

Add a get_pool_inst() call to pool_to_sys() handler.  The get_pool_inst() call will verify whether the reference passed in is valid.

This patch is dependant on the "#2 EAFP and RAFP support invalid references" patchset.

Failing query:
wbemcli ain -ac Xen_HostedResourcePool http://localhost/root/virt:Xen_MemoryPool.InstanceID="wrong"

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 3ea63b2076c1 -r b58d2ec7a275 src/Virt_HostedResourcePool.c
--- a/src/Virt_HostedResourcePool.c	Fri Dec 21 10:58:37 2007 -0800
+++ b/src/Virt_HostedResourcePool.c	Wed Jan 02 09:18:22 2008 -0800
@@ -43,8 +43,13 @@ static CMPIStatus pool_to_sys(const CMPI
 {
         CMPIInstance *host;
         CMPIStatus s = {CMPI_RC_OK, NULL};
+        CMPIInstance *inst;
 
         if (!match_hypervisor_prefix(ref, info))
+                return s;
+
+        s = get_pool_inst(_BROKER, ref, &inst);
+        if ((s.rc != CMPI_RC_OK) || (inst == NULL))
                 return s;
 
         s = get_host_cs(_BROKER, ref, &host);




More information about the Libvirt-cim mailing list