The code which set VNC passwords correctly had fallback for
the set_password command, but was lacking it for the
expire_password command. This made it impossible to start
a guest. It also failed to check whether QEMU was still
running after the initial 'set_password' command completed
* src/qemu/qemu_hotplug.c: Fix error handling when
password expiry fails
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Fix
return code for missing expire_password command
auth->passwd ? auth->passwd : defaultPasswd);
}
}
+ if (ret != 0)
+ goto cleanup;
+
+ if (!virDomainObjIsActive(vm)) {
+ ret = -1;
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("guest unexpectedly quit"));
+ goto cleanup;
+ }
if (auth->expires) {
time_t lifetime = auth->validTo - now;
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Expiry of passwords is not supported"));
ret = -1;
+ } else {
+ ret = 0;
}
}
+cleanup:
qemuDomainObjExitMonitorWithDriver(driver, vm);
return ret;
return ret;
}
+/* Returns -1 on error, -2 if not supported */
int qemuMonitorJSONExpirePassword(qemuMonitorPtr mon,
const char *protocol,
const char *expire_time)
ret = qemuMonitorJSONCommand(mon, cmd, &reply);
- if (ret == 0)
+ if (ret == 0) {
+ if (qemuMonitorJSONHasError(reply, "CommandNotFound")) {
+ ret = -2;
+ goto cleanup;
+ }
+
ret = qemuMonitorJSONCheckError(cmd, reply);
+ }
+cleanup:
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
return ret;
}
+/* Returns -1 on error, -2 if not supported */
int qemuMonitorTextExpirePassword(qemuMonitorPtr mon,
const char *protocol,
const char *expire_time)
}
if (strstr(reply, "unknown command:")) {
- qemuReportError(VIR_ERR_NO_SUPPORT,
- _("expiring password not supported by this qemu: %s"), reply);
+ ret = -2;
goto cleanup;
}