[PATCH] HRP accepts invalid references
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1198880883 28800
# Node ID e84ead6a0242ecb1cf63e871da8603d38233ff41
# Parent 3ea63b2076c1d02b7c3c48910809b9fb11ee290f
HRP accepts invalid references.
Add a get_host_cs() call to pool_to_sys() handler. The get_host_cs() 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 gi 'http://localhost/root/virt:Xen_MemoryPool.InstanceID="wrong"'
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 3ea63b2076c1 -r e84ead6a0242 src/Virt_HostedResourcePool.c
--- a/src/Virt_HostedResourcePool.c Fri Dec 21 10:58:37 2007 -0800
+++ b/src/Virt_HostedResourcePool.c Fri Dec 28 14:28:03 2007 -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);
16 years, 11 months