提交 49fa383b 编写于 作者: J Jiri Denemark 提交者: Daniel P. Berrange

qemu: Let empty default VNC password work as documented

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=1180092Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
(cherry picked from commit bb848fee)
上级 08acad56
...@@ -4026,6 +4026,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, ...@@ -4026,6 +4026,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
time_t now = time(NULL); time_t now = time(NULL);
char expire_time [64]; char expire_time [64];
const char *connected = NULL; const char *connected = NULL;
const char *password;
int ret = -1; int ret = -1;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
...@@ -4033,16 +4034,14 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, ...@@ -4033,16 +4034,14 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
ret = 0; ret = 0;
goto cleanup; goto cleanup;
} }
password = auth->passwd ? auth->passwd : defaultPasswd;
if (auth->connected) if (auth->connected)
connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected); connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected);
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup; goto cleanup;
ret = qemuMonitorSetPassword(priv->mon, ret = qemuMonitorSetPassword(priv->mon, type, password, connected);
type,
auth->passwd ? auth->passwd : defaultPasswd,
connected);
if (ret == -2) { if (ret == -2) {
if (type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { if (type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
...@@ -4050,14 +4049,15 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, ...@@ -4050,14 +4049,15 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
_("Graphics password only supported for VNC")); _("Graphics password only supported for VNC"));
ret = -1; ret = -1;
} else { } else {
ret = qemuMonitorSetVNCPassword(priv->mon, ret = qemuMonitorSetVNCPassword(priv->mon, password);
auth->passwd ? auth->passwd : defaultPasswd);
} }
} }
if (ret != 0) if (ret != 0)
goto end_job; goto end_job;
if (auth->expires) { if (password[0] == '\0') {
snprintf(expire_time, sizeof(expire_time), "now");
} else if (auth->expires) {
time_t lifetime = auth->validTo - now; time_t lifetime = auth->validTo - now;
if (lifetime <= 0) if (lifetime <= 0)
snprintf(expire_time, sizeof(expire_time), "now"); snprintf(expire_time, sizeof(expire_time), "now");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册