From cfb5387a1de2acda23fb5c97d2378b9e7ddf8025 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 20 Jan 2021 15:42:33 +0100 Subject: hmp: remove "change vnc TARGET" command The HMP command \"change vnc TARGET\" is messy: - it takes an ugly shortcut to determine if the option has an "id", with incorrect results if "id=" is not preceded by an unescaped comma. - it deletes the existing QemuOpts and does not try to rollback if the parsing fails (which is not causing problems, but only due to how VNC options are parsed) - because it uses the same parsing function as "-vnc", it forces the latter to not support "-vnc help". On top of this, it uses a deprecated QMP command, thus getting in the way of removing the QMP command. Since the usecase for the command is not clear, just remove it and send "change vnc password" directly to the QMP "change-vnc-password" command. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake Reviewed-by: Gerd Hoffmann Message-Id: <20210120144235.345983-2-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini --- monitor/hmp-cmds.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'monitor') diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index fd4d77e246..499647a578 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1521,13 +1521,16 @@ void hmp_change(Monitor *mon, const QDict *qdict) } if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) { - if (!arg) { + if (arg) { MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common); monitor_read_password(hmp_mon, hmp_change_read_arg, NULL); return; + } else { + qmp_change_vnc_password(arg, &err); } + } else { + monitor_printf(mon, "Expected 'password' after 'vnc'\n"); } - qmp_change("vnc", target, !!arg, arg, &err); } else #endif { -- cgit v1.2.3