block: rip out all traces of password prompting

Now that qcow & qcow2 are wired up to get encryption keys
via the QCryptoSecret object, nothing is relying on the
interactive prompting for passwords. All the code related
to password prompting can thus be ripped out.

Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170623162419.26068-17-berrange@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Daniel P. Berrange
2017-06-23 17:24:15 +01:00
committed by Max Reitz
parent 23f831c331
commit 788cf9f8c8
10 changed files with 2 additions and 269 deletions

View File

@ -58,7 +58,6 @@ static int openfile(char *name, int flags, bool writethrough, bool force_share,
QDict *opts)
{
Error *local_err = NULL;
BlockDriverState *bs;
if (qemuio_blk) {
error_report("file open already, try 'help close'");
@ -85,28 +84,9 @@ static int openfile(char *name, int flags, bool writethrough, bool force_share,
return 1;
}
bs = blk_bs(qemuio_blk);
if (bdrv_is_encrypted(bs) && bdrv_key_required(bs)) {
char password[256];
printf("Disk image '%s' is encrypted.\n", name);
if (qemu_read_password(password, sizeof(password)) < 0) {
error_report("No password given");
goto error;
}
if (bdrv_set_key(bs, password) < 0) {
error_report("invalid password");
goto error;
}
}
blk_set_enable_write_cache(qemuio_blk, !writethrough);
return 0;
error:
blk_unref(qemuio_blk);
qemuio_blk = NULL;
return 1;
}
static void open_help(void)