提交 03a60036 编写于 作者: D Daniel P. Berrange

Don't allow renaming of domains by the backdoor

Several APIs allow for custom XML to be passed in. This is
checked for ABI stability, which will ensure the UUID is
not being changed. There isn't validation that the name
did not change though. This could allow renaming of guests
via the backdoor, which in turn could allow for bypassing
access control restrictions based on names.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 142e6e27
...@@ -12558,6 +12558,17 @@ virDomainDefCheckABIStability(virDomainDefPtr src, ...@@ -12558,6 +12558,17 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
return false; return false;
} }
/* Not strictly ABI related, but we want to make sure domains
* don't get silently re-named through the backdoor when passing
* custom XML into various APIs, since this would create havoc
*/
if (STRNEQ(src->name, dst->name)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target domain name '%s' does not match source '%s'"),
dst->name, src->name);
return false;
}
if (src->mem.max_balloon != dst->mem.max_balloon) { if (src->mem.max_balloon != dst->mem.max_balloon) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target domain max memory %lld does not match source %lld"), _("Target domain max memory %lld does not match source %lld"),
......
...@@ -1940,12 +1940,6 @@ char *qemuMigrationBegin(virQEMUDriverPtr driver, ...@@ -1940,12 +1940,6 @@ char *qemuMigrationBegin(virQEMUDriverPtr driver,
VIR_DOMAIN_XML_INACTIVE))) VIR_DOMAIN_XML_INACTIVE)))
goto cleanup; goto cleanup;
if (STRNEQ(def->name, vm->def->name)) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("target domain name doesn't match source name"));
goto cleanup;
}
if (!virDomainDefCheckABIStability(vm->def, def)) if (!virDomainDefCheckABIStability(vm->def, def))
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册