mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 18:23:32 +08:00
cryptenroll: don't return slot 0 when we have no policy to search for
If the policy hash is empty we shouldn't return "0" from search_policy_hash(), because that is understood as slot index 0, but that's unlikely to match the policy. Hence, return -ENOENT instead, indicating that we can't find a matching slot.
This commit is contained in:
parent
549c1a99d4
commit
41bcb93087
@ -26,7 +26,7 @@ static int search_policy_hash(
|
||||
assert(iovec_is_valid(hash));
|
||||
|
||||
if (!iovec_is_set(hash))
|
||||
return 0;
|
||||
return -ENOENT;
|
||||
|
||||
for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token++) {
|
||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user