}
rc = qemu_spice.set_passwd(password, fail_if_connected,
disconnect_if_connected);
- if (rc != 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
- }
- return;
- }
-
- if (strcmp(protocol, "vnc") == 0) {
+ } else if (strcmp(protocol, "vnc") == 0) {
if (fail_if_connected || disconnect_if_connected) {
/* vnc supports "connected=keep" only */
error_setg(errp, QERR_INVALID_PARAMETER, "connected");
/* Note that setting an empty password will not disable login through
* this interface. */
rc = vnc_display_password(NULL, password);
- if (rc < 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
- }
+ } else {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol",
+ "'vnc' or 'spice'");
return;
}
- error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
+ if (rc != 0) {
+ error_setg(errp, "Could not set password");
+ }
}
void qmp_expire_password(const char *protocol, const char *whenstr,
return;
}
rc = qemu_spice.set_pw_expire(when);
- if (rc != 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
- }
- return;
- }
-
- if (strcmp(protocol, "vnc") == 0) {
+ } else if (strcmp(protocol, "vnc") == 0) {
rc = vnc_display_pw_expire(NULL, when);
- if (rc != 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
- }
+ } else {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol",
+ "'vnc' or 'spice'");
return;
}
- error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
+ if (rc != 0) {
+ error_setg(errp, "Could not set password expire time");
+ }
}
#ifdef CONFIG_VNC
void qmp_change_vnc_password(const char *password, Error **errp)
{
if (vnc_display_password(NULL, password) < 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
+ error_setg(errp, "Could not set password");
}
}