* [Qemu-devel] [PATCH] extend monitor "change vnc password"
@ 2008-10-23 22:45 Nolan
0 siblings, 0 replies; only message in thread
From: Nolan @ 2008-10-23 22:45 UTC (permalink / raw)
To: qemu-devel
This patch extends the monitor command "change vnc password" to accept
an optional extra argument that is the new password:
(qemu) change vnc password new_pass
the magic string "<unset>" will unset the password, disabling VNC.
If the extra argument is not given, the behavior is to prompt for a
password, as before.
This change makes it easier to remotely change the VNC password using
scripts like Anthony's "qemu-remote".
--- monitor.c.orig 2008-10-22 17:32:05.000000000 -0700
+++ monitor.c 2008-10-22 17:56:40.000000000 -0700
@@ -447,35 +447,41 @@
}
}
if (eject_device(bs, 0) < 0)
return;
bdrv_open2(bs, filename, 0, drv);
qemu_key_check(bs, filename);
}
-static void do_change_vnc(const char *target)
+static void do_change_vnc(const char *target, const char *fmt)
{
if (strcmp(target, "passwd") == 0 ||
strcmp(target, "password") == 0) {
- char password[9];
- monitor_readline("Password: ", 1, password, sizeof(password)-1);
+ char password[9] = {0, };
+ if (fmt) {
+ if (strcmp(fmt, "<unset>") != 0) {
+ strncpy(password, fmt, sizeof(password)-1);
+ }
+ } else {
+ monitor_readline("Password: ", 1, password, sizeof(password)-1);
+ }
password[sizeof(password)-1] = '\0';
if (vnc_display_password(NULL, password) < 0)
term_printf("could not set VNC server password\n");
} else {
if (vnc_display_open(NULL, target) < 0)
term_printf("could not start VNC server on %s\n", target);
}
}
static void do_change(const char *device, const char *target, const char *fmt)
{
if (strcmp(device, "vnc") == 0) {
- do_change_vnc(target);
+ do_change_vnc(target, fmt);
} else {
do_change_block(device, target, fmt);
}
}
static void do_screen_dump(const char *filename)
{
vga_hw_screen_dump(filename);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-23 22:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-23 22:45 [Qemu-devel] [PATCH] extend monitor "change vnc password" Nolan
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).