qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] support for unsetting the VNC password from the


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] support for unsetting the VNC password from the monitor.
Date: Thu, 05 Mar 2009 14:28:20 -0600
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

Nolan wrote:
Add monitor support for setting the VNC password to "", disabling VNC.

The magic sentinel value is "<<unset>>" which is not a valid VNC password by
virtue of being 9 characters long.

That's a little too magical for me. If you want to disable VNC, can't you just say change vnc none?

Regards,

Anthony Liguori

diff --git a/qemu/monitor.c b/qemu/monitor.c
index 1b2adc8..7bbb457 100644
--- a/qemu/monitor.c
+++ b/qemu/monitor.c
@@ -466,8 +466,13 @@ static void do_change_vnc(const char *target, const char 
*arg)
        strcmp(target, "password") == 0) {
        char password[9];
        if (arg) {
-           strncpy(password, arg, sizeof(password));
-           password[sizeof(password) - 1] = '\0';
+            /* "<<unset>>" is 9 chars long, so it is not a valid VNC passwd. */
+            if (strcmp(arg, "<<unset>>") == 0) {
+                password[0] = '\0';
+            } else {
+                strncpy(password, arg, sizeof(password));
+                password[sizeof(password) - 1] = '\0';
+            }
        } else
            monitor_readline("Password: ", 1, password, sizeof(password));
        if (vnc_display_password(NULL, password) < 0)










reply via email to

[Prev in Thread] Current Thread [Next in Thread]