[PATCH] Make HostedResourcePool a little more discerning

# HG changeset patch # User Dan Smith <danms@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@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)

Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@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
Patch looks good, but wouldn't you also want to do this check for the sys_to_pool side of things as well? Or, basically, for any of the API calls that take a properties argument? -- Kaitlin Rupert IBM Linux Technology Center karupert@us.ibm.com

KR> Patch looks good, but wouldn't you also want to do this check for KR> the sys_to_pool side of things as well? I'm not sure what you mean, this change *was* to sys_to_pool() :) KR> Or, basically, for any of the API calls that take a properties KR> argument? That brings up a good point, being that we might fail the test improperly if they specified (and we start honoring) the properties filter, so maybe we need to allow for passing a list of properties that are *excluded* from the list of properties checked. Since this is only comparing key properties, is it valid to use the property filter to exclude key properties? I could see the policy being either way really. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
participants (2)
-
Dan Smith
-
Kaitlin Rupert