diff options
author | Jiri Denemark <jdenemar@redhat.com> | 2016-06-28 14:39:58 +0200 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2016-06-30 14:47:51 +0100 |
commit | eea38b5922b7daff91fd146869a337287e77065e (patch) | |
tree | ec6c859cf46936d66856ce64889732ad913921ad | |
parent | 750280023cc0896b05f86e292857ceef5eee3a72 (diff) | |
download | libvirt-v0.9.12-maint.tar.gz |
qemu: Let empty default VNC password work as documentedv0.9.12-maint
CVE-2016-5008
Setting an empty graphics password is documented as a way to disable
VNC/SPICE access, but QEMU does not always behaves like that. VNC would
happily accept the empty password. Let's enforce the behavior by setting
password expiration to "now".
https://bugzilla.redhat.com/show_bug.cgi?id=1180092
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit bb848feec0f3f10e92dd8e5231ae7aa89b5598f3)
(cherry picked from commit d933f68ee660566b52cd90330aee0d5f414636a4)
(cherry picked from commit 139a4265774b7aa194f8479a82188bc1337cd7a4)
-rw-r--r-- | src/qemu/qemu_hotplug.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 9b608162fe..9e3337bb40 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2315,19 +2315,19 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver, time_t now = time(NULL); char expire_time [64]; const char *connected = NULL; + const char *password; int ret; if (!auth->passwd && !driver->vncPassword) return 0; + password = auth->passwd ? auth->passwd : defaultPasswd; + if (auth->connected) connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected); qemuDomainObjEnterMonitorWithDriver(driver, vm); - ret = qemuMonitorSetPassword(priv->mon, - type, - auth->passwd ? auth->passwd : defaultPasswd, - connected); + ret = qemuMonitorSetPassword(priv->mon, type, password, connected); if (ret == -2) { if (type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { @@ -2335,14 +2335,15 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver, _("Graphics password only supported for VNC")); ret = -1; } else { - ret = qemuMonitorSetVNCPassword(priv->mon, - auth->passwd ? auth->passwd : defaultPasswd); + ret = qemuMonitorSetVNCPassword(priv->mon, password); } } if (ret != 0) goto cleanup; - if (auth->expires) { + if (password[0] == '\0') { + snprintf(expire_time, sizeof(expire_time), "now"); + } else if (auth->expires) { time_t lifetime = auth->validTo - now; if (lifetime <= 0) snprintf(expire_time, sizeof(expire_time), "now"); |