Skip to content

Commit dcecba7

Browse files
committed
Enforce limit of 15 unlock bindings per pool
1 parent 65ccec0 commit dcecba7

File tree

1 file changed

+12
-0
lines changed
  • src/engine/strat_engine/crypt/handle

1 file changed

+12
-0
lines changed

src/engine/strat_engine/crypt/handle/v2.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,12 @@ impl CryptHandle {
544544
pin: &str,
545545
json: &Value,
546546
) -> StratisResult<u32> {
547+
if self.metadata.encryption_info.all_token_slots().count() >= 15 {
548+
return Err(StratisError::Msg(
549+
"Reached limit of 15 token and keyslots for pool".to_string(),
550+
));
551+
}
552+
547553
let mut json_owned = json.clone();
548554
let yes = interpret_clevis_config(pin, &mut json_owned)?;
549555

@@ -644,6 +650,12 @@ impl CryptHandle {
644650
token_slot: Option<u32>,
645651
key_desc: &KeyDescription,
646652
) -> StratisResult<u32> {
653+
if self.metadata.encryption_info.all_token_slots().count() >= 15 {
654+
return Err(StratisError::Msg(
655+
"Reached limit of 15 token and keyslots for pool".to_string(),
656+
));
657+
}
658+
647659
let mut device = self.acquire_crypt_device()?;
648660
let key =
649661
get_passphrase(&mut device, self.encryption_info())?.either(|(_, key)| key, |key| key);

0 commit comments

Comments
 (0)