Skip to contentSkip to conversation

hmp: Unbreak "change vnc", tidy up set_password's doc

PATCH Applied Markus Armbruster 4 participants 9 messages Sep 9, 2021 – Sep 23, 2021

lore
Share & tools
lore
#0 lore raw

cover hmp: Unbreak "change vnc", tidy up set_password's doc

If you'd rather delete "change vnc", go ahead and post a patch.

Markus Armbruster (2):
hmp: Unbreak "change vnc"
hmp: Drop a bogus sentence from set_password's documentation

 monitor/hmp-cmds.c |  2 +-
 hmp-commands.hx    | 11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/2 hmp: Unbreak "change vnc"

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
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
monitor/hmp-cmds.c +1 -1
index e00255f7ee..a7e197a90b 100644
@@ -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;
Signature · 1 line
2.31.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] hmp: Unbreak "change vnc"

Quoted 23 lines · Markus Armbruster

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.

Quoted 8 lines

Fix the obvious way.

Fixes cfb5387a1de2acda23fb5c97d2378b9e7ddf8025
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw

Re: [PATCH 1/2] hmp: Unbreak "change vnc"

In reply to Markus Armbruster

Le 09/09/2021 à 10:12, Markus Armbruster a écrit :

Quoted 38 lines

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
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
monitor/hmp-cmds.c +0 -0
index e00255f7ee..a7e197a90b 100644

monitor/hmp-cmds.c void hmp_change(Monitor *mon, const QDict *qdict) · line 1502

Quoted 8 lines
monitor/hmp-cmds.c +1 -1
@@ -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;

Applied to my trivial-patches branch.

Thanks,
Laurent

#4 lore raw

PATCH 2/2 hmp: Drop a bogus sentence from set_password's documentation

In reply to Markus Armbruster
---
 hmp-commands.hx | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
hmp-commands.hx +5 -6
index 8e45bce2cd..cf723c69ac 100644
@@ -1522,12 +1522,11 @@ ERST
 
 SRST
 ``set_password [ vnc | spice ] password [ action-if-connected ]``
-  Change spice/vnc password.  Use zero to make the password stay valid
-  forever.  *action-if-connected* specifies what should happen in
-  case a connection is established: *fail* makes the password change
-  fail.  *disconnect* changes the password and disconnects the
-  client.  *keep* changes the password and keeps the connection up.
-  *keep* is the default.
+  Change spice/vnc password.  *action-if-connected* specifies what
+  should happen in case a connection is established: *fail* makes the
+  password change fail.  *disconnect* changes the password and
+  disconnects the client.  *keep* changes the password and keeps the
+  connection up.  *keep* is the default.
 ERST
 
     {
Signature · 1 line
2.31.1
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] hmp: Drop a bogus sentence from set_password's documentation

Quoted 4 lines · Markus Armbruster
---
 hmp-commands.hx | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#6 lore raw

Re: [PATCH 2/2] hmp: Drop a bogus sentence from set_password's documentation

In reply to Markus Armbruster

Le 09/09/2021 à 10:12, Markus Armbruster a écrit :

Quoted 18 lines
---
 hmp-commands.hx | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
hmp-commands.hx +0 -4
index 8e45bce2cd..cf723c69ac 100644
@@ -1522,12 +1522,11 @@ ERST
 
 SRST
 ``set_password [ vnc | spice ] password [ action-if-connected ]``
-  Change spice/vnc password.  Use zero to make the password stay valid
-  forever.  *action-if-connected* specifies what should happen in
-  case a connection is established: *fail* makes the password change
-  fail.  *disconnect* changes the password and disconnects the

hmp-commands.hx ERST · line 1532

Quoted 10 lines
hmp-commands.hx +5 -2
-  client.  *keep* changes the password and keeps the connection up.
-  *keep* is the default.
+  Change spice/vnc password.  *action-if-connected* specifies what
+  should happen in case a connection is established: *fail* makes the
+  password change fail.  *disconnect* changes the password and
+  disconnects the client.  *keep* changes the password and keeps the
+  connection up.  *keep* is the default.
 ERST
 
     {

Applied to my trivial-patches branch.

Thanks,
Laurent