aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2009-12-07 21:37:00 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-07 16:36:49 -0600
commit931a548be3cfb3a3473ece5ff59365963124d705 (patch)
treef1f919e75969a0155bce1dbc496d1d52d1598c44 /monitor.c
parentbcddbd0f6aff8e0061f2ab6686b29892544a076d (diff)
monitor: do_cont(): Don't ask for passwords
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 <lcapitulino@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 94171e119cb6f7bab2578896643b0daff1d9b184)
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/monitor.c b/monitor.c
index 27c696b2d4..bdf4b720af 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;
@@ -4103,6 +4106,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));