mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Forbid new-line char in name of new domain
New line character in name of domain is now forbidden because it mess virsh output and can be confusing for users. Validation of name is done in drivers, after parsing XML to avoid problems with dissappeared domains which was already created with new-line char in name. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d6a5bef11e
commit
6c98ac2c62
@ -541,6 +541,9 @@ bhyveDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag
|
||||
NULL, parse_flags)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -3051,6 +3051,9 @@ esxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
|
||||
if (!def)
|
||||
return NULL;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* Check if an existing domain should be edited */
|
||||
if (esxVI_LookupVirtualMachineByUuid(priv->primary, def->uuid, NULL,
|
||||
&virtualMachine,
|
||||
|
@ -2791,6 +2791,9 @@ libxlDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flag
|
||||
NULL, parse_flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -475,6 +475,9 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
|
||||
NULL, parse_flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -1000,6 +1000,9 @@ openvzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
|
||||
NULL, parse_flags)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", vmdef->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = virDomainObjListAdd(driver->domains, vmdef,
|
||||
driver->xmlopt,
|
||||
0, NULL)))
|
||||
|
@ -7339,6 +7339,9 @@ qemuDomainDefineXMLFlags(virConnectPtr conn,
|
||||
NULL, parse_flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -2641,6 +2641,9 @@ static virDomainPtr testDomainDefineXMLFlags(virConnectPtr conn,
|
||||
NULL, parse_flags)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (testDomainGenerateIfnames(def) < 0)
|
||||
goto cleanup;
|
||||
if (!(dom = virDomainObjListAdd(privconn->domains,
|
||||
|
@ -2074,6 +2074,9 @@ umlDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
|
||||
NULL, parse_flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -392,6 +392,9 @@ vmwareDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
|
||||
NULL, parse_flags)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", vmdef->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* generate vmx file */
|
||||
vmx = virVMXFormatConfig(&ctx, driver->xmlopt, vmdef, 7);
|
||||
if (vmx == NULL)
|
||||
|
@ -854,6 +854,9 @@ vzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
|
||||
NULL, parse_flags)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -1810,6 +1810,9 @@ xenUnifiedDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int
|
||||
NULL, parse_flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -1759,6 +1759,11 @@ xenapiDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
|
||||
if (!defPtr)
|
||||
return NULL;
|
||||
|
||||
if (virXMLCheckIllegalChars("name", defPtr->name, "\n") < 0) {
|
||||
virDomainDefFree(defPtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (createVMRecordFromXml(conn, defPtr, &record, &vm) != 0) {
|
||||
if (!priv->session->ok)
|
||||
xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user