diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2015-02-06 18:06:07 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2015-02-06 18:06:07 +0000 |
| commit | 3d815ac82b0a3e816fd7a6d2561a73e780c3b685 (patch) | |
| tree | bb5af8266e302cbe460b3e5de2cb261a877a6678 /monitor.c | |
| parent | a2f2d288b5a06e6c680c387c9980d91363f59c61 (diff) | |
| parent | 728dacbda817b2ca259e9d337fab06bcf14e94a6 (diff) | |
| download | focaccia-qemu-3d815ac82b0a3e816fd7a6d2561a73e780c3b685.tar.gz focaccia-qemu-3d815ac82b0a3e816fd7a6d2561a73e780c3b685.zip | |
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block patches for 2.3 # gpg: Signature made Fri 06 Feb 2015 17:14:10 GMT using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (47 commits) block/raw-posix.c: Fix raw_getlength() on Mac OS X block devices block: Eliminate silly QERR_ macros used for encryption keys block: New bdrv_add_key(), convert monitor to use it blockdev: Eliminate silly QERR_BLOCK_JOB_NOT_ACTIVE macro blockdev: Give find_block_job() an Error ** parameter qcow2: Rewrite qcow2_alloc_bytes() block: Give always priority to unused entries in the qcow2 L2 cache nbd: fix max_discard/max_transfer_length block: introduce BDRV_REQUEST_MAX_SECTORS nbd: Improve error messages iotests: Fix 104 for NBD iotests: Fix 100 for nbd iotests: Fix 083 block: fix off-by-one error in qcow and qcow2 qemu-iotests: add 116 invalid QED input file tests qed: check for header size overflow block/dmg: improve zeroes handling block/dmg: support bzip2 block entry types block/dmg: factor out block type check block/dmg: use SectorNumber from BLKX header ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'monitor.c')
| -rw-r--r-- | monitor.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/monitor.c b/monitor.c index 5a24311844..c3cc060b45 100644 --- a/monitor.c +++ b/monitor.c @@ -5368,9 +5368,12 @@ static void bdrv_password_cb(void *opaque, const char *password, Monitor *mon = opaque; BlockDriverState *bs = readline_opaque; int ret = 0; + Error *local_err = NULL; - if (bdrv_set_key(bs, password) != 0) { - monitor_printf(mon, "invalid password\n"); + bdrv_add_key(bs, password, &local_err); + if (local_err) { + monitor_printf(mon, "%s\n", error_get_pretty(local_err)); + error_free(local_err); ret = -EPERM; } if (mon->password_completion_cb) @@ -5388,17 +5391,20 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, BlockCompletionFunc *completion_cb, void *opaque) { + Error *local_err = NULL; int err; - if (!bdrv_key_required(bs)) { + bdrv_add_key(bs, NULL, &local_err); + if (!local_err) { if (completion_cb) completion_cb(opaque, 0); return 0; } + /* Need a key for @bs */ + if (monitor_ctrl_mode(mon)) { - qerror_report(QERR_DEVICE_ENCRYPTED, bdrv_get_device_name(bs), - bdrv_get_encrypted_filename(bs)); + qerror_report_err(local_err); return -1; } |