mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-19 14:50:09 +01:00
Ask user for confirmation before resuming reencryption.
The prompt is not showed in batch mode or when user explicitly asks for reencryption resume via --resume-only.
This commit is contained in:
@@ -141,6 +141,7 @@ static int reencrypt_get_active_name(struct crypt_device *cd, const char *data_d
|
|||||||
|
|
||||||
static int reencrypt_luks2_load(struct crypt_device *cd, const char *data_device)
|
static int reencrypt_luks2_load(struct crypt_device *cd, const char *data_device)
|
||||||
{
|
{
|
||||||
|
char *msg;
|
||||||
crypt_reencrypt_info ri;
|
crypt_reencrypt_info ri;
|
||||||
int r;
|
int r;
|
||||||
size_t passwordLen;
|
size_t passwordLen;
|
||||||
@@ -182,6 +183,18 @@ static int reencrypt_luks2_load(struct crypt_device *cd, const char *data_device
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ARG_SET(OPT_BATCH_MODE_ID) && !ARG_SET(OPT_RESUME_ONLY_ID)) {
|
||||||
|
r = asprintf(&msg, _("Device %s is already in LUKS2 reencryption. "
|
||||||
|
"Do you wish to resume previously initialised operation?"),
|
||||||
|
crypt_get_metadata_device_name(cd) ?: data_device);
|
||||||
|
if (r < 0)
|
||||||
|
return -ENOMEM;
|
||||||
|
r = yesDialog(msg, _("Operation aborted.\n")) ? 0 : -EINVAL;
|
||||||
|
free(msg);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
r = tools_get_key(NULL, &password, &passwordLen,
|
r = tools_get_key(NULL, &password, &passwordLen,
|
||||||
ARG_UINT64(OPT_KEYFILE_OFFSET_ID), ARG_UINT32(OPT_KEYFILE_SIZE_ID), ARG_STR(OPT_KEY_FILE_ID),
|
ARG_UINT64(OPT_KEYFILE_OFFSET_ID), ARG_UINT32(OPT_KEYFILE_SIZE_ID), ARG_STR(OPT_KEY_FILE_ID),
|
||||||
ARG_UINT32(OPT_TIMEOUT_ID), verify_passphrase(0), 0, cd);
|
ARG_UINT32(OPT_TIMEOUT_ID), verify_passphrase(0), 0, cd);
|
||||||
|
|||||||
Reference in New Issue
Block a user