qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: "Daniel P . Berrangé" <berrange@redhat.com>,
	qemu-trivial@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
	"Michael Tokarev" <mjt@tls.msk.ru>,
	qemu-stable@nongnu.org, "Laurent Vivier" <laurent@vivier.eu>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [PULL 3/5] hmp: Unbreak "change vnc"
Date: Mon, 27 Sep 2021 11:52:50 +0200	[thread overview]
Message-ID: <20210927095252.2374148-4-laurent@vivier.eu> (raw)
In-Reply-To: <20210927095252.2374148-1-laurent@vivier.eu>

From: Markus Armbruster <armbru@redhat.com>

HMP command "change vnc" can take the password as argument, or prompt
for it:

    (qemu) change vnc password 123
    (qemu) change vnc password
    Password: ***
    (qemu)

This regressed in commit cfb5387a1d "hmp: remove "change vnc TARGET"
command", v6.0.0.

    (qemu) change vnc passwd 123
    Password: ***
    (qemu) change vnc passwd
    (qemu)

The latter passes NULL to qmp_change_vnc_password(), which is a no-no.
Looks like it puts the display into "password required, but none set"
state.

The logic error is easy to miss in review, but testing should've
caught it.

Fix the obvious way.

Fixes: cfb5387a1de2acda23fb5c97d2378b9e7ddf8025
Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20210909081219.308065-2-armbru@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index e00255f7ee70..a7e197a90bf7 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1496,7 +1496,7 @@ 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;
-- 
2.31.1



  parent reply	other threads:[~2021-09-27  9:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27  9:52 [PULL 0/5] Trivial branch for 6.2 patches Laurent Vivier
2021-09-27  9:52 ` [PULL 1/5] docs/nvdimm: Update nvdimm option value in machine example Laurent Vivier
2021-09-27  9:52 ` [PULL 2/5] hw/loader: Restrict PC_ROM_* definitions to hw/i386/pc Laurent Vivier
2021-09-27  9:52 ` Laurent Vivier [this message]
2021-09-27  9:52 ` [PULL 4/5] hmp: Drop a bogus sentence from set_password's documentation Laurent Vivier
2021-09-27  9:52 ` [PULL 5/5] multi-process: fix usage information Laurent Vivier
2021-09-27 14:02 ` [PULL 0/5] Trivial branch for 6.2 patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210927095252.2374148-4-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).