mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-28 20:25:25 +03:00
dissect-image: simplify check for passphrase presence
m->encrypted is set when fstype=="crypto_LUKS", but this is not obvious when reading decrypt_partition(). Just check if passphrase is set before using it.
This commit is contained in:
parent
bbd1590085
commit
bdd73ac5c2
@ -861,6 +861,9 @@ static int decrypt_partition(
|
||||
if (!streq(m->fstype, "crypto_LUKS"))
|
||||
return 0;
|
||||
|
||||
if (!passphrase)
|
||||
return -ENOKEY;
|
||||
|
||||
r = make_dm_name_and_node(m->node, "-decrypted", &name, &node);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -1006,9 +1009,6 @@ int dissected_image_decrypt(
|
||||
}
|
||||
|
||||
#if HAVE_LIBCRYPTSETUP
|
||||
if (m->encrypted && !passphrase)
|
||||
return -ENOKEY;
|
||||
|
||||
d = new0(DecryptedImage, 1);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
|
Loading…
Reference in New Issue
Block a user