# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1204540080 -3600
# Node ID d6992120c4edd5643f53edfe2255d5a1a657ba80
# Parent 7957f5828b31c7d557f828e0d9b63eaaebd6db0f
HD: validate client given object path
wbemain -ac KVM_HostedDependency
'http://localhost/root/virt:KVM_HostSystem.CreationClassName="KVM_HostSystem",Name="wrong"'
returns instances instead of NOT_FOUND
wbemain -ac CIM_HostedDependency
'http://localhost/root/virt:KVM_ComputerSystem.CreationClassName="KVM_ComputerSystem",Name="wrong"'
returns an instance instead of NOT_FOUND
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r 7957f5828b31 -r d6992120c4ed src/Virt_HostedDependency.c
--- a/src/Virt_HostedDependency.c Mon Mar 03 10:02:15 2008 +0100
+++ b/src/Virt_HostedDependency.c Mon Mar 03 11:28:00 2008 +0100
@@ -41,15 +41,22 @@ static CMPIStatus vs_to_host(const CMPIO
struct inst_list *list)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
- CMPIInstance *instance;
+ CMPIInstance *instance = NULL;
if (!match_hypervisor_prefix(ref, info))
- return s;
+ goto out;
- s = get_host_cs(_BROKER, ref, &instance);
+ s = get_domain(_BROKER, ref, &instance);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ s = get_host(_BROKER, ref, &instance, false);
if (s.rc == CMPI_RC_OK)
- inst_list_add(list, instance);
+ goto out;
+ inst_list_add(list, instance);
+
+ out:
return s;
}
@@ -60,29 +67,30 @@ static CMPIStatus host_to_vs(const CMPIO
int ret;
virConnectPtr conn;
CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *instance = NULL;
if (!match_hypervisor_prefix(ref, info))
- return s;
+ goto out;
+
+ s = get_host(_BROKER, ref, &instance, true);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
- if (conn == NULL)
- return s;
+ if (conn == NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "No such instance");
+ goto out;
+ }
ret = enum_domains(_BROKER, conn, NAMESPACE(ref), list);
- if (ret) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_OK,
- "");
- } else {
+ if (!ret)
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Failed to get domain list");
- }
- cu_statusf(_BROKER, &s,
- CMPI_RC_OK,
- "");
-
+ out:
return s;
}