mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-09-21 09:44:54 +03:00
Compare commits
1 Commits
v3.9.0
...
v1.0.1-mai
Author | SHA1 | Date | |
---|---|---|---|
|
36386a9356 |
@@ -2657,19 +2657,19 @@ 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;
|
int ret;
|
||||||
|
|
||||||
if (!auth->passwd && !driver->vncPassword)
|
if (!auth->passwd && !driver->vncPassword)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
password = auth->passwd ? auth->passwd : defaultPasswd;
|
||||||
|
|
||||||
if (auth->connected)
|
if (auth->connected)
|
||||||
connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected);
|
connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected);
|
||||||
|
|
||||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||||
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) {
|
||||||
@@ -2677,14 +2677,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 cleanup;
|
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;
|
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");
|
||||||
|
Reference in New Issue
Block a user