From patchwork Mon Dec 7 20:37:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [FOR,0.12,02/18] monitor: do_cont(): Don't ask for passwords Date: Mon, 07 Dec 2009 10:37:00 -0000 From: Markus Armbruster X-Patchwork-Id: 40544 Message-Id: <1260218236-22143-3-git-send-email-armbru@redhat.com> To: qemu-devel@nongnu.org Cc: lcapitulino@redhat.com From: Luiz Capitulino The do_cont() function will ask the user to enter a password if a device is encrypted. This is invalid under QMP, so we raise a QERR_DEVICE_ENCRYPTED error. Signed-off-by: Luiz Capitulino Signed-off-by: Markus Armbruster --- monitor.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index 0ff208e..50c616d 100644 --- a/monitor.c +++ b/monitor.c @@ -148,7 +148,10 @@ static void monitor_read_command(Monitor *mon, int show_prompt) static int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, void *opaque) { - if (mon->rs) { + if (monitor_ctrl_mode(mon)) { + qemu_error_new(QERR_MISSING_PARAMETER, "password"); + return -EINVAL; + } else if (mon->rs) { readline_start(mon->rs, "Password: ", 1, readline_func, opaque); /* prompt is printed on return from the command handler */ return 0; @@ -4188,6 +4191,11 @@ void monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, return; } + if (monitor_ctrl_mode(mon)) { + qemu_error_new(QERR_DEVICE_ENCRYPTED, bdrv_get_device_name(bs)); + return; + } + monitor_printf(mon, "%s (%s) is encrypted.\n", bdrv_get_device_name(bs), bdrv_get_encrypted_filename(bs));