# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1210899399 25200
# Node ID 0455d746cfe9a3da08144d8e9c309de2e4ee6a3b
# Parent b9ddfef54aa7b51515efea27b95faf00edc5ace7
Verify migration type is supported VSMigrationService.
The check call doesn't verify that type supplied is one of the values we support.
Also, allow for NULL in get_migration_type().
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r b9ddfef54aa7 -r 0455d746cfe9 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Mon May 12 16:11:58 2008 -0700
+++ b/src/Virt_VSMigrationService.c Thu May 15 17:56:39 2008 -0700
@@ -109,14 +109,24 @@
uint16_t *type)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
- int ret;
+ uint16_t _type;
- ret = cu_get_u16_prop(msd, "MigrationType", type);
- if (ret != CMPI_RC_OK) {
+ if (cu_get_u16_prop(msd, "MigrationType", &_type) != CMPI_RC_OK) {
CU_DEBUG("Using default MigrationType: %d", CIM_MIGRATE_LIVE);
- *type = CIM_MIGRATE_LIVE;
+ _type = CIM_MIGRATE_LIVE;
}
+ if ((_type < CIM_MIGRATE_OTHER) || (_type > CIM_MIGRATE_RESTART)) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unsupported migration type %d", _type);
+ goto out;
+ }
+
+ if (type != NULL)
+ *type = _type;
+
+ out:
return s;
}
@@ -543,7 +553,6 @@
virConnectPtr dconn = NULL;
uint32_t retcode = CIM_SVPC_RETURN_COMPLETED;
CMPIBoolean isMigratable = 0;
- uint16_t type;
virDomainPtr dom = NULL;
CMPIInstance *dominst;
const char *domain;
@@ -556,7 +565,7 @@
goto out;
}
- s = get_msd_values(ref, destination, argsin, &type, &dconn);
+ s = get_msd_values(ref, destination, argsin, NULL, &dconn);
if (s.rc != CMPI_RC_OK)
goto out;