diff mbox series

[1/2] monitor/hmp: correctly invert password argument detection again

Message ID 20210825093701.668122-2-s.reiter@proxmox.com
State New
Headers show
Series VNC-related HMP/QMP fixes | expand

Commit Message

Stefan Reiter Aug. 25, 2021, 9:37 a.m. UTC
Commit cfb5387a1d 'hmp: remove "change vnc TARGET" command' claims to
remove the HMP "change vnc" command, but doesn't actually do that.
Instead if rewires it to use 'qmp_change_vnc_password', and in the
process inverts the argument detection - ignoring the first issue, this
inversion is wrong, as this will now ask the user for a password if one
is already provided, and simply fail if none is given.

Fixes: cfb5387a1d ("hmp: remove "change vnc TARGET" command")
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marc-André Lureau Aug. 25, 2021, 10:42 a.m. UTC | #1
Hi

On Wed, Aug 25, 2021 at 1:38 PM Stefan Reiter <s.reiter@proxmox.com> wrote:

> Commit cfb5387a1d 'hmp: remove "change vnc TARGET" command' claims to
> remove the HMP "change vnc" command, but doesn't actually do that.
> Instead if rewires it to use 'qmp_change_vnc_password', and in the
> process inverts the argument detection - ignoring the first issue, this
> inversion is wrong, as this will now ask the user for a password if one
> is already provided, and simply fail if none is given.
>
> Fixes: cfb5387a1d ("hmp: remove "change vnc TARGET" command")
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
>

Oh.. hmp, hear me please!

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  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 f7a211e5a4..31366e6331 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -1591,7 +1591,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.30.2
>
>
>
>
diff mbox series

Patch

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index f7a211e5a4..31366e6331 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1591,7 +1591,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;