mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 14:05:18 +00:00
qemu: vnc: error out for invalid port number
In the XML we have the vnc port number, but QEMU takes on command line a vnc screen number, it's port-5900. We should fail with error message that only ports in range [5900,65535] are valid. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1164966 Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
abac12b585
commit
afaffeb873
@ -7591,7 +7591,16 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
|
||||
|
||||
virBufferAsprintf(&opt, "unix:%s", graphics->data.vnc.socket);
|
||||
|
||||
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) {
|
||||
} else {
|
||||
if (!graphics->data.vnc.autoport &&
|
||||
(graphics->data.vnc.port < 5900 ||
|
||||
graphics->data.vnc.port > 65535)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("vnc port must be in range [5900,65535]"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) {
|
||||
switch (virDomainGraphicsListenGetType(graphics, 0)) {
|
||||
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
|
||||
listenAddr = virDomainGraphicsListenGetAddress(graphics, 0);
|
||||
@ -7612,8 +7621,8 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
|
||||
goto error;
|
||||
|
||||
listenAddr = netAddr;
|
||||
/* store the address we found in the <graphics> element so it will
|
||||
* show up in status. */
|
||||
/* store the address we found in the <graphics> element so it
|
||||
* will show up in status. */
|
||||
if (virDomainGraphicsListenSetAddress(graphics, 0,
|
||||
listenAddr, -1, false) < 0)
|
||||
goto error;
|
||||
@ -7636,6 +7645,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
|
||||
virBufferAsprintf(&opt, "%d",
|
||||
graphics->data.vnc.port - 5900);
|
||||
}
|
||||
}
|
||||
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) {
|
||||
if (!graphics->data.vnc.socket &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user